Class: CooCoo::DataSources::Xournal::Text

Inherits:
Object
  • Object
show all
Defined in:
lib/coo-coo/data_sources/xournal/document.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#colorObject

Returns the value of attribute color.



280
281
282
# File 'lib/coo-coo/data_sources/xournal/document.rb', line 280

def color
  @color
end

#fontObject

Returns the value of attribute font.



280
281
282
# File 'lib/coo-coo/data_sources/xournal/document.rb', line 280

def font
  @font
end

#sizeObject

Returns the value of attribute size.



280
281
282
# File 'lib/coo-coo/data_sources/xournal/document.rb', line 280

def size
  @size
end

#textObject

Returns the value of attribute text.



280
281
282
# File 'lib/coo-coo/data_sources/xournal/document.rb', line 280

def text
  @text
end

#xObject

Returns the value of attribute x.



280
281
282
# File 'lib/coo-coo/data_sources/xournal/document.rb', line 280

def x
  @x
end

#yObject

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

#bottomObject



308
309
310
# File 'lib/coo-coo/data_sources/xournal/document.rb', line 308

def bottom
  y + height
end

#heightObject



312
313
314
# File 'lib/coo-coo/data_sources/xournal/document.rb', line 312

def height
  @size * @text.count("\n")
end

#leftObject



291
292
293
# File 'lib/coo-coo/data_sources/xournal/document.rb', line 291

def left
  x
end

#rightObject



299
300
301
# File 'lib/coo-coo/data_sources/xournal/document.rb', line 299

def right
  x + width
end

#topObject



295
296
297
# File 'lib/coo-coo/data_sources/xournal/document.rb', line 295

def top
  y
end

#widthObject



303
304
305
306
# File 'lib/coo-coo/data_sources/xournal/document.rb', line 303

def width
  # TODO but how?
  @text.length * @size
end