Class: CooCoo::DataSources::Xournal::Text
- Defined in:
- lib/coo-coo/data_sources/xournal/document.rb
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#font ⇒ Object
Returns the value of attribute font.
-
#size ⇒ Object
Returns the value of attribute size.
-
#text ⇒ Object
Returns the value of attribute text.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
- #bottom ⇒ Object
- #height ⇒ Object
-
#initialize(text, x, y, size = 12, color = 'black', font = 'Sans') ⇒ Text
constructor
A new instance of Text.
- #left ⇒ Object
- #right ⇒ Object
- #top ⇒ Object
- #width ⇒ Object
Constructor Details
#initialize(text, x, y, size = 12, color = 'black', font = 'Sans') ⇒ Text
Returns a new instance of Text.
282 283 284 285 286 287 288 289 |
# File 'lib/coo-coo/data_sources/xournal/document.rb', line 282 def initialize(text, x, y, size = 12, color = 'black', font = 'Sans') @text = text @x = x @y = y @size = size @color = color @font = font end |
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
280 281 282 |
# File 'lib/coo-coo/data_sources/xournal/document.rb', line 280 def color @color end |
#font ⇒ Object
Returns the value of attribute font.
280 281 282 |
# File 'lib/coo-coo/data_sources/xournal/document.rb', line 280 def font @font end |
#size ⇒ Object
Returns the value of attribute size.
280 281 282 |
# File 'lib/coo-coo/data_sources/xournal/document.rb', line 280 def size @size end |
#text ⇒ Object
Returns the value of attribute text.
280 281 282 |
# File 'lib/coo-coo/data_sources/xournal/document.rb', line 280 def text @text end |
#x ⇒ Object
Returns the value of attribute x.
280 281 282 |
# File 'lib/coo-coo/data_sources/xournal/document.rb', line 280 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
280 281 282 |
# File 'lib/coo-coo/data_sources/xournal/document.rb', line 280 def y @y end |
Instance Method Details
#bottom ⇒ Object
308 309 310 |
# File 'lib/coo-coo/data_sources/xournal/document.rb', line 308 def bottom y + height end |
#height ⇒ Object
312 313 314 |
# File 'lib/coo-coo/data_sources/xournal/document.rb', line 312 def height @size * @text.count("\n") end |
#left ⇒ Object
291 292 293 |
# File 'lib/coo-coo/data_sources/xournal/document.rb', line 291 def left x end |
#right ⇒ Object
299 300 301 |
# File 'lib/coo-coo/data_sources/xournal/document.rb', line 299 def right x + width end |
#top ⇒ Object
295 296 297 |
# File 'lib/coo-coo/data_sources/xournal/document.rb', line 295 def top y end |
#width ⇒ Object
303 304 305 306 |
# File 'lib/coo-coo/data_sources/xournal/document.rb', line 303 def width # TODO but how? @text.length * @size end |