Class: Fontisan::Ufo::Compile::BaseCompiler
- Inherits:
-
Object
- Object
- Fontisan::Ufo::Compile::BaseCompiler
- Defined in:
- lib/fontisan/ufo/compile/base_compiler.rb
Overview
Common orchestrator for TTF and OTF compilers.
Subclasses implement #build_outline_tables (returning the
format-specific table set: glyf+loca for TTF, CFF for OTF)
and sfnt_version (0x00010000 for TTF, 0x4F54544F for OTF).
Direct Known Subclasses
Constant Summary collapse
- SFNT_VERSION_TRUE_TYPE =
0x00010000- SFNT_VERSION_OPEN_TYPE =
"OTTO"
0x4F54544F
Instance Attribute Summary collapse
-
#font ⇒ Object
readonly
Returns the value of attribute font.
Instance Method Summary collapse
-
#build_outline_tables ⇒ Hash<String, #to_binary_s, String>
Format-specific extra tables.
-
#compile(output_path:) ⇒ String
The path.
-
#initialize(font) ⇒ BaseCompiler
constructor
A new instance of BaseCompiler.
-
#sfnt_version ⇒ Integer
0x00010000 (TTF) or 0x4F54544F (OTF).
Constructor Details
#initialize(font) ⇒ BaseCompiler
Returns a new instance of BaseCompiler.
18 19 20 |
# File 'lib/fontisan/ufo/compile/base_compiler.rb', line 18 def initialize(font) @font = font end |
Instance Attribute Details
#font ⇒ Object (readonly)
Returns the value of attribute font.
16 17 18 |
# File 'lib/fontisan/ufo/compile/base_compiler.rb', line 16 def font @font end |
Instance Method Details
#build_outline_tables ⇒ Hash<String, #to_binary_s, String>
Format-specific extra tables. Override in subclasses.
34 35 36 |
# File 'lib/fontisan/ufo/compile/base_compiler.rb', line 34 def build_outline_tables {} end |
#compile(output_path:) ⇒ String
Returns the path.
24 25 26 27 28 29 30 |
# File 'lib/fontisan/ufo/compile/base_compiler.rb', line 24 def compile(output_path:) tables = build_tables bitmap = build_bitmap_tables(glyphs_with_notdef) tables.merge!(bitmap) if bitmap write(tables, output_path) output_path end |
#sfnt_version ⇒ Integer
Returns 0x00010000 (TTF) or 0x4F54544F (OTF).
39 40 41 |
# File 'lib/fontisan/ufo/compile/base_compiler.rb', line 39 def sfnt_version self.class::SFNT_VERSION end |