Class: Fontisan::Woff2TableDirectoryEntry
- Inherits:
-
Object
- Object
- Fontisan::Woff2TableDirectoryEntry
- Defined in:
- lib/fontisan/woff2_font.rb
Overview
WOFF2 Table Directory Entry structure
WOFF2 table directory entries are more complex than WOFF, with transformation flags and variable-length sizes.
Constant Summary collapse
- TRANSFORM_NONE =
Transformation version flags
0- TRANSFORM_GLYF_LOCA =
0- TRANSFORM_LOCA =
1- TRANSFORM_HMTX =
2- KNOWN_TAGS =
Known table tags with assigned indices (0-62)
[ "cmap", "head", "hhea", "hmtx", "maxp", "name", "OS/2", "post", "cvt ", "fpgm", "glyf", "loca", "prep", "CFF ", "VORG", "EBDT", "EBLC", "gasp", "hdmx", "kern", "LTSH", "PCLT", "VDMX", "vhea", "vmtx", "BASE", "GDEF", "GPOS", "GSUB", "EBSC", "JSTF", "MATH", "CBDT", "CBLC", "COLR", "CPAL", "SVG ", "sbix", "acnt", "avar", "bdat", "bloc", "bsln", "cvar", "fdsc", "feat", "fmtx", "fvar", "gvar", "hsty", "just", "lcar", "mort", "morx", "opbd", "prop", "trak", "Zapf", "Silf", "Glat", "Gloc", "Feat", "Sill" ].freeze
Instance Attribute Summary collapse
-
#flags ⇒ Object
Returns the value of attribute flags.
-
#offset ⇒ Object
Returns the value of attribute offset.
-
#orig_length ⇒ Object
Returns the value of attribute orig_length.
-
#tag ⇒ Object
Returns the value of attribute tag.
-
#transform_length ⇒ Object
Returns the value of attribute transform_length.
-
#transform_version ⇒ Object
Get transform version for this table.
Instance Method Summary collapse
-
#initialize ⇒ Woff2TableDirectoryEntry
constructor
A new instance of Woff2TableDirectoryEntry.
-
#transformed? ⇒ Boolean
Check if table is transformed.
Constructor Details
#initialize ⇒ Woff2TableDirectoryEntry
Returns a new instance of Woff2TableDirectoryEntry.
34 35 36 37 38 |
# File 'lib/fontisan/woff2_font.rb', line 34 def initialize @flags = 0 # Don't initialize transform_version - leave it nil # It will be set during parsing if table is transformed end |
Instance Attribute Details
#flags ⇒ Object
Returns the value of attribute flags.
13 14 15 |
# File 'lib/fontisan/woff2_font.rb', line 13 def flags @flags end |
#offset ⇒ Object
Returns the value of attribute offset.
13 14 15 |
# File 'lib/fontisan/woff2_font.rb', line 13 def offset @offset end |
#orig_length ⇒ Object
Returns the value of attribute orig_length.
13 14 15 |
# File 'lib/fontisan/woff2_font.rb', line 13 def orig_length @orig_length end |
#tag ⇒ Object
Returns the value of attribute tag.
13 14 15 |
# File 'lib/fontisan/woff2_font.rb', line 13 def tag @tag end |
#transform_length ⇒ Object
Returns the value of attribute transform_length.
13 14 15 |
# File 'lib/fontisan/woff2_font.rb', line 13 def transform_length @transform_length end |
#transform_version ⇒ Object
Get transform version for this table
46 47 48 |
# File 'lib/fontisan/woff2_font.rb', line 46 def transform_version @transform_version end |
Instance Method Details
#transformed? ⇒ Boolean
Check if table is transformed
41 42 43 |
# File 'lib/fontisan/woff2_font.rb', line 41 def transformed? (@flags & 0x3F) != 0x3F && KNOWN_TAGS[tag_index]&.start_with?(/glyf|loca|hmtx/) end |