Class: HexaPDF::Content::SmartTextExtractor::TextRunCollector::TextRun
- Inherits:
-
Struct
- Object
- Struct
- HexaPDF::Content::SmartTextExtractor::TextRunCollector::TextRun
- Defined in:
- lib/hexapdf/content/smart_text_extractor.rb
Overview
Represents a single run of continuous glyphs and their combined bounding box in user space.
Instance Attribute Summary collapse
-
#bottom ⇒ Object
Returns the value of attribute bottom.
-
#left ⇒ Object
Returns the value of attribute left.
-
#right ⇒ Object
Returns the value of attribute right.
-
#string ⇒ Object
Returns the value of attribute string.
-
#top ⇒ Object
Returns the value of attribute top.
Instance Method Summary collapse
-
#baseline ⇒ Object
The “baseline” is approximated with the bottom of the bounding box.
-
#height ⇒ Object
The height of the text run’s bounding box.
-
#width ⇒ Object
The width of the text run’s bounding box.
Instance Attribute Details
#bottom ⇒ Object
Returns the value of attribute bottom
82 83 84 |
# File 'lib/hexapdf/content/smart_text_extractor.rb', line 82 def bottom @bottom end |
#left ⇒ Object
Returns the value of attribute left
82 83 84 |
# File 'lib/hexapdf/content/smart_text_extractor.rb', line 82 def left @left end |
#right ⇒ Object
Returns the value of attribute right
82 83 84 |
# File 'lib/hexapdf/content/smart_text_extractor.rb', line 82 def right @right end |
#string ⇒ Object
Returns the value of attribute string
82 83 84 |
# File 'lib/hexapdf/content/smart_text_extractor.rb', line 82 def string @string end |
#top ⇒ Object
Returns the value of attribute top
82 83 84 |
# File 'lib/hexapdf/content/smart_text_extractor.rb', line 82 def top @top end |
Instance Method Details
#baseline ⇒ Object
The “baseline” is approximated with the bottom of the bounding box.
This works because HexaPDF uses a font’s bounding box instead of the glyph’s bounding box for each glyph. So while differently sized glyphs will have different “baseline” values, this is taken into account in the algorithm in the same way as subscript and superscript.
Using this “fake” baseline works well enough and avoids additional calculations.
91 |
# File 'lib/hexapdf/content/smart_text_extractor.rb', line 91 def baseline = bottom |
#height ⇒ Object
The height of the text run’s bounding box.
94 |
# File 'lib/hexapdf/content/smart_text_extractor.rb', line 94 def height = top - bottom |
#width ⇒ Object
The width of the text run’s bounding box.
97 |
# File 'lib/hexapdf/content/smart_text_extractor.rb', line 97 def width = right - left |