dragonfly_fonts 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 137d94fd8b94769c488579083ac8759459c991ec60f8b794afe16fbaf1632765
4
- data.tar.gz: '0967af044720a841dead2736419e68fa90891f8bf41b2e1eba1c983f88b88e52'
3
+ metadata.gz: 167ead4c721a024e329f31e536305c41fff765560ab525c0069b8e2c0e32f197
4
+ data.tar.gz: 6170c9b80e44833ef97485c7ccd05e116fbf2265d5d1eb88eaf0bda054f29809
5
5
  SHA512:
6
- metadata.gz: 3be5bd6584a0c673694cfa81b4a4841380c4c080b1a38354d20f01c461d5aba9d32df4a9207b63d7359822b09645113d99dcda4a491d84eb53241bf187397016
7
- data.tar.gz: dc149b8eb5d2364e730ee4351ebf1d0f783934efbe3b8c98dda25245be69c39c64c9b28e3253d1d718ee71e4b9dccdaa8eecd8b791873b1d75d49616c1e9eebd
6
+ metadata.gz: 1c9f14f4814a2f078f4f047ec342e36f6a82f44ffe2aeb7aa4c2b5a912e7d42357dc9794a550a95f6cd282eca02b7e6848c65d104a464f1511c06bc4a4227f2a
7
+ data.tar.gz: aa0c5403d54555f93221673dd587e6505b1230d3c6d5065a986ca178a3503cbc232bd813f49f446a3fb4b2dfca4add9f55f5fc250a188815aa859d61fc480829
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.0.2
4
+
5
+ * improved `SUPPORTED_FORMATS` matching that ignores case
6
+
3
7
  ## 1.0.1
4
8
 
5
9
  * add `hhea_*` and `os2_*` options to font info
@@ -4,7 +4,8 @@ module DragonflyFonts
4
4
  module Analysers
5
5
  class Bbox
6
6
  def call(content, glyph)
7
- return {} unless FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext)
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 FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext)
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 FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext)
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 FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext)
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 OT_SANITISE_SUPPORTED_FORMATS.include?(content.ext)
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
- # TODO: if other then convert first
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 SUPPORTED_FORMATS.include?(content.ext)
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
- # TODO: if other then convert first
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 SUPPORTED_FORMATS.include?(content.ext)
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
- # TODO: if other then convert first
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 OT_SANITISE_SUPPORTED_FORMATS.include?(content.ext)
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
- # TODO: if other then convert first
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
- # TODO: if other then convert first
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
- # TODO: if other then convert first
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
- # TODO: if other then convert first
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
- # TODO: make sure this works for WOFF2
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
- # TODO: if other then convert first
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
- # TODO: if other then convert first
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}"
@@ -1,3 +1,3 @@
1
1
  module DragonflyFonts
2
- VERSION = '1.0.1'.freeze
2
+ VERSION = '1.0.2'.freeze
3
3
  end
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.1
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-08-15 00:00:00.000000000 Z
11
+ date: 2018-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport