23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/dragonfly_fonts/plugin.rb', line 23
def call(app, options = {})
app.add_analyser :bbox, Analysers::Bbox.new
app.add_analyser :font_info, Analysers::FontInfo.new
app.add_analyser :glyphs, Analysers::Glyphs.new
app.add_analyser :gsub_tables, Analysers::GsubTables.new
app.add_analyser :ots_sanitize, Analysers::OtsSanitize.new
app.add_processor :correct_metrics, Processors::CorrectMetrics.new
app.add_processor :extract_glyph, Processors::ExtractGlyph.new
app.add_processor :fix_dflt_table, Processors::FixDfltTable.new
app.add_processor :normalize_names, Processors::NormalizeNames.new
app.add_processor :ots_sanitize!, Processors::OtsSanitize.new
app.add_processor :set_dimensions, Processors::SetDimensions.new
app.add_processor :set_ttf_names, Processors::SetTtfNames.new
app.add_processor :set_underline, Processors::SetUnderline.new
app.add_processor :set_width, Processors::SetWidth.new
app.add_processor :set_woff_metadata, Processors::SetWoffMetadata.new
app.add_processor :ttf_autohint, Processors::TtfAutohint.new
app.add_processor :web_friendly, Processors::WebFriendly.new
app.add_processor :encode do |content, format, options = {}|
case content.ext
when 'ttx'
Processors::Encode.new.call(content, 'otf', options) unless %w[font/ttf font/otf].include?(content.mime_type)
when 'woff2'
Processors::Encode.new.call(content, 'ttf', options)
end
case format
when 'eot'
Processors::Encode.new.call(content, 'ttf', options) unless %w[font/ttf].include?(content.mime_type)
when 'woff2'
Processors::Encode.new.call(content, 'otf', options) unless %w[font/ttf font/otf].include?(content.mime_type)
end
Processors::Encode.new.call(content, format, options)
end
app.add_mime_type 'ttf', 'font/ttf'
app.add_mime_type 'otf', 'font/otf'
app.add_mime_type 'woff', 'font/woff'
app.add_mime_type 'woff2', 'font/woff2'
app.add_mime_type 'ttx', 'font/ttx'
end
|