Method: HexaPDF::Font::TrueTypeWrapper#glyph

Defined in:
lib/hexapdf/font/true_type_wrapper.rb

#glyph(id, str = nil) ⇒ Object

Returns a Glyph object for the given glyph ID and str pair.

The optional argument str should be the string representation of the glyph. It is possible that multiple strings map to the same glyph (e.g. hyphen and soft-hyphen could be represented by the same glyph).

Note: Although this method is public, it should normally not be used by application code!



194
195
196
197
198
199
200
201
# File 'lib/hexapdf/font/true_type_wrapper.rb', line 194

def glyph(id, str = nil)
  @id_to_glyph[[id, str]] ||=
    if id >= 0 && id < @wrapped_font[:maxp].num_glyphs
      Glyph.new(self, id, str || (+'' << (@cmap.gid_to_code(id) || 0xFFFD)))
    else
      @pdf_object.document.config['font.on_missing_glyph'].call("\u{FFFD}", self)
    end
end