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.
Source Code
lib/ttfunk/directory.rb, line 14
14 | def initialize(io, offset = 0) |
15 | io.seek(offset) |
16 | |
17 | # https://www.microsoft.com/typography/otspec/otff.htm#offsetTable
|
18 | # We're ignoring searchRange, entrySelector, and rangeShift here, but
|
19 | # skipping past them to get to the table information.
|
20 | @scaler_type, table_count = io.read(12).unpack('Nn') |
21 | |
22 | @tables = {} |
23 | table_count.times do |
24 | tag, checksum, offset, length = io.read(16).unpack('a4N*') |
25 | @tables[tag] = { |
26 | tag: tag, |
27 | checksum: checksum, |
28 | offset: offset, |
29 | length: length, |
30 | }
|
31 | end
|
32 | end
|
Instance Attribute Details
#scaler_type ⇒ Integer (readonly)
Scaler type
Source Code
lib/ttfunk/directory.rb, line 12
12 | def scaler_type |
13 | @scaler_type
|
14 | end
|
#tables ⇒ Hash{String => Hash} (readonly)
Table descriptors
Source Code
lib/ttfunk/directory.rb, line 8
8 | def tables |
9 | @tables
|
10 | end
|