Class: TTFunk::Directory
- Inherits:
-
Object
- Object
- TTFunk::Directory
- Defined in:
- lib/ttfunk/directory.rb
Overview
SFNT table directory.
Instance Attribute Summary collapse
-
#scaler_type ⇒ Integer
readonly
Scaler type.
-
#tables ⇒ Hash{String => Hash}
readonly
Table descriptors.
Instance Method Summary collapse
-
#initialize(io, offset = 0) ⇒ Directory
constructor
A new instance of Directory.
Constructor Details
#initialize(io, offset = 0) ⇒ Directory
Returns a new instance of Directory.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ttfunk/directory.rb', line 14 def initialize(io, offset = 0) io.seek(offset) # https://www.microsoft.com/typography/otspec/otff.htm#offsetTable # We're ignoring searchRange, entrySelector, and rangeShift here, but # skipping past them to get to the table information. @scaler_type, table_count = io.read(12).unpack('Nn') @tables = {} table_count.times do tag, checksum, offset, length = io.read(16).unpack('a4N*') @tables[tag] = { tag: tag, checksum: checksum, offset: offset, length: length, } end end |
Instance Attribute Details
#scaler_type ⇒ Integer (readonly)
Scaler type
12 13 14 |
# File 'lib/ttfunk/directory.rb', line 12 def scaler_type @scaler_type end |
#tables ⇒ Hash{String => Hash} (readonly)
Table descriptors
8 9 10 |
# File 'lib/ttfunk/directory.rb', line 8 def tables @tables end |