Class: HexaPDF::Font::TrueType::Table::Loca

Inherits:
Table
  • Object
show all
Defined in:
lib/hexapdf/font/true_type/table/loca.rb

Overview

The 'loca' (location) table contains the offsets of the glyphs relative to the start of the 'glyf' table.

See: https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6loca.html

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#offsetsObject

The array containing the byte offsets for each glyph relative to the start of the 'glyf' table.



52
53
54
# File 'lib/hexapdf/font/true_type/table/loca.rb', line 52

def offsets
  @offsets
end

Instance Method Details

#length(glyph_id) ⇒ Object

Returns the length of the 'glyf' entry for the given glyph ID.



61
62
63
# File 'lib/hexapdf/font/true_type/table/loca.rb', line 61

def length(glyph_id)
  @offsets[glyph_id + 1] - @offsets[glyph_id]
end

#offset(glyph_id) ⇒ Object

Returns the byte offset for the given glyph ID relative to the start of the 'glyf' table.



56
57
58
# File 'lib/hexapdf/font/true_type/table/loca.rb', line 56

def offset(glyph_id)
  @offsets[glyph_id]
end