Class: Fontisan::Ufo::Compile::OtfCompiler

Inherits:
BaseCompiler show all
Defined in:
lib/fontisan/ufo/compile/otf_compiler.rb

Overview

UFO → OTF. Uses CFF outlines (instead of TrueType glyf/loca). Maxp version 0.5 (no TrueType metrics); sfnt version OTTO.

TODO.full/10: this currently emits a placeholder CFF table that satisfies the OTTO signature but does NOT yet encode real charstrings. Full CFF construction lands when TODO 10 ships.

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

#font

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



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/fontisan/ufo/compile/otf_compiler.rb', line 16

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),
    "CFF " => Cff.build(font, glyphs: glyphs),
  }

  write(tables, output_path)
  output_path
end