Class: Fontisan::Ufo::Compile::Otf2Compiler
- Inherits:
-
BaseCompiler
- Object
- BaseCompiler
- Fontisan::Ufo::Compile::Otf2Compiler
- Defined in:
- lib/fontisan/ufo/compile/otf2_compiler.rb
Overview
UFO → OTF (CFF2). Uses CFF2 outlines instead of CFF1.
CFF2 uses the same OTTO sfnt signature as CFF1. The difference
is the table tag: CFF2 (vs CFF for CFF1). CFF2 enables
variable font support and improved subroutinization.
Note: CFF2 does NOT bypass the 65,535 glyph cap. The maxp table's numGlyphs is uint16 in all OpenType versions, and the CFF2 CharStrings INDEX count must match it. For > 65,535 glyphs, use TTC splitting.
Constant Summary collapse
- SFNT_VERSION =
SFNT_VERSION_OPEN_TYPE
Constants inherited from BaseCompiler
BaseCompiler::SFNT_VERSION_OPEN_TYPE, BaseCompiler::SFNT_VERSION_TRUE_TYPE
Instance Attribute Summary
Attributes inherited from BaseCompiler
Instance Method Summary collapse
Methods inherited from BaseCompiler
#build_outline_tables, #initialize, #sfnt_version
Constructor Details
This class inherits a constructor from Fontisan::Ufo::Compile::BaseCompiler
Instance Method Details
#compile(output_path:) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/fontisan/ufo/compile/otf2_compiler.rb', line 19 def compile(output_path:) glyphs = glyphs_with_notdef tables = { "head" => Head.build(font, glyphs: glyphs, loca_format: Head::LOCA_FORMAT_LONG), "hhea" => Hhea.build(font, glyphs: glyphs), "maxp" => Maxp.build(font, glyphs: glyphs, version: Maxp::VERSION_OPEN_TYPE), "OS/2" => Os2.build(font, glyphs: glyphs), "name" => Name.build(font), "post" => Post.build(font), "hmtx" => Hmtx.build(font, glyphs: glyphs), "cmap" => Cmap.build(font, glyphs: glyphs), "CFF2" => Cff2.build(font, glyphs: glyphs), } write(tables, output_path) output_path end |