Class: PDF::Reader::WidthCalculator::TrueType

### Home Classes Methods

### In Files

- lib/pdf/reader/width_calculator/true_type.rb

### Parent

Object

### Methods

- ::new
- #glyph_width

### Files

- MIT-LICENSE
- README.rdoc
- TODO
- mac_expert.txt
- mac_roman.txt
- pdf_doc.txt
- standard.txt
- symbol.txt
- win_ansi.txt
- zapf_dingbats.txt
- glyphlist.txt

### Class/Module Index

Quicksearch

- PDF
- PDF::Reader
- PDF::Reader::Buffer
- PDF::Reader::CidWidths
- PDF::Reader::EncryptedPDFError
- PDF::Reader::Filter
- PDF::Reader::Filter::Ascii85
- PDF::Reader::Filter::AsciiHex
- PDF::Reader::Filter::Depredict
- PDF::Reader::Filter::Flate
- PDF::Reader::Filter::Lzw
- PDF::Reader::Filter::Null
- PDF::Reader::Filter::RunLength
- PDF::Reader::Font
- PDF::Reader::FontDescriptor
- PDF::Reader::FormXObject
- PDF::Reader::InvalidObjectError
- PDF::Reader::MalformedPDFError
- PDF::Reader::ObjectCache
- PDF::Reader::ObjectHash
- PDF::Reader::PageLayout
- PDF::Reader::PageState
- PDF::Reader::PageTextReceiver
- PDF::Reader::Parser
- PDF::Reader::PrintReceiver
- PDF::Reader::Reference
- PDF::Reader::RegisterReceiver
- PDF::Reader::ResourceMethods
- PDF::Reader::StandardSecurityHandler
- PDF::Reader::Stream
- PDF::Reader::SynchronizedCache
- PDF::Reader::TextReceiver
- PDF::Reader::TextRun
- PDF::Reader::TransformationMatrix
- PDF::Reader::UnsupportedFeatureError
- PDF::Reader::WidthCalculator
- PDF::Reader::WidthCalculator::BuiltIn
- PDF::Reader::WidthCalculator::Composite
- PDF::Reader::WidthCalculator::TrueType
- PDF::Reader::WidthCalculator::TypeOneOrThree
- PDF::Reader::WidthCalculator::TypeZero
- PDF::Reader::XRef
- AFM
- AFM::Font

No matching classes.

# 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.