Parent

PDF::Reader::WidthCalculator::TrueType

Calculates the width of a glyph in a TrueType font

Public Class Methods

new(font) click to toggle source
# File lib/pdf/reader/width_calculator/true_type.rb, line 7
def initialize(font)
  @font = font

  if @font.font_descriptor
    @missing_width = @font.font_descriptor.missing_width
  else
    @missing_width = 0
  end
end

Public Instance Methods

glyph_width(code_point) click to toggle source
# File lib/pdf/reader/width_calculator/true_type.rb, line 17
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)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.