Class: TTFunk::Table::Vorg
- Inherits:
-
TTFunk::Table
- Object
- TTFunk::Table
- TTFunk::Table::Vorg
- Defined in:
- lib/ttfunk/table/vorg.rb
Overview
Vertical Origin (VORG
) table.
Constant Summary collapse
- TAG =
Table tag.
'VORG'
Instance Attribute Summary collapse
-
#count ⇒ Integer
readonly
Number of vertical origin metrics.
-
#default_vert_origin_y ⇒ Integer
readonly
The default y coordinate of a glyph’s vertical origin.
-
#major_version ⇒ Integer
readonly
Table major version.
-
#minor_version ⇒ Integer
readonly
Table minor version.
Attributes inherited from TTFunk::Table
Class Method Summary collapse
-
.encode(vorg) ⇒ String
Encode table.
Instance Method Summary collapse
-
#for(glyph_id) ⇒ Integer
Get vertical origina for glyph by ID.
-
#origins ⇒ Hash{Integer => Integer}
Origins map.
-
#tag ⇒ String
Table tag.
Methods inherited from TTFunk::Table
Constructor Details
This class inherits a constructor from TTFunk::Table
Instance Attribute Details
#count ⇒ Integer (readonly)
Number of vertical origin metrics.
Source Code
lib/ttfunk/table/vorg.rb, line 26
26 | def count |
27 | @count
|
28 | end
|
#default_vert_origin_y ⇒ Integer (readonly)
The default y coordinate of a glyph’s vertical origin.
Source Code
lib/ttfunk/table/vorg.rb, line 22
22 | def default_vert_origin_y |
23 | @default_vert_origin_y
|
24 | end
|
#major_version ⇒ Integer (readonly)
Table major version.
Source Code
lib/ttfunk/table/vorg.rb, line 14
14 | def major_version |
15 | @major_version
|
16 | end
|
#minor_version ⇒ Integer (readonly)
Table minor version.
Source Code
lib/ttfunk/table/vorg.rb, line 18
18 | def minor_version |
19 | @minor_version
|
20 | end
|
Class Method Details
.encode(vorg) ⇒ String
Encode table.
Source Code
lib/ttfunk/table/vorg.rb, line 31
31 | def self.encode(vorg) |
32 | return unless vorg |
33 | |
34 | ''.b.tap do |table| |
35 | table << [ |
36 | vorg.major_version, vorg.minor_version, |
37 | vorg.default_vert_origin_y, vorg.count, |
38 | ].pack('n*') |
39 | |
40 | vorg.origins.each_pair do |glyph_id, vert_origin_y| |
41 | table << [glyph_id, vert_origin_y].pack('n*') |
42 | end
|
43 | end
|
44 | end
|
Instance Method Details
#for(glyph_id) ⇒ Integer
Get vertical origina for glyph by ID.
Source Code
lib/ttfunk/table/vorg.rb, line 50
50 | def for(glyph_id) |
51 | @origins.fetch(glyph_id, default_vert_origin_y) |
52 | end
|
#origins ⇒ Hash{Integer => Integer}
Origins map.
Source Code
lib/ttfunk/table/vorg.rb, line 64
64 | def origins |
65 | @origins ||= {} |
66 | end
|
#tag ⇒ String
Table tag.
Source Code
lib/ttfunk/table/vorg.rb, line 57
57 | def tag |
58 | TAG
|
59 | end
|