class PDF::Reader::WidthCalculator::Composite
see Section 9.7.4.1, PDF 32000-1:2008, pp 269-270
so that it can be used.
is supposed to convert the widths for the codepoints used into the W array
program which could be used to calculate width, however, a conforming writer
codepoint widths, note that CIDFontType2 will contain a true type font
CIDFontType0 or CIDFontType2 use DW (integer) and W (array) to determine
def glyph_width(code_point)
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
def initialize(font)
def initialize(font) @font = font @widths = PDF::Reader::CidWidths.new(@font.cid_default_width, @font.cid_widths) end