Class: Quartz::Text

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyquartz/text.rb

Constant Summary collapse

@@AlignmentNameToNumber =

NSTextAlignment

{
  :left => 0,
  :right => 1,
  :center => 2,
  :justified => 3,
  :natural => 4,
}

Instance Method Summary collapse

Constructor Details

#initialize(string, options = {}) ⇒ Text

This is really basic, not exposing the full power of the Cocoa text system



39
40
41
42
43
44
# File 'lib/rubyquartz/text.rb', line 39

def initialize(string, options={})
  font = options[:font]
  color = options[:color]
  alignment = options[:align] || :left
  _initialize(string, font, color, @@AlignmentNameToNumber[alignment])
end

Instance Method Details

#sizeObject



46
47
48
# File 'lib/rubyquartz/text.rb', line 46

def size
  Size.new(width_used, height_used)
end