Class: TTFunk::Table::Head
- Inherits:
-
TTFunk::Table
- Object
- TTFunk::Table
- TTFunk::Table::Head
- Defined in:
- lib/ttfunk/table/head.rb
Overview
Font Header (head
) Table.
Instance Attribute Summary collapse
-
#checksum_adjustment ⇒ Integer
readonly
Checksum adjustment.
-
#created ⇒ Integer
readonly
Font creation time.
-
#flags ⇒ Integer
readonly
Flags.
-
#font_direction_hint ⇒ Integer
readonly
Font direction hint.
-
#font_revision ⇒ Integer
readonly
Font revision.
-
#glyph_data_format ⇒ Integer
readonly
Glyph data format.
-
#index_to_loc_format ⇒ Integer
readonly
Index to Location format.
-
#lowest_rec_ppem ⇒ Integer
readonly
Smallest readable size in pixels.
-
#mac_style ⇒ Integer
readonly
Mac font style.
-
#magic_number ⇒ Integer
readonly
Magic number.
-
#modified ⇒ Integer
readonly
Font modification time.
-
#units_per_em ⇒ Integer
readonly
Units per Em.
-
#version ⇒ Integer
readonly
Table version.
-
#x_max ⇒ Integer
readonly
Maximum x coordinate across all glyph bounding boxes.
-
#x_min ⇒ Integer
readonly
Minimum x coordinate across all glyph bounding boxes.
-
#y_max ⇒ Integer
readonly
Maximum y coordinate across all glyph bounding boxes.
-
#y_min ⇒ Integer
readonly
Minimum y coordinate across all glyph bounding boxes.
Attributes inherited from TTFunk::Table
Class Method Summary collapse
-
.encode(head, loca, mapping) ⇒ EncodedString
Encode table.
-
.from_long_date_time(ldt) ⇒ Time
Convert Long Date Time timestamp to Time.
-
.to_long_date_time(time) ⇒ Integer
Convert Time to Long Date Time timestamp.
Methods inherited from TTFunk::Table
#exists?, #initialize, #raw, #tag
Constructor Details
This class inherits a constructor from TTFunk::Table
Instance Attribute Details
#checksum_adjustment ⇒ Integer (readonly)
Checksum adjustment.
Source Code
19 | def checksum_adjustment |
20 | @checksum_adjustment
|
21 | end
|
#created ⇒ Integer (readonly)
Font creation time.
Source Code
35 | def created |
36 | @created
|
37 | end
|
#flags ⇒ Integer (readonly)
Flags.
Source Code
27 | def flags |
28 | @flags
|
29 | end
|
#font_direction_hint ⇒ Integer (readonly)
Font direction hint. Deprecated, set to 2.
Source Code
67 | def font_direction_hint |
68 | @font_direction_hint
|
69 | end
|
#font_revision ⇒ Integer (readonly)
Font revision.
Source Code
15 | def font_revision |
16 | @font_revision
|
17 | end
|
#glyph_data_format ⇒ Integer (readonly)
Glyph data format.
Source Code
75 | def glyph_data_format |
76 | @glyph_data_format
|
77 | end
|
#index_to_loc_format ⇒ Integer (readonly)
Index to Location format.
Source Code
71 | def index_to_loc_format |
72 | @index_to_loc_format
|
73 | end
|
#lowest_rec_ppem ⇒ Integer (readonly)
Smallest readable size in pixels.
Source Code
63 | def lowest_rec_ppem |
64 | @lowest_rec_ppem
|
65 | end
|
#mac_style ⇒ Integer (readonly)
Mac font style.
Source Code
59 | def mac_style |
60 | @mac_style
|
61 | end
|
#magic_number ⇒ Integer (readonly)
Magic number.
Source Code
23 | def magic_number |
24 | @magic_number
|
25 | end
|
#modified ⇒ Integer (readonly)
Font modification time.
Source Code
39 | def modified |
40 | @modified
|
41 | end
|
#units_per_em ⇒ Integer (readonly)
Units per Em.
Source Code
31 | def units_per_em |
32 | @units_per_em
|
33 | end
|
#version ⇒ Integer (readonly)
Table version.
Source Code
11 | def version |
12 | @version
|
13 | end
|
#x_max ⇒ Integer (readonly)
Maximum x coordinate across all glyph bounding boxes.
Source Code
51 | def x_max |
52 | @x_max
|
53 | end
|
#x_min ⇒ Integer (readonly)
Minimum x coordinate across all glyph bounding boxes.
Source Code
43 | def x_min |
44 | @x_min
|
45 | end
|
#y_max ⇒ Integer (readonly)
Maximum y coordinate across all glyph bounding boxes.
Source Code
55 | def y_max |
56 | @y_max
|
57 | end
|
#y_min ⇒ Integer (readonly)
Minimum y coordinate across all glyph bounding boxes.
Source Code
47 | def y_min |
48 | @y_min
|
49 | end
|
Class Method Details
.encode(head, loca, mapping) ⇒ EncodedString
Encode table.
Source Code
92 | def encode(head, loca, mapping) |
93 | EncodedString.new do |table| |
94 | table << |
95 | [head.version, head.font_revision].pack('N2') << |
96 | Placeholder.new(:checksum, length: 4) << |
97 | [
|
98 | head.magic_number, |
99 | head.flags, head.units_per_em, |
100 | head.created, head.modified, |
101 | *min_max_values_for(head, mapping), |
102 | head.mac_style, head.lowest_rec_ppem, head.font_direction_hint, |
103 | loca[:type] || 0, head.glyph_data_format, |
104 | ].pack('Nn2q>2n*') |
105 | end
|
106 | end
|
.from_long_date_time(ldt) ⇒ Time
Convert Long Date Time timestamp to Time.
Source Code
111 | def from_long_date_time(ldt) |
112 | Time.at(ldt + LONG_DATE_TIME_BASIS, in: 'UTC') |
113 | end
|
.to_long_date_time(time) ⇒ Integer
Convert Time to Long Date Time timestamp
Source Code
118 | def to_long_date_time(time) |
119 | Integer(time) - LONG_DATE_TIME_BASIS |
120 | end
|