class TTFunk::OTFEncoder
Encodes a CFF-based OpenType font subset to its binary representation.
Constants
- OPTIMAL_TABLE_ORDER
Optimal table order according to OpenType specification.
Private Instance Methods
base_table()
click to toggle source
# File lib/ttfunk/otf_encoder.rb, line 25 def base_table @base_table ||= TTFunk::Table::Simple.new(original, 'BASE').raw end
cff_table()
click to toggle source
# File lib/ttfunk/otf_encoder.rb, line 29 def cff_table @cff_table ||= original.cff.encode(subset) end
glyf_table()
click to toggle source
CFF fonts don’t maintain a glyf table, all glyph information is stored in the charstrings index. Return an empty hash here to indicate a glyf table should not be encoded.
# File lib/ttfunk/otf_encoder.rb, line 14 def glyf_table @glyf_table ||= {} end
loca_table()
click to toggle source
Since CFF fonts don’t maintain a glyf table, they also don’t maintain a loca table. Return an empty hash here to indicate a loca table shouldn’t be encoded.
# File lib/ttfunk/otf_encoder.rb, line 21 def loca_table @loca_table ||= {} end
optimal_table_order()
click to toggle source
# File lib/ttfunk/otf_encoder.rb, line 45 def optimal_table_order # DSIG is always last OPTIMAL_TABLE_ORDER + (tables.keys - ['DSIG'] - OPTIMAL_TABLE_ORDER) + ['DSIG'] end
tables()
click to toggle source
Calls superclass method
# File lib/ttfunk/otf_encoder.rb, line 37 def tables @tables ||= super.merge( 'BASE' => base_table, 'VORG' => vorg_table, 'CFF ' => cff_table, ).compact end
vorg_table()
click to toggle source
# File lib/ttfunk/otf_encoder.rb, line 33 def vorg_table @vorg_table ||= TTFunk::Table::Vorg.encode(original.vertical_origins) end