Method: PDF::Reader::WidthCalculator::TypeOneOrThree#glyph_width
- Defined in:
- lib/pdf/reader/width_calculator/type_one_or_three.rb
#glyph_width(code_point) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/pdf/reader/width_calculator/type_one_or_three.rb', line 19 def glyph_width(code_point) return 0 if code_point.nil? || code_point < 0 return 0 if @font.widths.nil? || @font.widths.count == 0 # in ruby a negative index is valid, and will go from the end of the array # which is undesireable in this case. if @font.first_char <= code_point @font.widths.fetch(code_point - @font.first_char, @missing_width).to_f else @missing_width.to_f end end |