Class: IiifPrint::TextExtraction::RenderAlto
- Inherits:
-
Object
- Object
- IiifPrint::TextExtraction::RenderAlto
- Defined in:
- lib/iiif_print/text_extraction/render_alto.rb
Instance Method Summary collapse
-
#initialize(width, height, scaling = 1.0) ⇒ RenderAlto
constructor
A new instance of RenderAlto.
- #to_alto(words) ⇒ Object
Constructor Details
#initialize(width, height, scaling = 1.0) ⇒ RenderAlto
7 8 9 10 11 |
# File 'lib/iiif_print/text_extraction/render_alto.rb', line 7 def initialize(width, height, scaling = 1.0) @height = height @width = width @scaling = scaling end |
Instance Method Details
#to_alto(words) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/iiif_print/text_extraction/render_alto.rb', line 13 def to_alto(words) page = alto_page(@width, @height) do |xml| words.each do |word| xml.String( CONTENT: word[:word], WIDTH: scale_point(word[:coordinates][2]).to_s, HEIGHT: scale_point(word[:coordinates][3]).to_s, HPOS: scale_point(word[:coordinates][0]).to_s, VPOS: scale_point(word[:coordinates][1]).to_s ) { xml.text '' } end end page.to_xml end |