dragonfly_fonts 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/dragonfly_fonts/analysers/bbox.rb +2 -1
- data/lib/dragonfly_fonts/analysers/font_info.rb +2 -1
- data/lib/dragonfly_fonts/analysers/glyphs.rb +2 -1
- data/lib/dragonfly_fonts/analysers/gsub_tables.rb +2 -1
- data/lib/dragonfly_fonts/analysers/ots_sanitize.rb +2 -1
- data/lib/dragonfly_fonts/processors/correct_metrics.rb +2 -2
- data/lib/dragonfly_fonts/processors/encode.rb +3 -2
- data/lib/dragonfly_fonts/processors/extract_glyph.rb +2 -2
- data/lib/dragonfly_fonts/processors/fix_dflt_table.rb +3 -2
- data/lib/dragonfly_fonts/processors/normalize_names.rb +2 -2
- data/lib/dragonfly_fonts/processors/ots_sanitize.rb +2 -1
- data/lib/dragonfly_fonts/processors/set_dimensions.rb +2 -2
- data/lib/dragonfly_fonts/processors/set_ttf_names.rb +2 -2
- data/lib/dragonfly_fonts/processors/set_underline.rb +2 -2
- data/lib/dragonfly_fonts/processors/set_width.rb +2 -2
- data/lib/dragonfly_fonts/processors/set_woff_metadata.rb +2 -2
- data/lib/dragonfly_fonts/processors/ttf_autohint.rb +2 -2
- data/lib/dragonfly_fonts/processors/web_friendly.rb +2 -2
- data/lib/dragonfly_fonts/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 167ead4c721a024e329f31e536305c41fff765560ab525c0069b8e2c0e32f197
|
4
|
+
data.tar.gz: 6170c9b80e44833ef97485c7ccd05e116fbf2265d5d1eb88eaf0bda054f29809
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c9f14f4814a2f078f4f047ec342e36f6a82f44ffe2aeb7aa4c2b5a912e7d42357dc9794a550a95f6cd282eca02b7e6848c65d104a464f1511c06bc4a4227f2a
|
7
|
+
data.tar.gz: aa0c5403d54555f93221673dd587e6505b1230d3c6d5065a986ca178a3503cbc232bd813f49f446a3fb4b2dfca4add9f55f5fc250a188815aa859d61fc480829
|
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,8 @@ module DragonflyFonts
|
|
4
4
|
module Analysers
|
5
5
|
class Bbox
|
6
6
|
def call(content, glyph)
|
7
|
-
return {} unless
|
7
|
+
return {} unless content.ext
|
8
|
+
return {} unless FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext.downcase)
|
8
9
|
|
9
10
|
res = content.shell_eval do |path|
|
10
11
|
"#{fontforge_command} -lang=ff -c 'Open($1); Select(\"#{glyph}\"); Print(GlyphInfo(\"BBox\"));' #{path}"
|
@@ -5,7 +5,8 @@ module DragonflyFonts
|
|
5
5
|
class FontInfo
|
6
6
|
# see http://dmtr.org/ff.php#Font
|
7
7
|
def call(content)
|
8
|
-
return {} unless
|
8
|
+
return {} unless content.ext
|
9
|
+
return {} unless FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext.downcase)
|
9
10
|
|
10
11
|
details = content.shell_eval do |path|
|
11
12
|
"#{DragonflyFonts::SCRIPT_DIR.join('font_info.py')} #{path}"
|
@@ -4,7 +4,8 @@ module DragonflyFonts
|
|
4
4
|
module Analysers
|
5
5
|
class Glyphs
|
6
6
|
def call(content)
|
7
|
-
return [] unless
|
7
|
+
return [] unless content.ext
|
8
|
+
return [] unless FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext.downcase)
|
8
9
|
|
9
10
|
# details = content.shell_eval do |path|
|
10
11
|
# "#{DragonflyFonts::SCRIPT_DIR.join('glyphs.py')} #{path}"
|
@@ -4,7 +4,8 @@ module DragonflyFonts
|
|
4
4
|
module Analysers
|
5
5
|
class GsubTables
|
6
6
|
def call(content)
|
7
|
-
return [] unless
|
7
|
+
return [] unless content.ext
|
8
|
+
return [] unless FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext.downcase)
|
8
9
|
|
9
10
|
# details = content.shell_eval do |path|
|
10
11
|
# "#{DragonflyFonts::SCRIPT_DIR.join('gsub_tables.py')} #{path}"
|
@@ -4,7 +4,8 @@ module DragonflyFonts
|
|
4
4
|
module Analysers
|
5
5
|
class OtsSanitize
|
6
6
|
def call(content)
|
7
|
-
return unless
|
7
|
+
return unless content.ext
|
8
|
+
return unless OT_SANITISE_SUPPORTED_FORMATS.include?(content.ext.downcase)
|
8
9
|
|
9
10
|
`#{ots_sanitize_command} #{content.path} 2>&1`
|
10
11
|
end
|
@@ -2,8 +2,8 @@ module DragonflyFonts
|
|
2
2
|
module Processors
|
3
3
|
class CorrectMetrics
|
4
4
|
def call(content, options = {})
|
5
|
-
|
6
|
-
raise UnsupportedFormat unless FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext)
|
5
|
+
raise UnsupportedFormat unless content.ext
|
6
|
+
raise UnsupportedFormat unless FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext.downcase)
|
7
7
|
|
8
8
|
content.shell_update(ext: content.ext || 'ttf') do |old_path, new_path|
|
9
9
|
"#{fontforge_command} -lang=ff -c 'Open($1); SetOS2Value(\"HHeadAscent\",$ascent); SetOS2Value(\"HHeadAscentIsOffset\",0); SetOS2Value(\"HHeadDescent\",-$descent); SetOS2Value(\"HHeadDescentIsOffset\",0); SetOS2Value(\"TypoLineGap\",0); Generate($2);' #{old_path} #{new_path}"
|
@@ -4,11 +4,12 @@ module DragonflyFonts
|
|
4
4
|
module Processors
|
5
5
|
class Encode
|
6
6
|
def call(content, format, options = {})
|
7
|
-
raise UnsupportedFormat unless
|
7
|
+
raise UnsupportedFormat unless content.ext
|
8
|
+
raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
|
8
9
|
|
9
10
|
format = format.to_s
|
10
11
|
|
11
|
-
raise UnsupportedOutputFormat unless SUPPORTED_OUTPUT_FORMATS.include?(format)
|
12
|
+
raise UnsupportedOutputFormat unless SUPPORTED_OUTPUT_FORMATS.include?(format.downcase)
|
12
13
|
|
13
14
|
if content.mime_type == Rack::Mime.mime_type(".#{format}")
|
14
15
|
content.ext ||= format
|
@@ -2,8 +2,8 @@ module DragonflyFonts
|
|
2
2
|
module Processors
|
3
3
|
class ExtractGlyph
|
4
4
|
def call(content, glyph, options = {})
|
5
|
-
|
6
|
-
raise UnsupportedFormat unless FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext)
|
5
|
+
raise UnsupportedFormat unless content.ext
|
6
|
+
raise UnsupportedFormat unless FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext.downcase)
|
7
7
|
|
8
8
|
options = options.each_with_object({}) { |(k, v), memo| memo[k.to_s] = v } # stringify keys
|
9
9
|
format = options.fetch('format', 'svg').to_s
|
@@ -4,11 +4,12 @@ module DragonflyFonts
|
|
4
4
|
module Processors
|
5
5
|
class FixDfltTable
|
6
6
|
def call(content, options = {})
|
7
|
-
raise UnsupportedFormat unless
|
7
|
+
raise UnsupportedFormat unless content.ext
|
8
|
+
raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
|
8
9
|
|
9
10
|
doc = Nokogiri::XML(content.data)
|
10
11
|
doc.css('GSUB ScriptTag[value="DFLT"] + Script LangSysRecord').remove
|
11
|
-
|
12
|
+
|
12
13
|
content.update(doc.to_xml)
|
13
14
|
end
|
14
15
|
end
|
@@ -2,8 +2,8 @@ module DragonflyFonts
|
|
2
2
|
module Processors
|
3
3
|
class NormalizeNames
|
4
4
|
def call(content, options = {})
|
5
|
-
|
6
|
-
raise UnsupportedFormat unless FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext)
|
5
|
+
raise UnsupportedFormat unless content.ext
|
6
|
+
raise UnsupportedFormat unless FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext.downcase)
|
7
7
|
|
8
8
|
content.shell_update(ext: content.ext || 'ttf') do |old_path, new_path|
|
9
9
|
"#{fontforge_command} -script #{DragonflyFonts::SCRIPT_DIR.join('normalize_names.sh')} #{old_path} #{new_path}"
|
@@ -4,7 +4,8 @@ module DragonflyFonts
|
|
4
4
|
# The OpenType Sanitiser (OTS) parses and serialises OpenType files (OTF, TTF) and WOFF and WOFF2 font files, validating them and sanitising them as it goes.
|
5
5
|
# TODO: if other then convert first
|
6
6
|
def call(content, options = {})
|
7
|
-
raise UnsupportedFormat unless
|
7
|
+
raise UnsupportedFormat unless content.ext
|
8
|
+
raise UnsupportedFormat unless OT_SANITISE_SUPPORTED_FORMATS.include?(content.ext.downcase)
|
8
9
|
|
9
10
|
content.shell_update(ext: content.ext || 'ttf') do |old_path, new_path|
|
10
11
|
"#{ots_sanitize_command} #{old_path} #{new_path}"
|
@@ -2,8 +2,8 @@ module DragonflyFonts
|
|
2
2
|
module Processors
|
3
3
|
class SetDimensions
|
4
4
|
def call(content, options = {})
|
5
|
-
|
6
|
-
raise UnsupportedFormat unless FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext)
|
5
|
+
raise UnsupportedFormat unless content.ext
|
6
|
+
raise UnsupportedFormat unless FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext.downcase)
|
7
7
|
|
8
8
|
options = options.each_with_object({}) { |(k, v), memo| memo[k.to_s] = v } # stringify keys
|
9
9
|
ascent = options.fetch('ascent', '')
|
@@ -28,8 +28,8 @@ module DragonflyFonts
|
|
28
28
|
}
|
29
29
|
|
30
30
|
def call(content, options = {})
|
31
|
-
|
32
|
-
raise UnsupportedFormat unless FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext)
|
31
|
+
raise UnsupportedFormat unless content.ext
|
32
|
+
raise UnsupportedFormat unless FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext.downcase)
|
33
33
|
|
34
34
|
content.shell_update(ext: content.ext || 'ttf') do |old_path, new_path|
|
35
35
|
"#{fontforge_command} -lang=ff -c 'Open($1); #{command_string(options)} Generate($2);' #{old_path} #{new_path}"
|
@@ -4,8 +4,8 @@ module DragonflyFonts
|
|
4
4
|
module Processors
|
5
5
|
class SetUnderline
|
6
6
|
def call(content, options = {})
|
7
|
-
|
8
|
-
raise UnsupportedFormat unless FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext)
|
7
|
+
raise UnsupportedFormat unless content.ext
|
8
|
+
raise UnsupportedFormat unless FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext.downcase)
|
9
9
|
|
10
10
|
options = options.each_with_object({}) { |(k, v), memo| memo[k.to_s] = v } # stringify keys
|
11
11
|
upos = options.fetch('upos', '')
|
@@ -6,8 +6,8 @@ module DragonflyFonts
|
|
6
6
|
# when 1 then the vertical width will be incremented by the first
|
7
7
|
# when 2 then the vertical width will be scaled by <first argument>/100.0.
|
8
8
|
def call(content, width, relative = 1)
|
9
|
-
|
10
|
-
raise UnsupportedFormat unless FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext)
|
9
|
+
raise UnsupportedFormat unless content.ext
|
10
|
+
raise UnsupportedFormat unless FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext.downcase)
|
11
11
|
|
12
12
|
content.shell_update(ext: content.ext || 'ttf') do |old_path, new_path|
|
13
13
|
"#{fontforge_command} -lang=ff -c 'Open($1); SelectWorthOutputting(); SetWidth(#{width},#{relative}); Generate($2);' #{old_path} #{new_path}"
|
@@ -4,8 +4,8 @@ module DragonflyFonts
|
|
4
4
|
module Processors
|
5
5
|
class SetWoffMetadata
|
6
6
|
def call(content, uniqueid, licensee_name = '')
|
7
|
-
|
8
|
-
raise UnsupportedFormat unless FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext)
|
7
|
+
raise UnsupportedFormat unless content.ext
|
8
|
+
raise UnsupportedFormat unless FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext.downcase)
|
9
9
|
|
10
10
|
content.shell_update(ext: 'woff') do |old_path, new_path|
|
11
11
|
"#{woff_meta_script} #{old_path} #{new_path} #{Shellwords.escape(uniqueid)} #{Shellwords.escape(licensee_name)}"
|
@@ -2,8 +2,8 @@ module DragonflyFonts
|
|
2
2
|
module Processors
|
3
3
|
class TtfAutohint
|
4
4
|
def call(content)
|
5
|
-
|
6
|
-
raise UnsupportedFormat unless TTF_AUTOHINT_SUPPORTED_FORMATS.include?(content.ext)
|
5
|
+
raise UnsupportedFormat unless content.ext
|
6
|
+
raise UnsupportedFormat unless TTF_AUTOHINT_SUPPORTED_FORMATS.include?(content.ext.downcase)
|
7
7
|
|
8
8
|
content.shell_update(ext: content.ext || 'ttf') do |old_path, new_path|
|
9
9
|
"#{ttfautohint_command} --strong-stem-width='' --windows-compatibility --composites #{old_path} #{new_path}"
|
@@ -2,8 +2,8 @@ module DragonflyFonts
|
|
2
2
|
module Processors
|
3
3
|
class WebFriendly
|
4
4
|
def call(content, opts = {})
|
5
|
-
|
6
|
-
raise UnsupportedFormat unless FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext)
|
5
|
+
raise UnsupportedFormat unless content.ext
|
6
|
+
raise UnsupportedFormat unless FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext.downcase)
|
7
7
|
|
8
8
|
content.shell_update(ext: content.ext || 'ttf') do |old_path, new_path|
|
9
9
|
"#{fontforge_command} -script #{DragonflyFonts::SCRIPT_DIR.join('webfonts.pe')} #{old_path} #{new_path}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dragonfly_fonts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomas Celizna
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|