Class: Fontisan::Pipeline::OutputWriter
- Inherits:
-
Object
- Object
- Fontisan::Pipeline::OutputWriter
- Defined in:
- lib/fontisan/pipeline/output_writer.rb
Overview
Handles writing font tables to various output formats
This class abstracts the complexity of writing different font formats:
-
SFNT formats (TTF, OTF) via FontWriter
-
WOFF via WoffWriter
-
WOFF2 via Woff2Encoder
Single Responsibility: Coordinate output writing for different formats
Instance Attribute Summary collapse
-
#format ⇒ Symbol
readonly
Target format.
-
#options ⇒ Hash
readonly
Writing options.
-
#output_path ⇒ String
readonly
Output file path.
Instance Method Summary collapse
-
#initialize(output_path, format, options = {}) ⇒ OutputWriter
constructor
Initialize output writer.
-
#write(tables) ⇒ Integer
Write font tables to output file.
Constructor Details
#initialize(output_path, format, options = {}) ⇒ OutputWriter
Initialize output writer
38 39 40 41 42 |
# File 'lib/fontisan/pipeline/output_writer.rb', line 38 def initialize(output_path, format, = {}) @output_path = output_path @format = format @options = end |
Instance Attribute Details
#format ⇒ Symbol (readonly)
Returns Target format.
28 29 30 |
# File 'lib/fontisan/pipeline/output_writer.rb', line 28 def format @format end |
#options ⇒ Hash (readonly)
Returns Writing options.
31 32 33 |
# File 'lib/fontisan/pipeline/output_writer.rb', line 31 def @options end |
#output_path ⇒ String (readonly)
Returns Output file path.
25 26 27 |
# File 'lib/fontisan/pipeline/output_writer.rb', line 25 def output_path @output_path end |
Instance Method Details
#write(tables) ⇒ Integer
Write font tables to output file
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/fontisan/pipeline/output_writer.rb', line 49 def write(tables) case @format when :ttf, :otf write_sfnt(tables) when :woff write_woff(tables) when :woff2 write_woff2(tables) when :svg write_svg(tables) else raise ArgumentError, "Unsupported output format: #{@format}" end end |