fontcustom 0.1.4 → 1.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/CHANGELOG.md +14 -0
  2. data/CONTRIBUTING.md +15 -8
  3. data/Rakefile +4 -6
  4. data/bin/fontcustom +1 -1
  5. data/fontcustom.gemspec +2 -7
  6. data/lib/fontcustom.rb +6 -21
  7. data/lib/fontcustom/cli.rb +46 -18
  8. data/lib/fontcustom/error.rb +4 -0
  9. data/lib/fontcustom/generator/font.rb +101 -0
  10. data/lib/fontcustom/generator/template.rb +80 -0
  11. data/lib/fontcustom/options.rb +20 -0
  12. data/lib/fontcustom/scripts/generate.py +22 -6
  13. data/lib/fontcustom/templates/_fontcustom.scss +72 -0
  14. data/lib/fontcustom/templates/fontcustom-ie7.css +10 -10
  15. data/lib/fontcustom/templates/fontcustom.css +19 -19
  16. data/lib/fontcustom/templates/fontcustom.html +119 -0
  17. data/lib/fontcustom/templates/fontcustom.yml +23 -0
  18. data/lib/fontcustom/util.rb +89 -0
  19. data/lib/fontcustom/version.rb +1 -1
  20. data/lib/fontcustom/watcher.rb +50 -25
  21. data/spec/fixtures/empty-data/.fontcustom-data +0 -0
  22. data/spec/fixtures/fontcustom.yml +1 -0
  23. data/spec/fixtures/mixed-output/.fontcustom-data +17 -0
  24. data/spec/fixtures/mixed-output/another-font.ttf +0 -0
  25. data/spec/fixtures/mixed-output/dont-delete-me.bro +0 -0
  26. data/spec/fixtures/mixed-output/fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.eot +0 -0
  27. data/spec/fixtures/mixed-output/fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.svg +102 -0
  28. data/spec/fixtures/mixed-output/fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.ttf +0 -0
  29. data/spec/fixtures/mixed-output/fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.woff +0 -0
  30. data/spec/fixtures/mixed-output/fontcustom.css +108 -0
  31. data/spec/fixtures/not-a-dir +0 -0
  32. data/spec/fontcustom/generator/font_spec.rb +183 -0
  33. data/spec/fontcustom/generator/template_spec.rb +106 -0
  34. data/spec/fontcustom/util_spec.rb +109 -0
  35. data/spec/fontcustom/watcher_spec.rb +68 -0
  36. data/spec/spec_helper.rb +32 -22
  37. metadata +47 -100
  38. data/lib/fontcustom/generator.rb +0 -105
  39. data/lib/fontcustom/templates/test.html +0 -100
  40. data/spec/fontcustom/fontcustom_spec.rb +0 -42
  41. data/spec/fontcustom/generator_spec.rb +0 -75
  42. data/spec/fontcustom/watcher_spec.rb.off +0 -34
@@ -0,0 +1,109 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fontcustom::Util do
4
+ def util
5
+ Fontcustom::Util
6
+ end
7
+
8
+ context ".check_fontforge" do
9
+ it "should raise error if fontforge isn't installed" do
10
+ util.stub(:"`").and_return("")
11
+ expect { util.check_fontforge }.to raise_error Fontcustom::Error, /install fontforge/
12
+ end
13
+ end
14
+
15
+ context ".collect_options" do
16
+ it "should return defaults when called without arguments" do
17
+ options = util.collect_options
18
+ defaults = Fontcustom::DEFAULT_OPTIONS.dup
19
+
20
+ # ignore :templates and :output since they're generated
21
+ options.delete(:templates)
22
+ defaults.delete(:templates)
23
+ options.delete(:output)
24
+ defaults.delete(:output)
25
+
26
+ options.should == defaults
27
+ end
28
+
29
+ it "should overwrite defaults with config file" do
30
+ options = util.collect_options :config => fixture("fontcustom.yml")
31
+ options[:font_name].should == "custom-name-from-config"
32
+ end
33
+
34
+ it "should overwrite config file and defaults with CLI options" do
35
+ options = util.collect_options :config => fixture("fontcustom.yml"), :font_name => "custom-name-from-cli"
36
+ options[:font_name].should == "custom-name-from-cli"
37
+ end
38
+
39
+ it "should normalize file name" do
40
+ options = util.collect_options :font_name => " A_stR4nG3 nAm3 "
41
+ options[:font_name].should == "a_str4ng3-nam3"
42
+ end
43
+ end
44
+
45
+ context ".get_config_path" do
46
+ it "should search for fontcustom.yml if options[:config] is a dir" do
47
+ options = { :config => fixture("") }
48
+ util.get_config_path(options).should == fixture("fontcustom.yml")
49
+ end
50
+
51
+ it "should search use options[:config] if it's a file" do
52
+ options = { :config => fixture("fontcustom.yml") }
53
+ util.get_config_path(options).should == fixture("fontcustom.yml")
54
+ end
55
+
56
+ it "should search in input dir if no options[:config] is given" do
57
+ options = { :input => fixture("") }
58
+ util.get_config_path(options).should == fixture("fontcustom.yml")
59
+ end
60
+
61
+ it "should return false if neither exist" do
62
+ options = { :input => fixture("vectors") }
63
+ util.get_config_path(options).should be_false
64
+ end
65
+ end
66
+
67
+ context ".get_template_paths" do
68
+ it "should ensure that 'css' is included with 'preview'" do
69
+ lib = util.gem_lib_path
70
+ options = { :input => fixture("vectors"), :templates => %W|preview| }
71
+ templates = util.get_template_paths options
72
+ templates.should =~ [
73
+ File.join(lib, "templates", "fontcustom.css"),
74
+ File.join(lib, "templates", "fontcustom.html")
75
+ ]
76
+ end
77
+
78
+ it "should expand shorthand for packaged templates" do
79
+ lib = util.gem_lib_path
80
+ options = { :input => fixture("vectors"), :templates => %W|css scss preview| }
81
+ templates = util.get_template_paths options
82
+ templates.should =~ [
83
+ File.join(lib, "templates", "fontcustom.css"),
84
+ File.join(lib, "templates", "_fontcustom.scss"),
85
+ File.join(lib, "templates", "fontcustom.html")
86
+ ]
87
+ end
88
+
89
+ it "should search in Dir.pwd first" do
90
+ Dir.chdir fixture("")
91
+ options = { :templates => %W|not-a-dir| }
92
+ templates = util.get_template_paths options
93
+ templates.should =~ ["not-a-dir"]
94
+ end
95
+
96
+ it "should search in options[:input] second" do
97
+ options = { :input => fixture("empty"), :templates => %W|no_vectors_here.txt| }
98
+ templates = util.get_template_paths options
99
+ templates.should =~ [fixture("empty/no_vectors_here.txt")]
100
+ end
101
+
102
+ it "should raise an error if a template does not exist" do
103
+ options = { :input => fixture("vectors"), :templates => %W|css #{fixture("fake-template")}| }
104
+ expect { util.get_template_paths options }.to raise_error(
105
+ Fontcustom::Error, /couldn't find.+#{fixture("fake-template")}/
106
+ )
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,68 @@
1
+ require "spec_helper"
2
+ require "fileutils"
3
+ require "fontcustom/watcher"
4
+
5
+ describe Fontcustom::Watcher do
6
+ def watcher(options)
7
+ Fontcustom::Generator::Font.stub :start
8
+ Fontcustom::Generator::Template.stub :start
9
+ opts = Fontcustom::Util.collect_options options
10
+ opts[:blocking] = false # undocumented — non-blocking use of watcher
11
+ Fontcustom::Watcher.new opts
12
+ end
13
+
14
+ context "#watch" do
15
+ it "should call generators on init" do
16
+ Fontcustom::Generator::Font.should_receive(:start).once
17
+ Fontcustom::Generator::Template.should_receive(:start).once
18
+ w = watcher :input => fixture("vectors"), :output => fixture("watcher-test")
19
+ # silence output
20
+ capture(:stdout) do
21
+ w.watch
22
+ w.stop
23
+ end
24
+ end
25
+
26
+ it "should not call generators on init if options[:skip_first] is passed" do
27
+ Fontcustom::Generator::Font.should_not_receive(:start)
28
+ Fontcustom::Generator::Template.should_not_receive(:start)
29
+ w = watcher :input => fixture("vectors"), :output => fixture("watcher-test"), :skip_first => true
30
+ capture(:stdout) do
31
+ w.watch
32
+ w.stop
33
+ end
34
+ end
35
+
36
+ it "should call generators when vectors change" do
37
+ Fontcustom::Generator::Font.should_receive(:start).once
38
+ Fontcustom::Generator::Template.should_receive(:start).once
39
+ w = watcher :input => fixture("vectors"), :output => fixture("watcher-test"), :skip_first => true
40
+ capture(:stdout) do
41
+ begin
42
+ w.watch
43
+ FileUtils.cp fixture("vectors/C.svg"), fixture("vectors/test.svg")
44
+ ensure
45
+ w.stop
46
+ new = fixture("vectors/test.svg")
47
+ FileUtils.rm(new) if File.exists?(new)
48
+ end
49
+ end
50
+ end
51
+
52
+ it "should do nothing when non-vectors change" do
53
+ Fontcustom::Generator::Font.should_not_receive(:start)
54
+ Fontcustom::Generator::Template.should_not_receive(:start)
55
+ w = watcher :input => fixture("vectors"), :output => fixture("watcher-test"), :skip_first => true
56
+ capture(:stdout) do
57
+ begin
58
+ w.watch
59
+ FileUtils.touch fixture("vectors/non-vector-file")
60
+ ensure
61
+ w.stop
62
+ new = fixture("vectors/non-vector-file")
63
+ FileUtils.rm(new) if File.exists?(new)
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,29 +1,39 @@
1
- require 'spork'
1
+ require 'rspec'
2
+ require 'json'
3
+ require File.expand_path('../../lib/fontcustom.rb', __FILE__)
2
4
 
3
- Spork.prefork do
4
- require 'rspec'
5
- require 'fileutils'
5
+ RSpec.configure do |c|
6
+ def fixture(path)
7
+ File.join(File.expand_path('../fixtures', __FILE__), path)
8
+ end
6
9
 
7
- RSpec.configure do |c|
8
- def cleanup(dir)
9
- FileUtils.rm_r(dir, :verbose => true) if File.exists?(dir)
10
- end
10
+ def data_file_contents
11
+ {
12
+ :fonts => %w|
13
+ fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.woff
14
+ fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.ttf
15
+ fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.eot
16
+ fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.svg
17
+ |,
18
+ :templates => %w|fontcustom.css|,
19
+ :file_name => "fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e",
20
+ :glyphs => %w|a_r3ally-exotic-f1le-name c d|
21
+ }
22
+ end
11
23
 
12
- def capture(stream)
13
- begin
14
- stream = stream.to_s
15
- eval "$#{stream} = StringIO.new"
16
- yield
17
- result = eval("$#{stream}").string
18
- ensure
19
- eval("$#{stream} = #{stream.upcase}")
20
- end
24
+ def fontforge_output
25
+ "Copyright (c) 2000-2012 by George Williams.\n Executable based on sources from 14:57 GMT 31-Jul-2012-D.\n Library based on sources from 14:57 GMT 31-Jul-2012.\n#{data_file_contents.to_json}"
26
+ end
21
27
 
22
- result
28
+ def capture(stream)
29
+ begin
30
+ stream = stream.to_s
31
+ eval "$#{stream} = StringIO.new"
32
+ yield
33
+ result = eval("$#{stream}").string
34
+ ensure
35
+ eval("$#{stream} = #{stream.upcase}")
23
36
  end
37
+ result
24
38
  end
25
39
  end
26
-
27
- Spork.each_run do
28
- require File.expand_path('../../lib/fontcustom.rb', __FILE__)
29
- end
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fontcustom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
5
- prerelease:
4
+ version: 1.0.0.pre
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Yifei Zhang
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-02-19 00:00:00.000000000 Z
13
+ date: 2013-04-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json
@@ -108,88 +108,8 @@ dependencies:
108
108
  - - ! '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: fakefs
113
- requirement: !ruby/object:Gem::Requirement
114
- none: false
115
- requirements:
116
- - - ! '>='
117
- - !ruby/object:Gem::Version
118
- version: '0'
119
- type: :development
120
- prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- none: false
123
- requirements:
124
- - - ! '>='
125
- - !ruby/object:Gem::Version
126
- version: '0'
127
- - !ruby/object:Gem::Dependency
128
- name: spork
129
- requirement: !ruby/object:Gem::Requirement
130
- none: false
131
- requirements:
132
- - - ! '>='
133
- - !ruby/object:Gem::Version
134
- version: '0'
135
- type: :development
136
- prerelease: false
137
- version_requirements: !ruby/object:Gem::Requirement
138
- none: false
139
- requirements:
140
- - - ! '>='
141
- - !ruby/object:Gem::Version
142
- version: '0'
143
- - !ruby/object:Gem::Dependency
144
- name: guard-spork
145
- requirement: !ruby/object:Gem::Requirement
146
- none: false
147
- requirements:
148
- - - ! '>='
149
- - !ruby/object:Gem::Version
150
- version: '0'
151
- type: :development
152
- prerelease: false
153
- version_requirements: !ruby/object:Gem::Requirement
154
- none: false
155
- requirements:
156
- - - ! '>='
157
- - !ruby/object:Gem::Version
158
- version: '0'
159
- - !ruby/object:Gem::Dependency
160
- name: guard-rspec
161
- requirement: !ruby/object:Gem::Requirement
162
- none: false
163
- requirements:
164
- - - ! '>='
165
- - !ruby/object:Gem::Version
166
- version: '0'
167
- type: :development
168
- prerelease: false
169
- version_requirements: !ruby/object:Gem::Requirement
170
- none: false
171
- requirements:
172
- - - ! '>='
173
- - !ruby/object:Gem::Version
174
- version: '0'
175
- - !ruby/object:Gem::Dependency
176
- name: rb-fsevent
177
- requirement: !ruby/object:Gem::Requirement
178
- none: false
179
- requirements:
180
- - - ~>
181
- - !ruby/object:Gem::Version
182
- version: 0.9.1
183
- type: :development
184
- prerelease: false
185
- version_requirements: !ruby/object:Gem::Requirement
186
- none: false
187
- requirements:
188
- - - ~>
189
- - !ruby/object:Gem::Version
190
- version: 0.9.1
191
- description: Transforms EPS and SVG vectors into icon webfonts. Generates Bootstrap
192
- compatible CSS for easy inclusion in your projects.
111
+ description: Transforms EPS and SVG vectors into icon webfonts. Generates CSS (or
112
+ your preferred alternative) for easy inclusion in your projects.
193
113
  email:
194
114
  - yz@yifei.co
195
115
  - joshua@gross.is
@@ -210,24 +130,42 @@ files:
210
130
  - fontcustom.gemspec
211
131
  - lib/fontcustom.rb
212
132
  - lib/fontcustom/cli.rb
213
- - lib/fontcustom/generator.rb
133
+ - lib/fontcustom/error.rb
134
+ - lib/fontcustom/generator/font.rb
135
+ - lib/fontcustom/generator/template.rb
136
+ - lib/fontcustom/options.rb
214
137
  - lib/fontcustom/scripts/eotlitetool.py
215
138
  - lib/fontcustom/scripts/generate.py
216
139
  - lib/fontcustom/scripts/sfnt2woff
140
+ - lib/fontcustom/templates/_fontcustom.scss
217
141
  - lib/fontcustom/templates/fontcustom-ie7.css
218
142
  - lib/fontcustom/templates/fontcustom.css
219
- - lib/fontcustom/templates/test.html
143
+ - lib/fontcustom/templates/fontcustom.html
144
+ - lib/fontcustom/templates/fontcustom.yml
145
+ - lib/fontcustom/util.rb
220
146
  - lib/fontcustom/version.rb
221
147
  - lib/fontcustom/watcher.rb
148
+ - spec/fixtures/empty-data/.fontcustom-data
222
149
  - spec/fixtures/empty/no_vectors_here.txt
150
+ - spec/fixtures/fontcustom.yml
151
+ - spec/fixtures/mixed-output/.fontcustom-data
152
+ - spec/fixtures/mixed-output/another-font.ttf
153
+ - spec/fixtures/mixed-output/dont-delete-me.bro
154
+ - spec/fixtures/mixed-output/fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.eot
155
+ - spec/fixtures/mixed-output/fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.svg
156
+ - spec/fixtures/mixed-output/fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.ttf
157
+ - spec/fixtures/mixed-output/fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.woff
158
+ - spec/fixtures/mixed-output/fontcustom.css
159
+ - spec/fixtures/not-a-dir
223
160
  - spec/fixtures/vectors/C.svg
224
161
  - spec/fixtures/vectors/D.svg
225
162
  - spec/fixtures/vectors/a_R3ally-eXotic f1Le Name.svg
226
- - spec/fontcustom/fontcustom_spec.rb
227
- - spec/fontcustom/generator_spec.rb
228
- - spec/fontcustom/watcher_spec.rb.off
163
+ - spec/fontcustom/generator/font_spec.rb
164
+ - spec/fontcustom/generator/template_spec.rb
165
+ - spec/fontcustom/util_spec.rb
166
+ - spec/fontcustom/watcher_spec.rb
229
167
  - spec/spec_helper.rb
230
- homepage: http://endtwist.github.com/fontcustom/
168
+ homepage: http://fontcustom.com
231
169
  licenses: []
232
170
  post_install_message:
233
171
  rdoc_options: []
@@ -241,16 +179,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
241
179
  version: '0'
242
180
  segments:
243
181
  - 0
244
- hash: 2717137854162198806
182
+ hash: -3519366396623315767
245
183
  required_rubygems_version: !ruby/object:Gem::Requirement
246
184
  none: false
247
185
  requirements:
248
- - - ! '>='
186
+ - - ! '>'
249
187
  - !ruby/object:Gem::Version
250
- version: '0'
251
- segments:
252
- - 0
253
- hash: 2717137854162198806
188
+ version: 1.3.1
254
189
  requirements: []
255
190
  rubyforge_project:
256
191
  rubygems_version: 1.8.24
@@ -258,11 +193,23 @@ signing_key:
258
193
  specification_version: 3
259
194
  summary: Generate custom icon webfonts from the comfort of the command line.
260
195
  test_files:
196
+ - spec/fixtures/empty-data/.fontcustom-data
261
197
  - spec/fixtures/empty/no_vectors_here.txt
198
+ - spec/fixtures/fontcustom.yml
199
+ - spec/fixtures/mixed-output/.fontcustom-data
200
+ - spec/fixtures/mixed-output/another-font.ttf
201
+ - spec/fixtures/mixed-output/dont-delete-me.bro
202
+ - spec/fixtures/mixed-output/fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.eot
203
+ - spec/fixtures/mixed-output/fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.svg
204
+ - spec/fixtures/mixed-output/fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.ttf
205
+ - spec/fixtures/mixed-output/fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.woff
206
+ - spec/fixtures/mixed-output/fontcustom.css
207
+ - spec/fixtures/not-a-dir
262
208
  - spec/fixtures/vectors/C.svg
263
209
  - spec/fixtures/vectors/D.svg
264
210
  - spec/fixtures/vectors/a_R3ally-eXotic f1Le Name.svg
265
- - spec/fontcustom/fontcustom_spec.rb
266
- - spec/fontcustom/generator_spec.rb
267
- - spec/fontcustom/watcher_spec.rb.off
211
+ - spec/fontcustom/generator/font_spec.rb
212
+ - spec/fontcustom/generator/template_spec.rb
213
+ - spec/fontcustom/util_spec.rb
214
+ - spec/fontcustom/watcher_spec.rb
268
215
  - spec/spec_helper.rb
@@ -1,105 +0,0 @@
1
- require 'json'
2
- require 'thor/group'
3
-
4
- module Fontcustom
5
- class Generator < Thor::Group
6
- include Thor::Actions
7
-
8
- desc 'Generates webfonts from given directory of vectors.'
9
-
10
- argument :input, :type => :string
11
- class_option :output, :aliases => '-o'
12
- class_option :name, :aliases => '-n'
13
- class_option :font_path, :aliases => '-f'
14
- class_option :nohash, :type => :boolean, :default => false
15
- class_option :debug, :type => :boolean, :default => false
16
- class_option :html, :type => :boolean, :default => false
17
-
18
- def self.source_root
19
- File.dirname(__FILE__)
20
- end
21
-
22
- def verify_fontforge
23
- if `which fontforge` == ''
24
- raise Thor::Error, 'Please install fontforge first.'
25
- end
26
- end
27
-
28
- def verify_input_dir
29
- if ! File.directory?(input)
30
- raise Thor::Error, "#{input} doesn't exist or isn't a directory."
31
- elsif Dir[File.join(input, '*.{svg,eps}')].empty?
32
- raise Thor::Error, "#{input} doesn't contain any vectors (*.svg or *.eps files)."
33
- end
34
- end
35
-
36
- def verify_or_create_output_dir
37
- @output = options.output.nil? ? File.join(File.dirname(input), 'fontcustom') : options.output
38
- empty_directory(@output) unless File.directory?(@output)
39
- end
40
-
41
- def normalize_name
42
- @name = if options.name
43
- options.name.gsub(/\W/, '-').downcase
44
- else
45
- 'fontcustom'
46
- end
47
- end
48
-
49
- def cleanup_output_dir
50
- css = File.join(@output, 'fontcustom.css')
51
- css_ie7 = File.join(@output, 'fontcustom-ie7.css')
52
- test_html = File.join(@output, 'test.html')
53
- old_name = if File.exists? css
54
- line = IO.readlines(css)[5] # font-family: "Example Font";
55
- line.scan(/".+"/)[0][1..-2].gsub(/\W/, '-').downcase # => 'example-font'
56
- else
57
- 'fontcustom'
58
- end
59
-
60
- old_files = Dir[File.join(@output, old_name + '-*.{woff,ttf,eot,svg}')]
61
- old_files << css if File.exists?(css)
62
- old_files << css_ie7 if File.exists?(css_ie7)
63
- old_files << test_html if File.exists?(test_html)
64
- old_files.each {|file| remove_file file }
65
- end
66
-
67
- def generate
68
- gem_file_path = File.expand_path(File.join(File.dirname(__FILE__)))
69
- name = options.name ? ' --name ' + @name : ''
70
- nohash = options.nohash ? ' --nohash' : ''
71
-
72
- # suppress fontforge message
73
- # TODO get font name and classes from script (without showing fontforge message)
74
- cmd = "fontforge -script #{gem_file_path}/scripts/generate.py #{input} #{@output + name + nohash}"
75
- unless options.debug
76
- cmd += " > /dev/null 2>&1"
77
- end
78
- `#{cmd}`
79
- end
80
-
81
- def show_paths
82
- file = Dir[File.join(@output, @name + '*.ttf')].first
83
- @path = file.chomp('.ttf')
84
-
85
- ['woff','ttf','eot','svg'].each do |type|
86
- say_status(:create, @path + '.' + type)
87
- end
88
- end
89
-
90
- def create_stylesheet
91
- files = Dir[File.join(input, '*.{svg,eps}')]
92
- @classes = files.map {|file| File.basename(file)[0..-5].gsub(/\W/, '-').downcase }
93
- if(!options.font_path.nil?)
94
- font_path = (options.font_path) ? options.font_path : ''
95
- @path = File.join(font_path, File.basename(@path))
96
- else
97
- @path = File.basename(@path)
98
- end
99
-
100
- template('templates/fontcustom.css', File.join(@output, 'fontcustom.css'))
101
- template('templates/fontcustom-ie7.css', File.join(@output, 'fontcustom-ie7.css'))
102
- template('templates/test.html', File.join(@output, 'test.html')) if options.html
103
- end
104
- end
105
- end