Sha256: d91243eee61f5ff891d0b7f16bc457f6cf8868e2bbb20c2264c177838675da2d
Contents?: true
Size: 1.25 KB
Versions: 24
Compression:
Stored size: 1.25 KB
Contents
=begin Example: # fonts :system.nsfont => NSFont.systemFontOfSize(NSFont.systemFontSize) :label.nsfont => NSFont.systemFontOfSize(NSFont.labelFontSize) You can extend the defaults by adding entries: Symbol.nsfontsize[:big] = 40 :big.nsfont => NSFont =end class Symbol def nsfont(size=nil) size ||= NSFont.systemFontSize # system fonts if Symbol.nsfont.has_key? self font = SugarCube.look_in(self, Symbol.nsfont) if size.is_a?(Symbol) size = size.nsfontsize end if font.is_a?(Symbol) return NSFont.send(font, size) else return font.nsfont(size) end else if size.is_a?(Symbol) size = size.nsfontsize end return NSFont.systemFontOfSize(size) end end def nsfontsize size = SugarCube.look_in(self, Symbol.nsfontsize) if size.is_a?(Symbol) return NSFont.send(size) end return size.to_f end class << self attr :nsfont attr :nsfontsize end @nsfont = { system: :"systemFontOfSize:", bold: :"boldSystemFontOfSize:", monospace: 'Courier New', } @nsfontsize = { label: :labelFontSize, button: :buttonFontSize, small: :smallSystemFontSize, system: :systemFontSize, } end
Version data entries
24 entries across 24 versions & 1 rubygems