Class: Fontisan::Ufo::Compile::VariableTtf
- Inherits:
-
Object
- Object
- Fontisan::Ufo::Compile::VariableTtf
- Defined in:
- lib/fontisan/ufo/compile/variable_ttf.rb
Overview
Orchestrates compilation of a UFO source plus its variation masters into a single variable TrueType font.
Pipeline:
default UFO font
│
├─ TtfCompiler tables (head, hhea, maxp, OS/2, name,
│ post, hmtx, cmap, glyf, loca)
│
├─ fvar (axes + named instances)
├─ gvar (per-glyph point deltas across masters)
├─ HVAR (advance-width deltas across masters)
├─ MVAR (font-wide metric deltas across masters)
├─ avar (per-axis non-linear maps; defaults to identity)
└─ STAT (style attributes for OS matching)
Masters are supplied as an Array of Hashes, each with:
- :font — the master UFO::Font
- :axes — Hash<String, Float> mapping axis tag → region peak
Constant Summary collapse
- SFNT_VERSION =
BaseCompiler::SFNT_VERSION_TRUE_TYPE
Instance Method Summary collapse
-
#compile(output_path:) ⇒ String
The output path.
-
#initialize(font:, axes:, masters:, instances: nil, stat_axis_values: nil, stat_elided_name_id: nil, default_metrics: nil, master_metrics: nil) ⇒ VariableTtf
constructor
A new instance of VariableTtf.
Constructor Details
#initialize(font:, axes:, masters:, instances: nil, stat_axis_values: nil, stat_elided_name_id: nil, default_metrics: nil, master_metrics: nil) ⇒ VariableTtf
Returns a new instance of VariableTtf.
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/fontisan/ufo/compile/variable_ttf.rb', line 39 def initialize(font:, axes:, masters:, instances: nil, stat_axis_values: nil, stat_elided_name_id: nil, default_metrics: nil, master_metrics: nil) @font = font @axes = axes @masters = masters @instances = instances @stat_axis_values = stat_axis_values @stat_elided_name_id = stat_elided_name_id @default_metrics = default_metrics @master_metrics = master_metrics end |
Instance Method Details
#compile(output_path:) ⇒ String
Returns the output path.
54 55 56 57 58 |
# File 'lib/fontisan/ufo/compile/variable_ttf.rb', line 54 def compile(output_path:) tables = base_tables.merge(variation_tables) write(tables, output_path) output_path end |