Class: FontProcessor::FontFormat

Inherits:
Object
  • Object
show all
Defined in:
lib/fontprocessor/font_format.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(outline_format, container_format) ⇒ FontFormat

outline_format - The symbol representing the outline_format. container_format - The symbol representing the container_format.



11
12
13
14
# File 'lib/fontprocessor/font_format.rb', line 11

def initialize(outline_format, container_format)
  @outline_format = outline_format
  @container_format = container_format
end

Instance Attribute Details

#container_formatObject

Public: The container format of the file. One of :dyna_base, :otf, :inst, :woff, :woff2, :svg or :swf



7
8
9
# File 'lib/fontprocessor/font_format.rb', line 7

def container_format
  @container_format
end

#outline_formatObject

Public: The outline format of the file. One of :ttf, :cff



4
5
6
# File 'lib/fontprocessor/font_format.rb', line 4

def outline_format
  @outline_format
end

Instance Method Details

#extensionObject

Public: Used to generate the fontforge compatible file extension. Unfortunately fontforge uses the file extension to determine what sort of outlines should be contained within a file.

They have chosen to represent TrueType files as .ttf and PostScript files as .otf

Returns the symbol matching the proper file extension for this format

based on the .outline_format.


25
26
27
# File 'lib/fontprocessor/font_format.rb', line 25

def extension
  { :ttf => :ttf, :cff => :otf }[outline_format]
end