Class: PDF::Reader::WidthCalculator::TrueType
- Inherits:
-
Object
- Object
- PDF::Reader::WidthCalculator::TrueType
- Defined in:
- lib/pdf/reader/width_calculator/true_type.rb
Overview
Calculates the width of a glyph in a TrueType font
Instance Method Summary collapse
-
#glyph_width(code_point) ⇒ Object
: (Integer?) -> Numeric.
-
#initialize(font) ⇒ TrueType
constructor
: (PDF::Reader::Font) -> void.
Constructor Details
#initialize(font) ⇒ TrueType
: (PDF::Reader::Font) -> void
11 12 13 14 15 16 17 18 19 |
# File 'lib/pdf/reader/width_calculator/true_type.rb', line 11 def initialize(font) @font = font if fd = @font.font_descriptor @missing_width = fd.missing_width #: Numeric else @missing_width = 0 end end |
Instance Method Details
#glyph_width(code_point) ⇒ Object
: (Integer?) -> Numeric
22 23 24 25 |
# File 'lib/pdf/reader/width_calculator/true_type.rb', line 22 def glyph_width(code_point) return 0 if code_point.nil? || code_point < 0 glyph_width_from_font(code_point) || glyph_width_from_descriptor(code_point) || 0 end |