Class: Processing::Font
- Inherits:
-
Object
- Object
- Processing::Font
- Defined in:
- lib/processing/font.rb
Overview
Font object.
Instance Method Summary collapse
-
#inspect ⇒ String
Returns a string containing a human-readable representation of object.
-
#textBounds(str, x = 0, y = 0, fontSize = nil) ⇒ TextBounds
Returns bounding box.
Instance Method Details
#inspect ⇒ String
Returns a string containing a human-readable representation of object.
35 36 37 |
# File 'lib/processing/font.rb', line 35 def inspect() "#<Processing::Font: name:'#{@font.name}' size:#{@font.size}>" end |
#textBounds(str) ⇒ TextBounds #textBounds(str, x, y) ⇒ TextBounds #textBounds(str, x, y, fontSize) ⇒ TextBounds
Returns bounding box.
26 27 28 29 |
# File 'lib/processing/font.rb', line 26 def textBounds(str, x = 0, y = 0, fontSize = nil) f = fontSize ? Rays::Font.new(@font.name, fontSize) : @font TextBounds.new x, y, x + f.width(str), y + f.height end |