Module: Fontisan::Ufo::Convert::ToOtc
- Defined in:
- lib/fontisan/ufo/convert/to_otc.rb
Overview
UFO → OpenType Collection (.otc). Two-step:
1. Compile UFO → OTF (CFF) in tmpdir.
2. Load + feed to Collection::Builder with format: :otc.
A single UFO produces a single-face collection.
Class Method Summary collapse
-
.convert(ufo, output_path:, compiler: :otf, **_opts) ⇒ String
The output_path.
Class Method Details
.convert(ufo, output_path:, compiler: :otf, **_opts) ⇒ String
Returns the output_path.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/fontisan/ufo/convert/to_otc.rb', line 19 def self.convert(ufo, output_path:, compiler: :otf, **_opts) compiler_class = Convert::COMPILER_FOR_FORMAT[compiler.to_sym] raise ArgumentError, "unknown intermediate compiler: #{compiler.inspect}" unless compiler_class Dir.mktmpdir do |dir| intermediate_path = File.join(dir, "intermediate.otf") compiler_class.new(ufo).compile(output_path: intermediate_path) loaded = Fontisan::FontLoader.load(intermediate_path) Fontisan::Collection::Builder.new([loaded], format: :otc, optimize: true).build_to_file(output_path) end output_path end |