Module: Fontisan::Ufo::Convert::FromBinData

Defined in:
lib/fontisan/ufo/convert/from_bin_data.rb

Overview

Converts a loaded TTF/OTF font (from Fontisan::FontLoader.load) into a typed Fontisan::Ufo::Font. This is the reverse of Compile::TtfCompiler / Compile::OtfCompiler.

Reads each BinData table, extracts per-glyph data, and builds Ufo::Glyph objects in the default layer.

Composite glyphs are preserved as UFO Components (not decomposed). This keeps the round-trip faithful to the source.

Class Method Summary collapse

Class Method Details

.convert(font) ⇒ Fontisan::Ufo::Font

Returns typed UFO model.

Parameters:

Returns:



18
19
20
21
22
23
24
25
# File 'lib/fontisan/ufo/convert/from_bin_data.rb', line 18

def self.convert(font)
  ufo = Ufo::Font.new
  ufo.ufo_version = 3

  extract_info(font, ufo)
  extract_glyphs(font, ufo)
  ufo
end