fontcustom 1.3.8 → 2.0.0

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
  SHA1:
3
- metadata.gz: 1de556a5e3246945f433c7553625791242421dd1
4
- data.tar.gz: 31f207332430a7f094ddfe9ff8d5ee807efce082
3
+ metadata.gz: dc2597df3b94e7657fbaa82856e909f1b762baa7
4
+ data.tar.gz: 8f6437cb607c18c0c47228abc212058af9d58769
5
5
  SHA512:
6
- metadata.gz: 5285a580ad2f2613dbc1eb131b4aa6bd818232c20472fda176b534a36a8f396b1389c2c365d2dd391b515821b9f9576decca61f3cb276996000430a0b6209697
7
- data.tar.gz: a4545ac14e0b59216fe08ef6e477b6c99697c293036cca868ca5a2a4cebfd7c9e9d459f51b05def361fb85970a7749a341ff374c128e3725efbe35d69e09e49c
6
+ metadata.gz: 3faa26c666038c1e5b9ad4436ec849005fb5c32d2c8d255dc39065b08d4ea60a0e8faf10c1b4d606f63f7593b7a4019312e6f6823b830478ae7b124cb3fe4a08
7
+ data.tar.gz: afef84481d791bba0492fe284dffdb9331aeebae95ad03385ecc9e5a07fe53ea9c687e9b7a3baf8ec5b8ba74e9d98f43dd2f88d3e79514ed7e1b81e44028b95e
@@ -1,20 +1,42 @@
1
+ sudo: required
1
2
  language: ruby
3
+ addons:
4
+ apt:
5
+ sources:
6
+ - ubuntu-toolchain-r-test
7
+ packages:
8
+ - fontforge-nox
9
+ - gcc-4.8
10
+ - g++-4.8
2
11
  before_install:
3
- - sudo apt-get update -qq
4
- - sudo apt-get install -qq fontforge
5
12
  - wget http://people.mozilla.com/~jkew/woff/woff-code-latest.zip
6
- - unzip woff-code-latest.zip -d sfnt2woff && cd sfnt2woff && make && sudo mv sfnt2woff /usr/local/bin/
13
+ - unzip woff-code-latest.zip -d sfnt2woff && cd sfnt2woff && make && mkdir -p bin && mv sfnt2woff bin && cd ..
14
+ - export PATH=$PATH:$PWD/sfnt2woff/bin/
15
+ - if [ $TRAVIS_OS_NAME == "linux" ]; then
16
+ export CC="gcc-4.8";
17
+ export CXX="g++-4.8";
18
+ export LINK="gcc-4.8";
19
+ export LINKXX="g++-4.8";
20
+ fi
21
+ - git clone --recursive https://github.com/google/woff2.git && cd woff2 && make clean all && sudo mv woff2_compress /usr/local/bin/ && sudo mv woff2_decompress /usr/local/bin/
7
22
  - bundle
8
23
  rvm:
24
+ - 2.2.2
9
25
  - 2.1.1
10
26
  - 2.0.0
11
27
  - 1.9.3
12
- - 1.9.2
13
28
  gemfile:
14
29
  - Gemfile
15
30
  - gemfiles/Gemfile.listen_1
31
+ - gemfiles/Gemfile.listen_2
16
32
  matrix:
17
33
  exclude:
18
34
  - gemfile: Gemfile
19
- rvm: 1.9.2
35
+ rvm: 1.9.3
36
+ - gemfile: Gemfile
37
+ rvm: 2.0.0
38
+ - gemfile: gemfiles/Gemfile.listen_2
39
+ rvm: 1.9.3
40
+ - gemfile: gemfiles/Gemfile.listen_2
41
+ rvm: 2.0.0
20
42
  script: bundle exec rake
@@ -1,3 +1,18 @@
1
+ ## 2.0.0 (6/14/2017)
2
+
3
+ * Adds support for Woff2 ([#313](https://github.com/FontCustom/fontcustom/pull/313))
4
+ * Minimum ruby version bumped to 1.9.3
5
+ * Support listen 3 ([#283](https://github.com/FontCustom/fontcustom/pull/283))
6
+ * Support Python 3 ([#276](https://github.com/FontCustom/fontcustom/pull/276))
7
+ * Compatible with Windows ([#289](https://github.com/FontCustom/fontcustom/pull/289))
8
+ * Set glyph name when creating char in fontforge ([#286](https://github.com/FontCustom/fontcustom/pull/286))
9
+ * Allow specification of copyright information ([#287](https://github.com/FontCustom/fontcustom/pull/287))
10
+ * Enable CSS3 pseudo selectors '::' vs ':' ([#310](https://github.com/FontCustom/fontcustom/pull/310))
11
+ * Update installation instructions with zlib for linux machines ([#224](https://github.com/FontCustom/fontcustom/pull/224))
12
+ * Works with updated Travis CI configuration
13
+ * Fix issue with relative paths in check_template_paths
14
+ * Be more Unix-y and fail when there is an error ([#295](https://github.com/FontCustom/fontcustom/pull/295))
15
+
1
16
  ## 1.3.4 (10/11/2014)
2
17
 
3
18
  * Updates rspec tests to be compatible with rspec v3.1.6
@@ -30,7 +30,7 @@ us know. No such thing as too small of an improvement.
30
30
  You'll need:
31
31
 
32
32
  * Fontforge with Python scripting (easiest via [Homebrew](http://brew.sh/) on Mac)
33
- * Ruby 1.9.2+ (via [rbenv](https://github.com/sstephenson/rbenv), [RVM](https://rvm.io/), etc.)
33
+ * Ruby 1.9.3+ (via [rbenv](https://github.com/sstephenson/rbenv), [RVM](https://rvm.io/), etc.)
34
34
  * Rubygems
35
35
  * Bundler
36
36
  * Rake
data/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  **Icon fonts from the command line.**
8
8
 
9
9
  Generate cross-browser icon fonts and supporting files (@font-face CSS, etc.)
10
- from a collection of SVGs
10
+ from a collection of SVGs
11
11
  ([example](https://rawgit.com/FontCustom/fontcustom/master/spec/fixtures/example/example-preview.html)).
12
12
 
13
13
  [Changelog](https://github.com/FontCustom/fontcustom/blob/master/CHANGELOG.md)<br>
@@ -16,20 +16,34 @@ from a collection of SVGs
16
16
 
17
17
  ### Installation
18
18
 
19
- Requires **Ruby 1.9.2+**, **FontForge** with Python scripting.
19
+ Requires **Ruby 1.9.3+**, **WOFF2**, **FontForge** with Python scripting.
20
20
 
21
21
  ```sh
22
22
  # On Mac
23
+ brew tap bramstein/webfonttools
24
+ brew update
25
+ brew install woff2
26
+
23
27
  brew install fontforge --with-python
24
28
  brew install eot-utils
25
29
  gem install fontcustom
26
30
 
27
31
  # On Linux
28
- sudo apt-get install fontforge
32
+ sudo apt-get install zlib1g-dev fontforge
29
33
  wget http://people.mozilla.com/~jkew/woff/woff-code-latest.zip
30
34
  unzip woff-code-latest.zip -d sfnt2woff && cd sfnt2woff && make && sudo mv sfnt2woff /usr/local/bin/
35
+ git clone --recursive https://github.com/google/woff2.git && cd woff2 && make clean all && sudo mv woff2_compress /usr/local/bin/ && sudo mv woff2_decompress /usr/local/bin/
31
36
  gem install fontcustom
32
37
  ```
38
+ ####Note for windows:
39
+
40
+ 1. Install fontforge: http://fontforge.github.io/en-US/downloads/windows/
41
+ - Install to a path without spaces, eg c:\FontForgeBuilds
42
+ - At the end of the installer check the 'run fontforge' box. It finishes some set up.
43
+ 2. Add the installation path to your System PATH variable (c:\FontForgeBuilds\bin)
44
+ 3. Open up a new command prompt and test it. `fontforge -help`
45
+ 4. gem install fontcustom
46
+
33
47
 
34
48
  ### Quick Start
35
49
 
@@ -66,11 +80,82 @@ compatible font-url() helper. You'll most likely also need to set
66
80
  `preprocessor_path` as the relative path from your compiled CSS to your output
67
81
  directory.
68
82
 
83
+ **Example Use in Rails**
84
+
85
+ Add `gem 'fontcustom'` to your gem file.
86
+ ```
87
+ bundle
88
+ ```
89
+ Create a `fontcustom.yml` file with something like this:
90
+ ```yml
91
+ # config/fontcustom.yml
92
+
93
+ font_name: icons
94
+ css_selector: .icon-{{glyph}}
95
+ preprocessor_path: ""
96
+ autowidth: false
97
+ no_hash: true
98
+ force: false
99
+ debug: false
100
+ quiet: false
101
+
102
+ input:
103
+ vectors: app/assets/icons
104
+
105
+ output:
106
+ fonts: app/assets/fonts
107
+ css: app/assets/stylesheets
108
+
109
+ templates:
110
+ - scss
111
+ ```
112
+
113
+ This tells the gem to take the vectors from `app/assets/icons` and create fonts and stylesheets for them.
114
+
115
+ Create a file in lib/tasks called `icons.rake` :
116
+
117
+ ```ruby
118
+ namespace :icons do
119
+ task :compile do
120
+ puts "Compiling icons..."
121
+ puts %x(fontcustom compile)
122
+ end
123
+ end
124
+ ```
125
+
126
+ Load up the icons directory and test it out.
127
+
128
+ Run this command with
129
+ ```sh
130
+ rake icons:compile
131
+ ```
132
+
133
+ This should run the installed and configured gem to create your icons:
134
+
135
+ ```sh
136
+ Compiling icons...
137
+ create .fontcustom-manifest.json
138
+ create app/assets/fonts
139
+ create app/assets/fonts/icons.ttf
140
+ app/assets/fonts/icons.svg
141
+ app/assets/fonts/icons.woff
142
+ app/assets/fonts/icons.eot
143
+ create app/assets/stylesheets/_icons.scss
144
+ ```
145
+ Access these new icons by creating a tag with the class `icon-{{glyph}}` where the {{glyph}} is the name of the svg you put in the icon folder.
146
+ For example, if you added a file called 'cars54' icon would look something like this:
147
+
148
+ ```html
149
+ <i class="icon-cars54"</i>
150
+ ```
151
+
152
+ Now the font is adjustable to css 'font-size' and 'color'.
153
+
69
154
  **Save CSS and fonts to different locations**
70
155
 
71
156
  You can save generated fonts, CSS, and other files to different locations by
72
157
  using `fontcustom.yml`. Font Custom can also read input vectors and templates
73
- from different places.
158
+ from different places.
74
159
 
75
160
  Just edit the `input` and `output` YAML hashes and their corresponding keys.
76
161
 
@@ -101,6 +186,7 @@ helpers:
101
186
  * `@manifest`: a hash of options, generated file paths, code points, and just about everything else Font Custom knows.
102
187
  * `@font_path`: the path from CSS to font files (without an extension)
103
188
  * `@font_path_alt`: if `preprocessor_path` was set, this is the modified path
189
+ * `pseudo_element`: if `css3` was set to true, then it will print `::before`. Otherwise the PseudoElement will be `:before`
104
190
 
105
191
  `font_face` accepts a hash that modifies the CSS url() function and the path of
106
192
  the font files (`font_face(url: "font-url", path: @font_path_alt)`).
@@ -20,9 +20,9 @@ Gem::Specification.new do |gem|
20
20
 
21
21
  gem.add_dependency "json", "~>1.4"
22
22
  gem.add_dependency "thor", "~>0.14"
23
- gem.add_dependency "listen", ">=1.0","<3.0"
23
+ gem.add_dependency "listen", ">=1.0","<4.0"
24
24
 
25
- gem.add_development_dependency "rake"
25
+ gem.add_development_dependency "rake", "~> 10"
26
26
  gem.add_development_dependency "bundler"
27
27
  gem.add_development_dependency "rspec", "~>3.1.0"
28
28
  end
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem"s dependencies in fontcustom.gemspec
4
+ gemspec :path => ".."
5
+
6
+ gem "listen", "~>2.0"
@@ -36,8 +36,10 @@ module Fontcustom
36
36
  :preprocessor_path => nil,
37
37
  :autowidth => false,
38
38
  :no_hash => false,
39
+ :css3 => false,
39
40
  :debug => false,
40
41
  :force => false,
41
- :quiet => false
42
+ :quiet => false,
43
+ :copyright => ''
42
44
  }
43
45
  end
@@ -6,7 +6,8 @@ module Fontcustom
6
6
 
7
7
  def initialize(raw_options)
8
8
  check_fontforge
9
- manifest = ".fontcustom-manifest.json"
9
+ check_woff2
10
+ manifest = '.fontcustom-manifest.json'
10
11
  raw_options[:manifest] = manifest
11
12
  @options = Fontcustom::Options.new(raw_options).options
12
13
  @manifest = Fontcustom::Manifest.new(manifest, @options)
@@ -30,12 +31,23 @@ module Fontcustom
30
31
  private
31
32
 
32
33
  def check_fontforge
33
- fontforge = `which fontforge`
34
+ if !Gem.win_platform?
35
+ fontforge = `which fontforge`
36
+ else
37
+ fontforge = `where fontforge`
38
+ end
34
39
  if fontforge == "" || fontforge == "fontforge not found"
35
40
  raise Fontcustom::Error, "Please install fontforge first. Visit <http://fontcustom.com> for instructions."
36
41
  end
37
42
  end
38
43
 
44
+ def check_woff2
45
+ woff2 = `which woff2_compress`
46
+ if woff2 == "" || woff2 == "woff2_compress not found"
47
+ fail Fontcustom::Error, "Please install woff2 first. Visit <https://github.com/google/woff2> for instructions."
48
+ end
49
+ end
50
+
39
51
  # Calculates a hash of vectors, options, and templates (content and filenames)
40
52
  def checksum
41
53
  files = Dir.glob(File.join(@options[:input][:vectors], "*.svg")).select { |fn| File.file?(fn) }
@@ -25,7 +25,7 @@ module Fontcustom
25
25
  class_option :font_name, :aliases => %w|--name -n|, :type => :string,
26
26
  :desc => "The font's name. Also determines the file names of generated templates.",
27
27
  :default => DEFAULT_OPTIONS[:font_name]
28
-
28
+
29
29
  class_option :font_design_size, :aliases => %s|--size -s|, :type => :numeric,
30
30
  :desc => "Size (in pica points) for which this font is designed.",
31
31
  :default => DEFAULT_OPTIONS[:font_design_size]
@@ -52,6 +52,9 @@ module Fontcustom
52
52
  class_option :autowidth, :aliases => "-A", :type => :boolean,
53
53
  :desc => "Horizontally fit glyphs to their individual vector widths."
54
54
 
55
+ class_option :css3, :type => :boolean,
56
+ :desc => "Use CSS3 Pseudo Elements"
57
+
55
58
  class_option :no_hash, :aliases => "-h", :type => :boolean,
56
59
  :desc => "Generate fonts without asset-busting hashes."
57
60
 
@@ -67,6 +70,9 @@ module Fontcustom
67
70
  class_option :quiet, :aliases => "-q", :type => :boolean,
68
71
  :desc => "Hide status messages."
69
72
 
73
+ class_option :copyright, :aliases => %w|--copyright -r|, :type => :string,
74
+ :desc => "Copyright information."
75
+
70
76
  # Required for Thor::Actions#template
71
77
  def self.source_root
72
78
  File.join Fontcustom.gem_lib, "templates"
@@ -78,6 +84,7 @@ module Fontcustom
78
84
  rescue Fontcustom::Error => e
79
85
  say_status :error, e.message, :red
80
86
  puts e.backtrace.join("\n") if options[:debug]
87
+ exit 1
81
88
  end
82
89
 
83
90
  desc "watch [INPUT] [OPTIONS]", "Watches INPUT for changes and regenerates files automatically. Ctrl + C to stop. Default: `pwd`"
@@ -90,6 +97,7 @@ module Fontcustom
90
97
  Watcher.new(opts).watch
91
98
  rescue Fontcustom::Error => e
92
99
  say_status :error, e.message, :red
100
+ exit 1
93
101
  end
94
102
 
95
103
  desc "config [DIR]", "Generates a starter configuration file (fontcustom.yml) in DIR. Default: `pwd`"
@@ -12,6 +12,12 @@ module Fontcustom
12
12
  def initialize(manifest)
13
13
  @manifest = Fontcustom::Manifest.new manifest
14
14
  @options = @manifest.get :options
15
+
16
+ @pseudo_element = ':before';
17
+ if @options[:css3]
18
+ @pseudo_element = '::before';
19
+ end
20
+
15
21
  end
16
22
 
17
23
  def generate
@@ -146,6 +152,7 @@ module Fontcustom
146
152
  @font-face {
147
153
  font-family: "#{font_name}";
148
154
  src: url("data:application/x-font-woff;charset=utf-8;base64,#{woff_base64}") format("woff"),
155
+ #{url}("#{path}.woff2") format("woff2"),
149
156
  #{url}("#{path}.ttf") format("truetype"),
150
157
  #{url}("#{path}.svg##{font_name}") format("svg");
151
158
  font-weight: normal;
@@ -156,6 +163,7 @@ module Fontcustom
156
163
  font-family: "#{font_name}";
157
164
  src: #{url}("#{path}.eot");
158
165
  src: #{url}("#{path}.eot?#iefix") format("embedded-opentype"),
166
+ #{url}("#{path}.woff2") format("woff2"),
159
167
  #{url}("#{path}.woff") format("woff"),
160
168
  #{url}("#{path}.ttf") format("truetype"),
161
169
  #{url}("#{path}.svg##{font_name}") format("svg");
@@ -183,7 +191,7 @@ module Fontcustom
183
191
 
184
192
  def glyph_selectors
185
193
  output = @glyphs.map do |name, value|
186
- @options[:css_selector].sub("{{glyph}}", name.to_s) + ":before"
194
+ @options[:css_selector].sub("{{glyph}}", name.to_s) + @pseudo_element
187
195
  end
188
196
  output.join ",\n"
189
197
  end
@@ -205,10 +213,14 @@ module Fontcustom
205
213
 
206
214
  def glyphs
207
215
  output = @glyphs.map do |name, value|
208
- %Q|#{@options[:css_selector].sub('{{glyph}}', name.to_s)}:before { content: "\\#{value[:codepoint].to_s(16)}"; }|
216
+ %Q|#{@options[:css_selector].sub('{{glyph}}', name.to_s)}#{@pseudo_element} { content: "\\#{value[:codepoint].to_s(16)}"; }|
209
217
  end
210
218
  output.join "\n"
211
219
  end
220
+
221
+ def pseudo_element
222
+ @pseudo_element
223
+ end
212
224
  end
213
225
  end
214
226
  end
@@ -165,7 +165,11 @@ module Fontcustom
165
165
  def check_template_paths
166
166
  @options[:templates].each do |template|
167
167
  next if %w|preview css scss scss-rails|.include? template
168
- path = File.expand_path File.join(@options[:input][:templates], template) unless template[0] == "/"
168
+ if template[0] == "/"
169
+ path = template
170
+ else
171
+ path = File.expand_path File.join(@options[:input][:templates], template)
172
+ end
169
173
  unless File.exists? path
170
174
  raise Fontcustom::Error,
171
175
  "Custom template `#{template}` wasn't found in `#{@options[:input][:templates]}/`. Check your options."
@@ -184,7 +188,7 @@ module Fontcustom
184
188
  end
185
189
 
186
190
  def print_debug
187
- message = line_break(16)
191
+ message = line_break(16)
188
192
  message << @options.pretty_inspect.split("\n ").join(line_break(16))
189
193
  say_message :debug, "Using options:#{message}"
190
194
  end
@@ -225,7 +225,7 @@ class FontError(Exception):
225
225
  pass
226
226
 
227
227
  def multichar(str):
228
- vals = struct.unpack('4B', str[:4])
228
+ vals = struct.unpack('4B', str[:4].encode('utf-8'))
229
229
  return (vals[0] << 24) + (vals[1] << 16) + (vals[2] << 8) + vals[3]
230
230
 
231
231
  def multicharval(v):
@@ -289,10 +289,10 @@ def get_table_directory(data):
289
289
  datalen = len(data)
290
290
  sfntsize = struct.calcsize(OpenType.SFNT_UNPACK)
291
291
  if sfntsize > datalen:
292
- raise FontError, 'truncated font data'
292
+ raise FontError('truncated font data')
293
293
  sfntvers, numTables = struct.unpack(OpenType.SFNT_UNPACK, data[:sfntsize])[:2]
294
294
  if sfntvers != OpenType.SFNT_CFF and sfntvers != OpenType.SFNT_TRUE:
295
- raise FontError, 'invalid font type';
295
+ raise FontError('invalid font type')
296
296
 
297
297
  font = {}
298
298
  font['version'] = sfntvers
@@ -301,7 +301,7 @@ def get_table_directory(data):
301
301
  # create set of offsets, lengths for tables
302
302
  table_dir_size = struct.calcsize(OpenType.TABLE_DIR_UNPACK)
303
303
  if sfntsize + table_dir_size * numTables > datalen:
304
- raise FontError, 'truncated font data, table directory extends past end of data'
304
+ raise FontError('truncated font data, table directory extends past end of data')
305
305
  table_dir = {}
306
306
  for i in range(0, numTables):
307
307
  start = sfntsize + i * table_dir_size
@@ -321,7 +321,7 @@ def get_name_records(nametable):
321
321
  count, strOffset = struct.unpack('>2H', nametable[2:6])
322
322
  namerecsize = struct.calcsize(OpenType.NAME_RECORD_UNPACK)
323
323
  if count * namerecsize + headersize > len(nametable):
324
- raise FontError, 'names exceed size of name table'
324
+ raise FontError('names exceed size of name table')
325
325
  name['count'] = count
326
326
  name['strOffset'] = strOffset
327
327
 
@@ -363,7 +363,7 @@ def make_eot_name_headers(fontdata, nameTableDir):
363
363
  else:
364
364
  nameheaders.append(struct.pack('4x')) # len = 0, padding = 0
365
365
 
366
- return ''.join(nameheaders)
366
+ return b''.join(nameheaders)
367
367
 
368
368
  # just return a null-string (len = 0)
369
369
  def make_root_string():
@@ -381,7 +381,7 @@ def make_eot_header(fontdata):
381
381
  required = (OpenType.TABLE_HEAD, OpenType.TABLE_NAME, OpenType.TABLE_OS2)
382
382
  for table in required:
383
383
  if not (table in tableDir):
384
- raise FontError, 'missing required table ' + multicharval(table)
384
+ raise FontError('missing required table ' + multicharval(table))
385
385
 
386
386
  # read name strings
387
387
 
@@ -398,7 +398,7 @@ def make_eot_header(fontdata):
398
398
  os2size = struct.calcsize(OpenType.OS2_UNPACK)
399
399
 
400
400
  if os2size > os2Dir['length']:
401
- raise FontError, 'OS/2 table invalid length'
401
+ raise FontError('OS/2 table invalid length')
402
402
 
403
403
  os2fields = struct.unpack(OpenType.OS2_UNPACK, fontdata[os2offset : os2offset + os2size])
404
404
 
@@ -420,7 +420,7 @@ def make_eot_header(fontdata):
420
420
  headsize = struct.calcsize(OpenType.HEAD_UNPACK)
421
421
 
422
422
  if headsize > headDir['length']:
423
- raise FontError, 'head table invalid length'
423
+ raise FontError('head table invalid length')
424
424
 
425
425
  headfields = struct.unpack(OpenType.HEAD_UNPACK, fontdata[headoffset : headoffset + headsize])
426
426
  checkSumAdjustment = headfields[0]
@@ -435,11 +435,11 @@ def make_eot_header(fontdata):
435
435
  *([eotSize, fontDataSize, version, flags] + panose + [charset, italic] +
436
436
  [weight, fsType, magicNumber] + urange + codepage + [checkSumAdjustment]))
437
437
 
438
- return ''.join((fixed, nameheaders, rootstring))
438
+ return b''.join((fixed, nameheaders, rootstring))
439
439
 
440
440
 
441
441
  def write_eot_font(eot, header, data):
442
- open(eot,'wb').write(''.join((header, data)))
442
+ open(eot,'wb').write(b''.join((header, data)))
443
443
  return
444
444
 
445
445
  def main():
@@ -453,7 +453,7 @@ def main():
453
453
  for f in args:
454
454
  data = readfont(f)
455
455
  if len(data) == 0:
456
- print 'Error reading %s' % f
456
+ print('Error reading %s' % f)
457
457
  else:
458
458
  eot = eotname(f)
459
459
  header = make_eot_header(data)
@@ -463,4 +463,4 @@ def main():
463
463
  if __name__ == '__main__':
464
464
  main()
465
465
 
466
-
466
+
@@ -39,6 +39,7 @@ font.descent = options['font_descent']
39
39
  font.fontname = options['font_name']
40
40
  font.familyname = options['font_name']
41
41
  font.fullname = options['font_name']
42
+ font.copyright = options['copyright']
42
43
  if options['autowidth']:
43
44
  font.autoWidth(0, 0, options['font_em'])
44
45
 
@@ -53,7 +54,7 @@ def removeSwitchFromSvg( file ):
53
54
  tmpsvgfile = tempfile.NamedTemporaryFile(suffix=".svg", delete=False)
54
55
  svgtext = svgtext.replace('<switch>', '')
55
56
  svgtext = svgtext.replace('</switch>', '')
56
- tmpsvgfile.file.write(svgtext)
57
+ tmpsvgfile.file.write(svgtext.encode('utf-8'))
57
58
  tmpsvgfile.file.close()
58
59
 
59
60
  return tmpsvgfile.name
@@ -63,7 +64,7 @@ def createGlyph( name, source, code ):
63
64
 
64
65
  if ext == '.svg':
65
66
  temp = removeSwitchFromSvg(source)
66
- glyph = font.createChar(code)
67
+ glyph = font.createChar(code, name)
67
68
  glyph.importOutlines(temp)
68
69
  os.unlink(temp)
69
70
 
@@ -83,7 +84,7 @@ def createGlyph( name, source, code ):
83
84
  glyph = font.createChar(32)
84
85
  glyph.width = 200
85
86
 
86
- for glyph, data in manifest['glyphs'].iteritems():
87
+ for glyph, data in manifest['glyphs'].items():
87
88
  name = createGlyph(glyph, data['source'], data['codepoint'])
88
89
 
89
90
  #
@@ -112,7 +113,11 @@ try:
112
113
  # Convert WOFF
113
114
  scriptPath = os.path.dirname(os.path.realpath(__file__))
114
115
  try:
115
- subprocess.Popen([scriptPath + '/sfnt2woff', fontfile + '.ttf'], stdout=subprocess.PIPE)
116
+ # check if on windows
117
+ if os.name == 'nt':
118
+ subprocess.Popen([scriptPath + '/sfnt2woff.exe', fontfile + '.ttf'], stdout=subprocess.PIPE)
119
+ else:
120
+ subprocess.Popen([scriptPath + '/sfnt2woff', fontfile + '.ttf'], stdout=subprocess.PIPE)
116
121
  except OSError:
117
122
  # If the local version of sfnt2woff fails (i.e., on Linux), try to use the
118
123
  # global version. This allows us to avoid forcing OS X users to compile
@@ -122,9 +127,17 @@ try:
122
127
 
123
128
  # Convert EOT for IE7
124
129
  subprocess.call('python ' + scriptPath + '/eotlitetool.py ' + fontfile + '.ttf -o ' + fontfile + '.eot', shell=True)
125
- subprocess.call('mv ' + fontfile + '.eotlite ' + fontfile + '.eot', shell=True)
130
+ # check if windows
131
+ if os.name == 'nt':
132
+ subprocess.call('move ' + fontfile + '.eotlite ' + fontfile + '.eot', shell=True)
133
+ else:
134
+ subprocess.call('mv ' + fontfile + '.eotlite ' + fontfile + '.eot', shell=True)
126
135
  manifest['fonts'].append(fontfile + '.eot')
127
136
 
137
+ # Convert TTF to WOFF2
138
+ subprocess.call('woff2_compress \'' + fontfile + '.ttf\'', shell=True)
139
+ manifest['fonts'].append(fontfile + '.woff2')
140
+
128
141
  finally:
129
142
  manifestfile.seek(0)
130
143
  manifestfile.write(json.dumps(manifest, indent=2, sort_keys=True))
@@ -4,9 +4,9 @@
4
4
 
5
5
  <%= font_face(url: "font-url", path: @font_path_alt) %>
6
6
 
7
- [data-icon]:before { content: attr(data-icon); }
7
+ [data-icon]<%= pseudo_element %> { content: attr(data-icon); }
8
8
 
9
- [data-icon]:before,
9
+ [data-icon]<%= pseudo_element %>,
10
10
  <%= glyph_selectors %> {
11
11
  <%= glyph_properties %>
12
12
  }
@@ -4,9 +4,9 @@
4
4
 
5
5
  <%= font_face(path: @font_path_alt) %>
6
6
 
7
- [data-icon]:before { content: attr(data-icon); }
7
+ [data-icon]<%= pseudo_element %> { content: attr(data-icon); }
8
8
 
9
- [data-icon]:before,
9
+ [data-icon]<%= pseudo_element %>,
10
10
  <%= glyph_selectors %> {
11
11
  <%= glyph_properties %>
12
12
  }
@@ -4,9 +4,9 @@
4
4
 
5
5
  <%= font_face %>
6
6
 
7
- [data-icon]:before { content: attr(data-icon); }
7
+ [data-icon]<%= pseudo_element %> { content: attr(data-icon); }
8
8
 
9
- [data-icon]:before,
9
+ [data-icon]<%= pseudo_element %>,
10
10
  <%= glyph_selectors %> {
11
11
  <%= glyph_properties %>
12
12
  }
@@ -30,6 +30,9 @@
30
30
  # Hide status messages.
31
31
  #quiet: true
32
32
 
33
+ # Copyright information.
34
+ #copyright:
35
+
33
36
 
34
37
  # -----------------------------------------------------------------------------
35
38
  # Input / Output Locations
@@ -1,3 +1,3 @@
1
1
  module Fontcustom
2
- VERSION = "1.3.8"
2
+ VERSION = "2.0.0"
3
3
  end
@@ -39,7 +39,7 @@ module Fontcustom
39
39
  else
40
40
  listen_options[:filter] = /(#{templates.join("|")}|.+\.svg)$/
41
41
  listen_options[:relative_paths] = true
42
- @listener = Listen::Listener.new(listen_dirs, listen_options, &callback)
42
+ @listener = Listen::Listener.new(*listen_dirs, listen_options, &callback)
43
43
  end
44
44
  end
45
45
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fontcustom
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.8
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kai Zau
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-02-02 00:00:00.000000000 Z
12
+ date: 2017-06-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -48,7 +48,7 @@ dependencies:
48
48
  version: '1.0'
49
49
  - - "<"
50
50
  - !ruby/object:Gem::Version
51
- version: '3.0'
51
+ version: '4.0'
52
52
  type: :runtime
53
53
  prerelease: false
54
54
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,21 +58,21 @@ dependencies:
58
58
  version: '1.0'
59
59
  - - "<"
60
60
  - !ruby/object:Gem::Version
61
- version: '3.0'
61
+ version: '4.0'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: rake
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '10'
69
69
  type: :development
70
70
  prerelease: false
71
71
  version_requirements: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: '10'
76
76
  - !ruby/object:Gem::Dependency
77
77
  name: bundler
78
78
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +122,7 @@ files:
122
122
  - bin/fontcustom
123
123
  - fontcustom.gemspec
124
124
  - gemfiles/Gemfile.listen_1
125
+ - gemfiles/Gemfile.listen_2
125
126
  - lib/fontcustom.rb
126
127
  - lib/fontcustom/base.rb
127
128
  - lib/fontcustom/cli.rb
@@ -133,6 +134,7 @@ files:
133
134
  - lib/fontcustom/scripts/eotlitetool.py
134
135
  - lib/fontcustom/scripts/generate.py
135
136
  - lib/fontcustom/scripts/sfnt2woff
137
+ - lib/fontcustom/scripts/sfnt2woff.exe
136
138
  - lib/fontcustom/templates/_fontcustom-rails.scss
137
139
  - lib/fontcustom/templates/_fontcustom.scss
138
140
  - lib/fontcustom/templates/fontcustom-preview.html
@@ -203,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
203
205
  version: '0'
204
206
  requirements: []
205
207
  rubyforge_project:
206
- rubygems_version: 2.4.5
208
+ rubygems_version: 2.6.11
207
209
  signing_key:
208
210
  specification_version: 4
209
211
  summary: Generate icon fonts from the command line.