fontprocessor 27.1.3

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.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.rbenv-version +1 -0
  4. data/.rspec +0 -0
  5. data/.travis.yml +17 -0
  6. data/CHANGELOG.md +64 -0
  7. data/CHANGELOG_FPV14.md +20 -0
  8. data/Dockerfile +3 -0
  9. data/Gemfile +14 -0
  10. data/Gemfile.lock +156 -0
  11. data/Guardfile +5 -0
  12. data/README.md +6 -0
  13. data/Rakefile +53 -0
  14. data/Rakefile.base +57 -0
  15. data/bin/process-file +41 -0
  16. data/config/development.yml +5 -0
  17. data/config/production.yml +3 -0
  18. data/config/staging.yml +3 -0
  19. data/config/test.yml +5 -0
  20. data/fontprocessor.gemspec +37 -0
  21. data/lib/fontprocessor/config.rb +85 -0
  22. data/lib/fontprocessor/external/batik/batik-ttf2svg.jar +0 -0
  23. data/lib/fontprocessor/external/batik/lib/batik-svggen.jar +0 -0
  24. data/lib/fontprocessor/external/batik/lib/batik-util.jar +0 -0
  25. data/lib/fontprocessor/external/fontforge/subset.py +30 -0
  26. data/lib/fontprocessor/external/fontforge/utils.py +66 -0
  27. data/lib/fontprocessor/external_execution.rb +117 -0
  28. data/lib/fontprocessor/font_file.rb +149 -0
  29. data/lib/fontprocessor/font_file_naming_strategy.rb +63 -0
  30. data/lib/fontprocessor/font_format.rb +29 -0
  31. data/lib/fontprocessor/process_font_job.rb +227 -0
  32. data/lib/fontprocessor/processed_font_iterator.rb +89 -0
  33. data/lib/fontprocessor/processor.rb +790 -0
  34. data/lib/fontprocessor/version.rb +3 -0
  35. data/lib/fontprocessor.rb +16 -0
  36. data/scripts/build_and_test.sh +15 -0
  37. data/scripts/get_production_source_map.rb +53 -0
  38. data/spec/fixtures/bad_os2_width_class.otf +0 -0
  39. data/spec/fixtures/extra_language_names.otf +0 -0
  40. data/spec/fixtures/fixtures.rb +35 -0
  41. data/spec/fixtures/locked.otf +0 -0
  42. data/spec/fixtures/op_size.otf +0 -0
  43. data/spec/fixtures/ots_failure_font.otf +0 -0
  44. data/spec/fixtures/postscript.otf +0 -0
  45. data/spec/fixtures/stat_font.otf +0 -0
  46. data/spec/fixtures/truetype.otf +0 -0
  47. data/spec/lib/fontprocessor/config_spec.rb +38 -0
  48. data/spec/lib/fontprocessor/external_execution_spec.rb +33 -0
  49. data/spec/lib/fontprocessor/font_file_naming_strategy_spec.rb +13 -0
  50. data/spec/lib/fontprocessor/font_file_spec.rb +110 -0
  51. data/spec/lib/fontprocessor/process_font_job_spec.rb +317 -0
  52. data/spec/lib/fontprocessor/processed_font_iterator_spec.rb +128 -0
  53. data/spec/lib/fontprocessor/processor_spec.rb +466 -0
  54. data/spec/spec_helper.rb +4 -0
  55. data/tasks/fonts.rake +30 -0
  56. data/worker.rb +23 -0
  57. metadata +312 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2f00e8cc724ccbc7a45cffb34e2bf8a66b735f5c137b402ca3bd704cc0567f9f
4
+ data.tar.gz: 85d6cc0dc242dd53c51d1d83a7948bbcc810d24531e098661d7c01b334f19cb3
5
+ SHA512:
6
+ metadata.gz: fd635a9a6303e3e10c88bb249e5c6f5a6081dba525310e86fe66eaa1fa159e51d175cbcb98d936226f8796684d88d99eaba12b79309a2781e71bbe4372643eaf
7
+ data.tar.gz: b11e19ff372e117489946607754c9d631ee8baedb6e12c59a2c33c9257703bc66866abc5cfca5c74d544d691e916500577fb8aa54ca2c1be5a601d5f7f3ab7d4
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ .gitignore~
2
+ .rbenv-version~
3
+ *.gem
4
+ .bundle
5
+ Gemfile.lock
6
+ ext/*.o
7
+ ext/sfnt2woff
8
+ ext/woff2sfnt
9
+ lib/fontprocessor/external/fontforge/*.pyc
10
+ pkg/*
11
+ tmp/*
12
+ .idea/*
data/.rbenv-version ADDED
@@ -0,0 +1 @@
1
+ 2.5.1
data/.rspec ADDED
File without changes
data/.travis.yml ADDED
@@ -0,0 +1,17 @@
1
+ services:
2
+ - redis-server
3
+ script:
4
+ - bundle install
5
+ - bundle exec rspec
6
+ language: ruby
7
+ rvm:
8
+ - 2.1.1
9
+
10
+ before_install:
11
+ - sudo apt-get install software-properties-common python-software-properties -y
12
+ - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
13
+ - sudo apt-get update
14
+ - sudo apt-get install gcc-6 g++-6 -y
15
+ - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6
16
+ - sudo update-alternatives --set gcc /usr/bin/gcc-6
17
+
data/CHANGELOG.md ADDED
@@ -0,0 +1,64 @@
1
+ v27.1.2 / 2018-07-26
2
+ ==================
3
+
4
+ * Skytype bugfix to ignore `mort` table https://git.corp.adobe.com/typekit/skytype/pull/185
5
+
6
+ v27.1.1 / 2018-07-26
7
+ ==================
8
+
9
+ * Skytype bugfix for SIDs in CFFTopDict table https://git.corp.adobe.com/typekit/skytype/pull/182
10
+
11
+ v27.1.0 / 2018-07-20
12
+ ==================
13
+
14
+ * Upgrade Skytype and FontProcessor to Ruby 2.5.1
15
+
16
+
17
+ v27.0.7 / 2017-10-17
18
+ ==================
19
+
20
+ * Skytype to handle required STAT string. Handle ASCII text in name table UTF-16 spaces.
21
+
22
+
23
+ v27.0.6 / 2017-08-29
24
+ ==================
25
+
26
+ * Skytype fix to properly handle SID reassignment when FontDict Indexes change size.
27
+
28
+ v27.0.5 / 2017-07-13
29
+ ==================
30
+
31
+ * Failed to update Gemfile.lock in prior version. No other material changes.
32
+
33
+ v27.0.4 / 2017-07-10
34
+ ==================
35
+
36
+ * Update Skytype to drop non-Unicode cmap tables.
37
+
38
+ v27.0.2 / 2015-06-05
39
+ ==================
40
+
41
+ * Update Skytype to ignore BAT and BATF tables.
42
+
43
+ v26.0.1 / 2015-06-05
44
+ ==================
45
+
46
+ * handle suppression of TTF output
47
+
48
+ v0.2.0 / 2012-02-08
49
+ ==================
50
+
51
+ * Update rspec to a newer version.
52
+ * Revert "Remove SVGs."
53
+ * Switch to gembase
54
+
55
+ v0.1.2 / 2010-10-05
56
+ ==================
57
+
58
+ * Minor fix, I called the method on the wrong object. Test case added.
59
+
60
+ v0.1.1 / 2010-10-05
61
+ ==================
62
+
63
+ * Fix bad os2 weight and width class values in fonts
64
+ * Copy spaces to non-breaking spaces in fonts missing non-breaking spaces
@@ -0,0 +1,20 @@
1
+ # Changes in FPV 14
2
+
3
+ This document covers the functional changes introduced in FPV 14 vs. 13.
4
+ These changes fall into two categories: 1) changes to existing behavior
5
+ 2) new functionality.
6
+
7
+ ## Changes to existing behavior
8
+
9
+ * Changes inversion of max_descent to use values passed out from Skytype. Original code
10
+ inverted the value such that a negative value became positive. Change is in Skytype
11
+ source and not in fontprocessor repo.
12
+ * Changes return value of FontFile.glyphs to return only the Unicode values in the font. Original code
13
+ returned all entries in the font, sorted by glyph ID, and listed by Unicode value. GlyphIDs which did
14
+ not have Unicode mapping previously had an entry value of -1.
15
+ * Replaces all calls into FontParser and FontForge with calls into Skytype.
16
+
17
+ ## New functionality
18
+
19
+ (none yet)
20
+
data/Dockerfile ADDED
@@ -0,0 +1,3 @@
1
+ FROM typekit-docker.dr.corp.adobe.com/typekit/ubuntu-14-ruby-21-bundler:0.3
2
+ RUN apt-get update -y
3
+ RUN apt-get -qqy install libidn11-dev libxml2-dev
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem "safe_yaml"
6
+
7
+ gem "fontbase", :git => "git@git.corp.adobe.com:typekit/fontbase.git", :tag => "v0.3.1"
8
+ gem "skytype", :git => "git@git.corp.adobe.com:typekit/skytype.git", :tag => "v2.7.4"
9
+ gem "ots-ruby", :git => "git@git.corp.adobe.com:typekit/ots-ruby.git", :tag => "v0.1.3"
10
+ gem "wofferizer", :git => "git@git.corp.adobe.com:typekit/wofferizer.git", :tag => "v0.2.0"
11
+ gem "aws-sdk", "~> 2"
12
+
13
+ gem "redis", "~>3.3.3"
14
+ gem "resque", "~>1.25.2"
data/Gemfile.lock ADDED
@@ -0,0 +1,156 @@
1
+ GIT
2
+ remote: git@git.corp.adobe.com:typekit/fontbase.git
3
+ revision: 37778f190a1b3ace8aab7b8109127cf61b232f28
4
+ tag: v0.3.1
5
+ specs:
6
+ fontbase (0.3.1)
7
+ aws-sdk (~> 2)
8
+ bson_ext (~> 1.5.2)
9
+ mongo (~> 1.5.2)
10
+
11
+ GIT
12
+ remote: git@git.corp.adobe.com:typekit/ots-ruby.git
13
+ revision: 6758632d0ddb465e29fcd355b5831eff8fd7ebf5
14
+ tag: v0.1.3
15
+ specs:
16
+ ots-ruby (0.1.3)
17
+ ffi
18
+ json
19
+
20
+ GIT
21
+ remote: git@git.corp.adobe.com:typekit/skytype.git
22
+ revision: a4fda8825b6d532940e2f01716ba7504b8904de3
23
+ tag: v2.7.4
24
+ specs:
25
+ skytype (2.7.4)
26
+ ffi (= 1.9.25)
27
+
28
+ GIT
29
+ remote: git@git.corp.adobe.com:typekit/wofferizer.git
30
+ revision: 0182269a8bca4cb429e7e34182f46540b47cbcab
31
+ tag: v0.2.0
32
+ specs:
33
+ wofferizer (0.2.0)
34
+ ffi
35
+
36
+ PATH
37
+ remote: .
38
+ specs:
39
+ fontprocessor (27.1.3)
40
+ activesupport (~> 4.2.10)
41
+ airbrake (~> 3.0.9)
42
+ aws-s3 (~> 0.6.2)
43
+ fontbase (~> 0.3.0)
44
+ i18n (~> 0.8.0)
45
+ json (= 1.8.6)
46
+ open4 (= 0.9.6)
47
+ ots-ruby (>= 0.0.3)
48
+ resque (>= 1.19.0)
49
+ skytype (>= 2.0.0)
50
+
51
+ GEM
52
+ remote: https://rubygems.org/
53
+ specs:
54
+ activesupport (4.2.10)
55
+ i18n (~> 0.7)
56
+ minitest (~> 5.1)
57
+ thread_safe (~> 0.3, >= 0.3.4)
58
+ tzinfo (~> 1.1)
59
+ airbrake (3.0.9)
60
+ activesupport
61
+ builder
62
+ aws-s3 (0.6.3)
63
+ builder
64
+ mime-types
65
+ xml-simple
66
+ aws-sdk (2.10.111)
67
+ aws-sdk-resources (= 2.10.111)
68
+ aws-sdk-core (2.10.111)
69
+ aws-sigv4 (~> 1.0)
70
+ jmespath (~> 1.0)
71
+ aws-sdk-resources (2.10.111)
72
+ aws-sdk-core (= 2.10.111)
73
+ aws-sigv4 (1.0.2)
74
+ bson (1.5.2)
75
+ bson_ext (1.5.2)
76
+ bson (= 1.5.2)
77
+ builder (3.2.3)
78
+ diff-lcs (1.2.5)
79
+ ffi (1.9.25)
80
+ guard (1.0.3)
81
+ ffi (>= 0.5.0)
82
+ thor (>= 0.14.6)
83
+ guard-rspec (0.6.0)
84
+ guard (>= 0.10.0)
85
+ i18n (0.8.6)
86
+ jmespath (1.3.1)
87
+ json (1.8.6)
88
+ mime-types (3.2.2)
89
+ mime-types-data (~> 3.2015)
90
+ mime-types-data (3.2018.0812)
91
+ minitest (5.11.3)
92
+ mongo (1.5.2)
93
+ bson (= 1.5.2)
94
+ mono_logger (1.1.0)
95
+ multi_json (1.12.1)
96
+ open4 (0.9.6)
97
+ rack (1.6.8)
98
+ rack-protection (1.5.3)
99
+ rack
100
+ rake (12.3.1)
101
+ redis (3.3.5)
102
+ redis-namespace (1.5.3)
103
+ redis (~> 3.0, >= 3.0.4)
104
+ resque (1.25.2)
105
+ mono_logger (~> 1.0)
106
+ multi_json (~> 1.0)
107
+ redis-namespace (~> 1.3)
108
+ sinatra (>= 0.9.2)
109
+ vegas (~> 0.1.2)
110
+ rspec (3.2.0)
111
+ rspec-core (~> 3.2.0)
112
+ rspec-expectations (~> 3.2.0)
113
+ rspec-mocks (~> 3.2.0)
114
+ rspec-core (3.2.2)
115
+ rspec-support (~> 3.2.0)
116
+ rspec-expectations (3.2.0)
117
+ diff-lcs (>= 1.2.0, < 2.0)
118
+ rspec-support (~> 3.2.0)
119
+ rspec-mocks (3.2.1)
120
+ diff-lcs (>= 1.2.0, < 2.0)
121
+ rspec-support (~> 3.2.0)
122
+ rspec-support (3.2.2)
123
+ safe_yaml (1.0.4)
124
+ sinatra (1.4.8)
125
+ rack (~> 1.5)
126
+ rack-protection (~> 1.4)
127
+ tilt (>= 1.3, < 3)
128
+ thor (0.19.1)
129
+ thread_safe (0.3.6)
130
+ tilt (2.0.7)
131
+ tzinfo (1.2.5)
132
+ thread_safe (~> 0.1)
133
+ vegas (0.1.11)
134
+ rack (>= 1.0.0)
135
+ xml-simple (1.1.5)
136
+
137
+ PLATFORMS
138
+ ruby
139
+
140
+ DEPENDENCIES
141
+ aws-sdk (~> 2)
142
+ fontbase!
143
+ fontprocessor!
144
+ guard (~> 1.0.0)
145
+ guard-rspec (~> 0.6.0)
146
+ ots-ruby!
147
+ rake (~> 12.3.1)
148
+ redis (~> 3.3.3)
149
+ resque (~> 1.25.2)
150
+ rspec (~> 3.2.0)
151
+ safe_yaml
152
+ skytype!
153
+ wofferizer!
154
+
155
+ BUNDLED WITH
156
+ 1.16.2
data/Guardfile ADDED
@@ -0,0 +1,5 @@
1
+ guard 'rspec', :all_after_pass => false, :all_on_start => false, :keep_failed => true do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
4
+ watch('spec/spec_helper.rb') { "spec" }
5
+ end
data/README.md ADDED
@@ -0,0 +1,6 @@
1
+ FontProcessor
2
+ =======
3
+
4
+ The goal of this library is to provide a high interface to handle typical tests
5
+ involved in creating web fonts.
6
+
data/Rakefile ADDED
@@ -0,0 +1,53 @@
1
+ load "Rakefile.base"
2
+
3
+ desc "Run the tests"
4
+ task :test => :spec
5
+
6
+ begin
7
+ require 'rspec/core/rake_task'
8
+ RSpec::Core::RakeTask.new
9
+ rescue
10
+ puts 'WARNING: rspec tasks not loaded"'
11
+ end
12
+
13
+ task :environment do
14
+ require 'rubygems'
15
+ require 'bundler'
16
+ Bundler.require
17
+ end
18
+
19
+ desc "Get all dem fonts"
20
+ task :get_dem_fonts, [:src_csv_path, :storage_path] => [:environment] do |t, args|
21
+ require 'csv'
22
+ csv_file_path = args[:src_csv_path]
23
+ storage_path = args[:storage_path]
24
+ csv = CSV.read(csv_file_path)
25
+ csv_rows = csv[0..-1]
26
+ row_count = csv_rows.size
27
+ index = 20530
28
+ csv_rows = csv[index..-1]
29
+ #TypeTogether,Givry,Givry,Regular,000000000000000000018a8a,c6ae973aa7e2fa4f36e10594d052a885
30
+ #row_count = csv_rows.size
31
+ csv_rows.each do |csv_row|
32
+ raise if csv_row.size != 6
33
+ index += 1
34
+ vendor = csv_row[0]
35
+ vendor_name = vendor.gsub("/", " ")
36
+ vendor_name.gsub!("'", "")
37
+ vendor_name.gsub!("(","")
38
+ vendor_name.gsub!(")","")
39
+ vendor_dir = Pathname.new(storage_path) + vendor_name
40
+ vendor_dir.mkdir unless vendor_dir.exist?
41
+ fam_name = csv_row[1]
42
+ fam_dir = vendor_dir + fam_name
43
+ fam_dir.mkdir unless fam_dir.exist?
44
+ file = fam_dir + "#{csv_row[2]}#{csv_row[3]}.otf"
45
+ next if file.exist?
46
+ # out_name = csv_row[columns[:out_name]]
47
+ # out_file = File.join(storage_path, out_name)
48
+ puts "#{index.to_s} of #{row_count.to_s}) Fetching s3://typekit-production-source-fonts/#{csv_row[5]} and storing it in #{file.expand_path}"
49
+ path_as_str = file.expand_path.to_s.gsub(" ", "\\ ")
50
+ `aws s3 cp s3://typekit-production-source-fonts/#{csv_row[5]} #{path_as_str}`
51
+ end
52
+ end
53
+
data/Rakefile.base ADDED
@@ -0,0 +1,57 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ module Bundler
5
+ class GemHelper
6
+ # Override Bundler's concept of release.
7
+ def release_gem
8
+ with_fixed_editor {
9
+ guard_on_master_branch
10
+ guard_already_tagged
11
+ build_gem
12
+ edit_changelog
13
+ sh "git commit --allow-empty -a -m 'Release #{version_tag}'"
14
+ tag_version {
15
+ # Bundler's git_push pushes all branches. Let's restrict it
16
+ # to only the master branch since we also ensure that you
17
+ # always release from the master branch.
18
+ perform_git_push "origin master --tags"
19
+ }
20
+ }
21
+ end
22
+ def with_fixed_editor
23
+ editor = ENV['EDITOR'] || ""
24
+ abort "You must set an EDITOR to edit the changelog" if editor.empty?
25
+ swaps = {
26
+ "mate" => "mate -w",
27
+ "subl" => "subl -w"
28
+ }
29
+ begin
30
+ ENV['EDITOR'] = swaps.fetch(editor, editor)
31
+ yield
32
+ ensure
33
+ ENV['EDITOR'] = editor
34
+ end
35
+ end
36
+ def guard_on_master_branch
37
+ unless `git branch` =~ /^\* master$/
38
+ abort "You must be on the master branch to release."
39
+ end
40
+ end
41
+ def edit_changelog
42
+ unless `which git-changelog`.empty?
43
+ sh "git-changelog"
44
+ else
45
+ abort "git-changelog isn't found. Install it with `brew install git-extras`"
46
+ end
47
+ end
48
+ end
49
+ end
50
+
51
+ desc "Run all tests"
52
+ task :default => :test
53
+
54
+ desc "Update Rakefile.base"
55
+ task :selfupdate do
56
+ sh "curl -sO https://raw.github.com/rcarver/gembase/master/Rakefile.base"
57
+ end
data/bin/process-file ADDED
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'
3
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
4
+ require 'fontprocessor'
5
+ require 'optparse'
6
+ require 'fileutils'
7
+
8
+ options = {
9
+ :characters => -1..1000,
10
+ :character_set_name => "1",
11
+ :license_url => "http://localhost",
12
+ }
13
+
14
+ opts = OptionParser.new do |opts|
15
+ opts.on("-n", "--char-set-name NAME", "name of the character set (default: #{options[:character_set_name]})") { |name|
16
+ options[:character_set_name] = name
17
+ }
18
+ opts.on("-c", "--characters N..N", "range of characters to include (default: #{options[:glyphs]})") { |characters|
19
+ options[:characters] = eval(characters)
20
+ }
21
+ opts.on_tail("-h", "--help", "Show help") {
22
+ puts opts
23
+ exit
24
+ }
25
+ end
26
+
27
+ if not ARGV.length == 1
28
+ puts "USAGE: process <filename.otf>"
29
+ exit 0
30
+ end
31
+ filename = ARGV.first
32
+ basename = File.basename(ARGV.first).gsub('..', '').split('.')[0]
33
+
34
+ FileUtils.mkdir_p(basename)
35
+ FileUtils.cp(filename, File.join(basename, "#{basename}.otf"))
36
+ naming_strategy = FontProcessor::FontFileNamingStrategy.new("#{basename}.otf", basename)
37
+
38
+ char_set = FontProcessor::CharSet.new(options[:character_set_name], :characters => [options[:characters]])
39
+ processor = FontProcessor::Processor.new(naming_strategy, options[:license_url], "01")
40
+ processor.preprocess
41
+ processor.generate_char_set(char_set, 400, :normal)
@@ -0,0 +1,5 @@
1
+ redis_server: "localhost:6379"
2
+ mongo_host: "localhost"
3
+ mongo_db: "fontbase_development"
4
+ s3_source_bucket: "typekit-development-source-fonts"
5
+ s3_processed_bucket: "typekit-development-processed-fonts"
@@ -0,0 +1,3 @@
1
+ mongo_db: "fontbase_production"
2
+ s3_source_bucket: "typekit-production-source-fonts"
3
+ s3_processed_bucket: "typekit-production-processed-fonts"
@@ -0,0 +1,3 @@
1
+ mongo_db: "fontbase_staging"
2
+ s3_source_bucket: "typekit-staging-source-fonts"
3
+ s3_processed_bucket: "typekit-staging-processed-fonts"
data/config/test.yml ADDED
@@ -0,0 +1,5 @@
1
+ redis_server: "localhost:6379"
2
+ mongo_host: "localhost"
3
+ mongo_db: "fontbase_test"
4
+ s3_source_bucket: "typekit-test-source-fonts"
5
+ s3_processed_bucket: "typekit-test-processed-fonts"
@@ -0,0 +1,37 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "fontprocessor/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "fontprocessor"
7
+ s.version = FontProcessor::VERSION
8
+ s.authors = ["Matt Colyer"]
9
+ s.email = ["matt@typekit.com"]
10
+ s.homepage = "http://github.com/typekit/fontprocessor/"
11
+ s.summary = %q{High level interface for creating web fonts.}
12
+ s.description = %q{A nice wrapper for fontparser}
13
+
14
+ s.rubyforge_project = "fontprocessor"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency('activesupport', ["~> 4.2.10"])
22
+ s.add_dependency('json', ["= 1.8.6"])
23
+ s.add_dependency('fontbase', ["~> 0.3.0"])
24
+ s.add_dependency('open4', ["= 0.9.6"])
25
+ s.add_dependency('resque', [">= 1.19.0"])
26
+ s.add_dependency('skytype', [">= 2.0.0"])
27
+ s.add_dependency('ots-ruby', [">= 0.0.3"])
28
+
29
+ s.add_dependency('aws-s3', ["~> 0.6.2"])
30
+ s.add_dependency('airbrake', ["~> 3.0.9"])
31
+ s.add_dependency('i18n', ["~> 0.8.0"])
32
+
33
+ s.add_development_dependency('rake', ["~> 12.3.1"])
34
+ s.add_development_dependency('rspec', ["~> 3.2.0"])
35
+ s.add_development_dependency('guard', ["~> 1.0.0"])
36
+ s.add_development_dependency('guard-rspec', ["~> 0.6.0"])
37
+ end
@@ -0,0 +1,85 @@
1
+ require 'date'
2
+ require 'safe_yaml'
3
+
4
+ module FontProcessor
5
+ class Config
6
+ class << self
7
+ SafeYAML::OPTIONS[:default_mode] = :safe
8
+
9
+ # Public: The redis server and port. typekit.yml will override
10
+ # config/environment.yml
11
+ def redis_server
12
+ typekit_config['redis_server'] || config['redis_server']
13
+ end
14
+
15
+ # Public: The mongo server. typekit.yml will override
16
+ # config/environment.yml
17
+ def mongo_host
18
+ typekit_config['mongo_host'] || config['mongo_host']
19
+ end
20
+
21
+ # Public: The mongo database name from config/environment.yml
22
+ def mongo_db
23
+ typekit_config['mongo_db'] || config['mongo_db']
24
+ end
25
+
26
+ # Public: The S3 source font file bucket from config/environment.yml
27
+ def s3_source_bucket
28
+ typekit_config['s3_source_bucket'] || config['s3_source_bucket']
29
+ end
30
+
31
+ # Public: The S3 processed font file bucket from config/environment.yml
32
+ def s3_processed_bucket
33
+ typekit_config['s3_processed_bucket'] || config['s3_processed_bucket']
34
+ end
35
+
36
+ # Public: The Airbrake API key from from
37
+ # /etc/typekit.yml
38
+ def airbrake_api_key
39
+ config["airbrake_api_key"]
40
+ end
41
+
42
+ # Public: The environment fontprocessor is running in. One of "development",
43
+ # "test", "staging" or "production"
44
+ def environment
45
+ ENV['ENV'] || 'development'
46
+ end
47
+
48
+ # Public: The environment fontprocessor is running in. One of "development",
49
+ # "test", "staging" or "production"
50
+ def flex_sdk_path
51
+ ENV['FLEX_SDK_HOME'] or raise "Environment variable 'FLEX_SDK_HOME' is undefined but is required."
52
+ end
53
+
54
+ def s3_client
55
+ @s3_client ||= Aws::S3::Client.new(region: 'us-east-1')
56
+ end
57
+
58
+ # Public: The logger to write messages to. In production and development
59
+ # it's STDOUT and during testing its an in memory buffer.
60
+ def logger
61
+ if defined? RSpec
62
+ StringIO.new
63
+ else
64
+ STDOUT
65
+ end
66
+ end
67
+
68
+ protected
69
+ # Returns a Hash of configuration values from config/environment.yml
70
+ def config
71
+ @config ||= YAML.load_file(File.join(File.dirname(__FILE__), "..", "..", "config", "#{environment}.yml"))
72
+ end
73
+
74
+ # Returns a Hash of global typekit configuration values while in production and
75
+ # an empty Hash otherwise.
76
+ def typekit_config
77
+ begin
78
+ @typekit_config ||= YAML.load_file(File.join("/", "etc", "typekit.yml"))
79
+ rescue
80
+ {}
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/python
2
+ import fontforge
3
+ import utils
4
+
5
+ SPACE_UNICODE_ID = 0x20
6
+ NB_SPACE_UNICODE_ID = 0xA0
7
+ NB_SPACE_NAME = "uni00A0"
8
+
9
+ parsed = utils.parse_input()
10
+ assert parsed.has_key('input_filename'), "Input Filename Required"
11
+ assert parsed.has_key('output_filename'), "Output Filename Required"
12
+
13
+
14
+ # Iterate over every gylph in the font and remove it if it's not in the
15
+ # included list. This is done because we can preserve the other information in
16
+ # the font such as ligatures and kerning (without doing complicated things like
17
+ # copying).
18
+ try:
19
+ source = fontforge.open(parsed['input_filename'])
20
+ original_metrics = utils.original_metrics(source)
21
+ glyphs = {}
22
+ for glyph in source.glyphs():
23
+ glyphs[glyph.unicode] = glyph
24
+ utils.lossless_save(original_metrics, source, parsed["output_filename"])
25
+ except EnvironmentError, e:
26
+ # Apparently font forge chokes on some fonts, fun
27
+ utils.complete({'status' : 'Failure', 'message' : str(e)})
28
+ else:
29
+ # Tells ruby we are finished
30
+ utils.complete({'status' : 'Success'})