Class: PDF::Reader::WidthCalculator::Composite
- Inherits:
-
Object
- Object
- PDF::Reader::WidthCalculator::Composite
- Defined in:
- lib/pdf/reader/width_calculator/composite.rb
Overview
CIDFontType0 or CIDFontType2 use DW (integer) and W (array) to determine codepoint widths, note that CIDFontType2 will contain a true type font program which could be used to calculate width, however, a conforming writer is supposed to convert the widths for the codepoints used into the W array so that it can be used. see Section 9.7.4.1, PDF 32000-1:2008, pp 269-270
Instance Method Summary collapse
- #glyph_width(code_point) ⇒ Object
-
#initialize(font) ⇒ Composite
constructor
A new instance of Composite.
Constructor Details
Instance Method Details
#glyph_width(code_point) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/pdf/reader/width_calculator/composite.rb', line 20 def glyph_width(code_point) return 0 if code_point.nil? || code_point < 0 w = @widths[code_point] # 0 is a valid width if w w.to_f else 0 end end |