Class: Processing::Font
- Inherits:
-
Object
- Object
- Processing::Font
- Defined in:
- lib/processing/font.rb
Overview
Font object.
Class Method Summary collapse
-
.list ⇒ String
Returns available font names.
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.
Class Method Details
.list ⇒ String
Returns available font names
51 52 53 |
# File 'lib/processing/font.rb', line 51 def self.list() Rays::Font.families.values.flatten end |
Instance Method Details
#inspect ⇒ String
Returns a string containing a human-readable representation of object.
41 42 43 |
# File 'lib/processing/font.rb', line 41 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.
32 33 34 35 |
# File 'lib/processing/font.rb', line 32 def textBounds(str, x = 0, y = 0, fontSize = nil) font = getInternal__ fontSize TextBounds.new x, y, x + font.width(str), y + font.height end |