Method: PDF::Reader::WidthCalculator::BuiltIn#glyph_width
- Defined in:
- lib/pdf/reader/width_calculator/built_in.rb
#glyph_width(code_point) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/pdf/reader/width_calculator/built_in.rb', line 38 def glyph_width(code_point) return 0 if code_point.nil? || code_point < 0 names = @font.encoding.int_to_name(code_point) metrics = names.map { |name| @metrics.char_metrics[name.to_s] }.compact.first if metrics metrics[:wx] else @font.widths[code_point - 1] || 0 end end |