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.
26 27 28 |
# File 'lib/ttfunk/table/vorg.rb', line 26 def count @count end |
#default_vert_origin_y ⇒ Integer (readonly)
The default y coordinate of a glyph’s vertical origin.
22 23 24 |
# File 'lib/ttfunk/table/vorg.rb', line 22 def default_vert_origin_y @default_vert_origin_y end |
#major_version ⇒ Integer (readonly)
Table major version.
14 15 16 |
# File 'lib/ttfunk/table/vorg.rb', line 14 def major_version @major_version end |
#minor_version ⇒ Integer (readonly)
Table minor version.
18 19 20 |
# File 'lib/ttfunk/table/vorg.rb', line 18 def minor_version @minor_version end |
Class Method Details
.encode(vorg) ⇒ String
Encode table.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/ttfunk/table/vorg.rb', line 31 def self.encode(vorg) return unless vorg ''.b.tap do |table| table << [ vorg.major_version, vorg.minor_version, vorg.default_vert_origin_y, vorg.count, ].pack('n*') vorg.origins.each_pair do |glyph_id, vert_origin_y| table << [glyph_id, vert_origin_y].pack('n*') end end end |
Instance Method Details
#for(glyph_id) ⇒ Integer
Get vertical origina for glyph by ID.
50 51 52 |
# File 'lib/ttfunk/table/vorg.rb', line 50 def for(glyph_id) @origins.fetch(glyph_id, default_vert_origin_y) end |
#origins ⇒ Hash{Integer => Integer}
Origins map.
64 65 66 |
# File 'lib/ttfunk/table/vorg.rb', line 64 def origins @origins ||= {} end |