Module: Fontisan::Ufo::Convert::ToTtc
- Defined in:
- lib/fontisan/ufo/convert/to_ttc.rb
Overview
UFO → TrueType Collection (.ttc). Two-step:
1. Compile UFO → TTF in tmpdir.
2. Load + feed to Collection::Builder with format: :ttc.
A single UFO produces a single-face collection. Multi-face collections from multiple UFOs are a separate concern (the Stitcher pipeline handles that case).
Class Method Summary collapse
-
.convert(ufo, output_path:, **_opts) ⇒ String
The output_path.
Class Method Details
.convert(ufo, output_path:, **_opts) ⇒ String
Returns the output_path.
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/fontisan/ufo/convert/to_ttc.rb', line 20 def self.convert(ufo, output_path:, **_opts) Dir.mktmpdir do |dir| intermediate_path = File.join(dir, "intermediate.ttf") Compile::TtfCompiler.new(ufo).compile(output_path: intermediate_path) loaded = Fontisan::FontLoader.load(intermediate_path) Fontisan::Collection::Builder.new([loaded], format: :ttc, optimize: true).build_to_file(output_path) end output_path end |