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

Inherits:
HexaPDF::Font::TrueType::Table 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: developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6loca.html

Constant Summary

Constants inherited from HexaPDF::Font::TrueType::Table

TIME_EPOCH

Instance Attribute Summary collapse

Attributes inherited from HexaPDF::Font::TrueType::Table

#font

Instance Method Summary collapse

Methods inherited from HexaPDF::Font::TrueType::Table

calculate_checksum, #checksum_valid?, #directory_entry, #initialize

Constructor Details

This class inherits a constructor from HexaPDF::Font::TrueType::Table

Instance Attribute Details

#offsetsObject

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



49
50
51
# File 'lib/hexapdf/font/true_type/table/loca.rb', line 49

def offsets
  @offsets
end

Instance Method Details

#length(glyph_id) ⇒ Object

Returns the length of the ‘glyf’ entry for the given glyph ID.



58
59
60
# File 'lib/hexapdf/font/true_type/table/loca.rb', line 58

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.



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

def offset(glyph_id)
  @offsets[glyph_id]
end