Class: Fontisan::Export::Transformers::FontToTtx
- Inherits:
-
Object
- Object
- Fontisan::Export::Transformers::FontToTtx
- Defined in:
- lib/fontisan/export/transformers/font_to_ttx.rb
Overview
FontToTtx orchestrates font to TTX transformation
Main transformer that coordinates conversion of a complete font to TTX format using individual table transformers. Follows model-to-model transformation principles with clean separation of concerns.
Instance Method Summary collapse
-
#initialize(font) ⇒ FontToTtx
constructor
Initialize transformer.
-
#transform(options = {}) ⇒ Models::Ttx::TtFont
Transform font to TTX model.
Constructor Details
#initialize(font) ⇒ FontToTtx
Initialize transformer
16 17 18 |
# File 'lib/fontisan/export/transformers/font_to_ttx.rb', line 16 def initialize(font) @font = font end |
Instance Method Details
#transform(options = {}) ⇒ Models::Ttx::TtFont
Transform font to TTX model
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/fontisan/export/transformers/font_to_ttx.rb', line 25 def transform( = {}) table_list = [:tables] || :all Models::Ttx::TtFont.new.tap do |ttx| ttx.sfnt_version = format_sfnt_version(@font.header.sfnt_version.to_i) ttx.ttlib_version = "4.0" ttx.glyph_order = build_glyph_order # Transform specific tables tables_to_transform = select_tables(table_list) tables_to_transform.each do |tag| transform_table(ttx, tag) end end end |