fontcustom 1.0.0.pre → 1.0.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. data/CHANGELOG.md +11 -3
  2. data/CONTRIBUTING.md +4 -3
  3. data/README.md +24 -14
  4. data/fontcustom.gemspec +1 -1
  5. data/lib/fontcustom.rb +15 -0
  6. data/lib/fontcustom/cli.rb +2 -1
  7. data/lib/fontcustom/options.rb +1 -0
  8. data/lib/fontcustom/scripts/generate.py +1 -1
  9. data/lib/fontcustom/templates/{fontcustom-ie7.css → _fontcustom-bootstrap-ie7.scss} +4 -1
  10. data/lib/fontcustom/templates/_fontcustom-bootstrap.scss +68 -0
  11. data/lib/fontcustom/templates/_fontcustom.scss +20 -58
  12. data/lib/fontcustom/templates/fontcustom-bootstrap-ie7.css +21 -0
  13. data/lib/fontcustom/templates/fontcustom-bootstrap.css +62 -0
  14. data/lib/fontcustom/templates/{fontcustom.html → fontcustom-preview.html} +0 -0
  15. data/lib/fontcustom/templates/fontcustom.css +10 -54
  16. data/lib/fontcustom/templates/fontcustom.yml +64 -7
  17. data/lib/fontcustom/util.rb +9 -3
  18. data/lib/fontcustom/version.rb +1 -1
  19. data/spec/fixtures/mixed-output/.fontcustom-data +5 -5
  20. data/spec/fixtures/mixed-output/fontcustom.css +4 -4
  21. data/spec/fixtures/mixed-output/{fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.eot → fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.eot} +0 -0
  22. data/spec/fixtures/mixed-output/{fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.svg → fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.svg} +0 -0
  23. data/spec/fixtures/mixed-output/{fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.ttf → fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.ttf} +0 -0
  24. data/spec/fixtures/mixed-output/{fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.woff → fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.woff} +0 -0
  25. data/spec/fontcustom/generator/font_spec.rb +6 -6
  26. data/spec/fontcustom/generator/template_spec.rb +1 -1
  27. data/spec/fontcustom/util_spec.rb +7 -3
  28. data/spec/spec_helper.rb +5 -5
  29. metadata +17 -15
  30. data/Guardfile +0 -15
@@ -1,4 +1,6 @@
1
- ## 1.0.0-RC1 (4/4/2013)
1
+ ## 1.0.0 (4/18/2013)
2
+
3
+ Big changes, more flexibility, better workflow. Be sure to check out the [docs](http://fontcustom.com) to see how it all ties together.
2
4
 
3
5
  * Improved preview html to show glyphs at various sizes
4
6
  * Added support for fontcustom.yml config file ([#49](https://github.com/FontCustom/fontcustom/issues/49))
@@ -7,9 +9,15 @@
7
9
  * Added support for custom CSS selector namespaces ([#32](https://github.com/FontCustom/fontcustom/issues/32))
8
10
  * Added support for --verbose=false ([#54](https://github.com/FontCustom/fontcustom/pull/54))
9
11
  * Improved ascent/decent heights ([#33](https://github.com/FontCustom/fontcustom/issues/33))
10
- * Fixed bug where watcher could fall into an infinite loop
12
+ * Added clean Ruby API ([#62](https://github.com/FontCustom/fontcustom/issues/62))
13
+ * Workaround for Sprockets compatibility ([#61](https://github.com/FontCustom/fontcustom/pull/61))
14
+ * Added clean (bootstrap free) CSS and made it the default choice ([#59](https://github.com/FontCustom/fontcustom/pull/59))
15
+ * Added option to pass different path to @font-face for SCSS partials ([#64](https://github.com/FontCustom/fontcustom/issues/64))
16
+ * Addes SCSS versions of Bootstrap and IE7 stylesheets
17
+ * Fixed CSS bug on IE8 and IE9's compatibility mode
18
+ * Fixed gem bug where watcher could fall into an infinite loop
11
19
  * Added error messages for faulty input
12
- * Refactored gem internals to reflect saner usage of Thor
20
+ * Refactored gem internals to use Thor more sanely
13
21
  * Refactored tests
14
22
 
15
23
  ## 0.1.4 (2/19/2013)
@@ -1,6 +1,6 @@
1
- # FontCustom Contributing Guidelines
1
+ # Contributor Guidelines
2
2
 
3
- Thanks for helping make FontCustom better! This project was born out of an over-heard conversation between two devs in a coffee shop — it's come a long ways thanks to the support of folks like you.
3
+ Thanks for helping make Font Custom better. This project was born out of an over-heard conversation between two devs in a coffee shop — it's come a long ways thanks to the support of folks like you.
4
4
 
5
5
  ## Conventions
6
6
 
@@ -12,7 +12,8 @@ If you catch a typo or a particularly unsightly piece of code — please _do_ le
12
12
 
13
13
  * Visit [issues](https://github.com/FontCustom/fontcustom/issues) for ideas.
14
14
  * Fork the repo if you haven't done so already.
15
+ * `master` == current stable release
15
16
  * Create a topic branch. `git checkout -b my_sweet_feature`
16
- * Add tests. Run tests with `rake`.
17
+ * Add your tests. Run tests with `rake`.
17
18
  * Develop your feature.
18
19
  * Once all tests are passing, submit a pull request!
data/README.md CHANGED
@@ -1,14 +1,14 @@
1
- FontCustom v0.1.3
2
- ==========
1
+ # FontCustom v0.1.4
2
+
3
+ **(v1.0.0 is currently in pre-release until docs are updated. Install the latest with `gem install fontcustom --pre`)**
3
4
 
4
5
  **Generate custom icon webfonts from the comfort of the command line.**
5
6
 
6
- [Full documentation](http://fontcustom.github.com/fontcustom/)<br/>
7
+ [Full documentation](http://fontcustom.com)<br/>
8
+ [Changelog](https://github.com/FontCustom/fontcustom/blob/master/CHANGELOG.md)<br/>
7
9
  [Feedback and issues](https://github.com/FontCustom/fontcustom/issues)
8
10
 
9
-
10
- Installation
11
- ------------
11
+ ## Installation
12
12
 
13
13
  ```sh
14
14
  # Requires FontForge
@@ -16,19 +16,29 @@ brew install fontforge eot-utils ttfautohint
16
16
  gem install fontcustom
17
17
  ```
18
18
 
19
-
20
- Usage
21
- -----
19
+ ## Quick Start
22
20
 
23
21
  ```sh
24
- fontcustom compile path/to/vectors # Compile icons and css to path/to/fontcustom/*
25
- fontcustom watch path/to/vectors # Watch for changes
22
+ fontcustom compile path/to/vectors # Compiles into `fontcustom`
23
+ fontcustom compile path/to/vectors -o assets/fonts # Compiles into `assets/fonts`
24
+ fontcustom watch path/to/vectors -t=scss preview # Compiles when vectors are changed/added/deleted
25
+ # and includes a scss partial and glyph preview
26
+
27
+ fontcustom help # to see all options
26
28
  ```
27
29
 
28
- Optional second parameter allows you to specify an output directory.
30
+ ## Config
29
31
 
30
- Need help?
32
+ To avoid finger-fatigue, include a fontcustom.yml configuration file with your vectors:
31
33
 
32
34
  ```sh
33
- fontcustom --help
35
+ fontcustom config path/to/vectors # Creates annotated config file
36
+ vim path/to/vectors/fontcustom.yml # Edit your fontcustom options
34
37
  ```
38
+
39
+ ---
40
+
41
+ [Contributor Guidelines](https://github.com/FontCustom/fontcustom/blob/master/CONTRIBUTING.md)<br/>
42
+ [Licenses](https://github.com/FontCustom/fontcustom/blob/master/LICENSES.txt)
43
+
44
+ Brought to you by [@endtwist](https://github.com/endtwist) and [@ezYZ](https://github.com/ezYZ)
@@ -9,7 +9,7 @@ Gem::Specification.new do |gem|
9
9
  gem.authors = ["Yifei Zhang", "Joshua Gross"]
10
10
  gem.email = ["yz@yifei.co", "joshua@gross.is"]
11
11
  gem.summary = %q{Generate custom icon webfonts from the comfort of the command line.}
12
- gem.description = %q{Transforms EPS and SVG vectors into icon webfonts. Generates CSS (or your preferred alternative) for easy inclusion in your projects.}
12
+ gem.description = %q{Transforms EPS and SVG vectors into icon webfonts. Generates CSS (or any custom template) for easy inclusion in your projects.}
13
13
  gem.homepage = "http://fontcustom.com"
14
14
 
15
15
  gem.files = `git ls-files`.split($/)
@@ -4,3 +4,18 @@ require "fontcustom/error"
4
4
  require "fontcustom/util"
5
5
  require "fontcustom/generator/font"
6
6
  require "fontcustom/generator/template"
7
+
8
+ module Fontcustom
9
+
10
+ ##
11
+ # Clean Ruby API to workaround Thor
12
+ def compile(options)
13
+ opts = Fontcustom::Util.collect_options options
14
+ Fontcustom::Generator::Font.start [opts]
15
+ Fontcustom::Generator::Template.start [opts]
16
+ rescue Fontcustom::Error => e
17
+ puts "ERROR: #{e.message}"
18
+ end
19
+
20
+ module_function :compile
21
+ end
@@ -10,10 +10,11 @@ module Fontcustom
10
10
  # Actual defaults are stored in Fontcustom::DEFAULT_OPTIONS instead of Thor
11
11
  class_option :output, :aliases => "-o", :desc => "The output directory (will be created if it doesn't exist). Default: INPUT/fontcustom/"
12
12
  class_option :config, :aliases => "-c", :desc => "Path to or containing directory of the config file. Default: INPUT/fontcustom.yml"
13
- class_option :templates, :aliases => "-t", :type => :array, :desc => "List of templates to compile alongside fonts. Accepts 'css', 'css-ie7', 'scss', 'preview' or arbitrary paths (relative to INPUT or PWD). Default: 'css preview'"
13
+ class_option :templates, :aliases => "-t", :type => :array, :desc => "List of templates to compile alongside fonts. Accepts 'preview css scss bootstrap bootstrap-scss bootstrap-ie7 bootstrap-ie7-scss' or arbitrary paths relative to INPUT or PWD. Default: 'css preview'"
14
14
  class_option :font_name, :aliases => "-n", :desc => "The font name used in your templates (automatically normalized to lowercase spinal case). Default: 'fontcustom'"
15
15
  class_option :file_hash, :aliases => "-h", :type => :boolean, :desc => "Generate font files with asset-busting hashes. Default: true"
16
16
  class_option :css_prefix, :aliases => "-p", :desc => "The prefix for each glyph's CSS class. Default: 'icon-'"
17
+ class_option :font_face_path, :alias => "-f", :desc => "The http path used in @font-face declarations. Only used in .scss partials. Default: none"
17
18
  class_option :debug, :aliases => "-d", :type => :boolean, :desc => "Display debug messages from fontforge. Default: false"
18
19
  class_option :verbose, :aliases => "-v", :type => :boolean, :desc => "Display output messages. Default: true"
19
20
 
@@ -7,6 +7,7 @@ module Fontcustom
7
7
  :font_name => "fontcustom",
8
8
  :file_hash => true,
9
9
  :css_prefix => "icon-",
10
+ :font_face_path => false,
10
11
  :debug => false,
11
12
  :verbose => true
12
13
  }
@@ -88,7 +88,7 @@ if args.nohash:
88
88
  fontfile = outdir + '/' + args.name
89
89
  else:
90
90
  hashStr = m.hexdigest()
91
- fontfile = outdir + '/' + args.name + '-' + hashStr
91
+ fontfile = outdir + '/' + args.name + '_' + hashStr
92
92
 
93
93
  f.fontname = args.name
94
94
  f.familyname = args.name
@@ -1,3 +1,7 @@
1
+ /*
2
+ * Font Custom: Bootstrap CSS for IE7
3
+ */
4
+
1
5
  [class^="<%= @opts[:css_prefix] %>"],
2
6
  [class*=" <%= @opts[:css_prefix] %>"] {
3
7
  font-family: "<%= @opts[:font_name] %>";
@@ -7,7 +11,6 @@
7
11
 
8
12
  .btn.dropdown-toggle [class^="<%= @opts[:css_prefix] %>"],
9
13
  .btn.dropdown-toggle [class*=" <%= @opts[:css_prefix] %>"] {
10
- /* keeps button heights with and without icons the same */
11
14
  line-height: 1.4em;
12
15
  }
13
16
 
@@ -0,0 +1,68 @@
1
+ <%
2
+ file_name = if @opts[:font_face_path]
3
+ File.join @opts[:font_face_path], @data[:file_name]
4
+ else
5
+ @data[:file_name]
6
+ end
7
+ %>/*
8
+ * Font Custom: Bootstrap CSS
9
+ */
10
+
11
+ @font-face {
12
+ font-family: "<%= @opts[:font_name] %>";
13
+ src: url("<%= file_name %>.eot");
14
+ src: url("<%= file_name %>.eot?#iefix") format("embedded-opentype"),
15
+ url("<%= file_name %>.woff") format("woff"),
16
+ url("<%= file_name %>.ttf") format("truetype"),
17
+ url("<%= file_name %>.svg#<%= @opts[:font_name] %>") format("svg");
18
+ font-weight: normal;
19
+ font-style: normal;
20
+ }
21
+
22
+ [class^="<%= @opts[:css_prefix] %>"]:before, [class*=" <%= @opts[:css_prefix] %>"]:before {
23
+ font-family: "<%= @opts[:font_name] %>";
24
+ font-weight: normal;
25
+ font-style: normal;
26
+ display: inline-block;
27
+ text-decoration: inherit;
28
+ }
29
+
30
+ a [class^="<%= @opts[:css_prefix] %>"], a [class*=" <%= @opts[:css_prefix] %>"] {
31
+ display: inline-block;
32
+ text-decoration: inherit;
33
+ }
34
+
35
+ .<%= @opts[:css_prefix] %>large:before {
36
+ vertical-align: top;
37
+ font-size: 1.333em;
38
+ }
39
+
40
+ .btn [class^="<%= @opts[:css_prefix] %>"], .btn [class*=" <%= @opts[:css_prefix] %>"] {
41
+ line-height: 0.9em;
42
+ }
43
+
44
+ li [class^="<%= @opts[:css_prefix] %>"], li [class*=" <%= @opts[:css_prefix] %>"] {
45
+ display: inline-block;
46
+ width: 1.25em;
47
+ text-align: center;
48
+ }
49
+
50
+ li .<%= @opts[:css_prefix] %>large[class^="<%= @opts[:css_prefix] %>"], li .<%= @opts[:css_prefix] %>large[class*=" <%= @opts[:css_prefix] %>"] {
51
+ width: 1.875em;
52
+ }
53
+
54
+ li[class^="<%= @opts[:css_prefix] %>"], li[class*=" <%= @opts[:css_prefix] %>"] {
55
+ margin-left: 0;
56
+ list-style-type: none;
57
+ }
58
+
59
+ li[class^="<%= @opts[:css_prefix] %>"]:before, li[class*=" <%= @opts[:css_prefix] %>"]:before {
60
+ text-indent: -2em;
61
+ text-align: center;
62
+ }
63
+
64
+ li[class^="<%= @opts[:css_prefix] %>"].<%= @opts[:css_prefix] %>large:before, li[class*=" <%= @opts[:css_prefix] %>"].<%= @opts[:css_prefix] %>large:before {
65
+ text-indent: -1.333em;
66
+ }
67
+ <% @data[:glyphs].each_with_index do |name, index| %>
68
+ .<%= @opts[:css_prefix] + name %>:before { content: "\<%= (61696+index).to_s(16) %>"; }<% end %>
@@ -1,72 +1,34 @@
1
- /*
2
- Font Custom
3
- */
1
+ <%
2
+ file_name = if @opts[:font_face_path]
3
+ File.join @opts[:font_face_path], @data[:file_name]
4
+ else
5
+ @data[:file_name]
6
+ end
7
+ %>/*
8
+ * Font Custom: bare CSS
9
+ */
4
10
 
5
11
  @font-face {
6
12
  font-family: "<%= @opts[:font_name] %>";
7
- src: url("<%= @data[:file_name] %>.eot?#iefix") format("embedded-opentype"),
8
- url("<%= @data[:file_name] %>.woff") format("woff"),
9
- url("<%= @data[:file_name] %>.ttf") format("truetype"),
10
- url("<%= @data[:file_name] %>.svg#<%= @opts[:font_name] %>") format("svg");
13
+ src: url("<%= file_name %>.eot");
14
+ src: url("<%= file_name %>.eot?#iefix") format("embedded-opentype"),
15
+ url("<%= file_name %>.woff") format("woff"),
16
+ url("<%= file_name %>.ttf") format("truetype"),
17
+ url("<%= file_name %>.svg#<%= @opts[:font_name] %>") format("svg");
11
18
  font-weight: normal;
12
19
  font-style: normal;
13
20
  }
14
21
 
15
- /*
16
- Bootstrap Overrides
17
- */
18
-
19
- [class^="<%= @opts[:css_prefix] %>"]:before, [class*=" <%= @opts[:css_prefix] %>"]:before {
22
+ <%= @data[:glyphs].map {|name| ".#{@opts[:css_prefix] + name}:before"}.join(",\n") %> {
20
23
  font-family: "<%= @opts[:font_name] %>";
21
- font-weight: normal;
22
24
  font-style: normal;
25
+ font-weight: normal;
26
+ font-variant: normal;
27
+ text-transform: none;
28
+ line-height: 1;
29
+ -webkit-font-smoothing: antialiased;
23
30
  display: inline-block;
24
31
  text-decoration: inherit;
25
32
  }
26
-
27
- a [class^="<%= @opts[:css_prefix] %>"], a [class*=" <%= @opts[:css_prefix] %>"] {
28
- display: inline-block;
29
- text-decoration: inherit;
30
- }
31
-
32
- /* makes the font 33% larger relative to the icon container */
33
- .<%= @opts[:css_prefix] %>large:before {
34
- vertical-align: top;
35
- font-size: 1.333em;
36
- }
37
-
38
- /* keeps button heights with and without icons the same */
39
- .btn [class^="<%= @opts[:css_prefix] %>"], .btn [class*=" <%= @opts[:css_prefix] %>"] {
40
- line-height: 0.9em;
41
- }
42
-
43
- li [class^="<%= @opts[:css_prefix] %>"], li [class*=" <%= @opts[:css_prefix] %>"] {
44
- display: inline-block;
45
- width: 1.25em;
46
- text-align: center;
47
- }
48
-
49
- /* 1.5 increased font size for <%= @opts[:css_prefix] %>large * 1.25 width */
50
- li .<%= @opts[:css_prefix] %>large[class^="<%= @opts[:css_prefix] %>"], li .<%= @opts[:css_prefix] %>large[class*=" <%= @opts[:css_prefix] %>"] {
51
- width: 1.875em;
52
- }
53
-
54
- li[class^="<%= @opts[:css_prefix] %>"], li[class*=" <%= @opts[:css_prefix] %>"] {
55
- margin-left: 0;
56
- list-style-type: none;
57
- }
58
-
59
- li[class^="<%= @opts[:css_prefix] %>"]:before, li[class*=" <%= @opts[:css_prefix] %>"]:before {
60
- text-indent: -2em;
61
- text-align: center;
62
- }
63
-
64
- li[class^="<%= @opts[:css_prefix] %>"].<%= @opts[:css_prefix] %>large:before, li[class*=" <%= @opts[:css_prefix] %>"].<%= @opts[:css_prefix] %>large:before {
65
- text-indent: -1.333em;
66
- }
67
-
68
- /*
69
- Icon Classes
70
- */
71
33
  <% @data[:glyphs].each_with_index do |name, index| %>
72
34
  .<%= @opts[:css_prefix] + name %>:before { content: "\<%= (61696+index).to_s(16) %>"; }<% end %>
@@ -0,0 +1,21 @@
1
+ /*
2
+ * Font Custom: Bootstrap CSS for IE7
3
+ */
4
+
5
+ [class^="<%= @opts[:css_prefix] %>"],
6
+ [class*=" <%= @opts[:css_prefix] %>"] {
7
+ font-family: "<%= @opts[:font_name] %>";
8
+ font-style: normal;
9
+ font-weight: normal;
10
+ }
11
+
12
+ .btn.dropdown-toggle [class^="<%= @opts[:css_prefix] %>"],
13
+ .btn.dropdown-toggle [class*=" <%= @opts[:css_prefix] %>"] {
14
+ line-height: 1.4em;
15
+ }
16
+
17
+ .<%= @opts[:css_prefix] %>large {
18
+ font-size: 1.3333em;
19
+ }
20
+ <% @data[:glyphs].each_with_index do |name, index| %>
21
+ .<%= @opts[:css_prefix] + name %> { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#x<%= (61696+index).to_s(16) %>;&nbsp;'); }<% end %>
@@ -0,0 +1,62 @@
1
+ /*
2
+ * Font Custom: Bootstrap CSS
3
+ */
4
+
5
+ @font-face {
6
+ font-family: "<%= @opts[:font_name] %>";
7
+ src: url("<%= @data[:file_name] %>.eot");
8
+ src: url("<%= @data[:file_name] %>.eot?#iefix") format("embedded-opentype"),
9
+ url("<%= @data[:file_name] %>.woff") format("woff"),
10
+ url("<%= @data[:file_name] %>.ttf") format("truetype"),
11
+ url("<%= @data[:file_name] %>.svg#<%= @opts[:font_name] %>") format("svg");
12
+ font-weight: normal;
13
+ font-style: normal;
14
+ }
15
+
16
+ [class^="<%= @opts[:css_prefix] %>"]:before, [class*=" <%= @opts[:css_prefix] %>"]:before {
17
+ font-family: "<%= @opts[:font_name] %>";
18
+ font-weight: normal;
19
+ font-style: normal;
20
+ display: inline-block;
21
+ text-decoration: inherit;
22
+ }
23
+
24
+ a [class^="<%= @opts[:css_prefix] %>"], a [class*=" <%= @opts[:css_prefix] %>"] {
25
+ display: inline-block;
26
+ text-decoration: inherit;
27
+ }
28
+
29
+ .<%= @opts[:css_prefix] %>large:before {
30
+ vertical-align: top;
31
+ font-size: 1.333em;
32
+ }
33
+
34
+ .btn [class^="<%= @opts[:css_prefix] %>"], .btn [class*=" <%= @opts[:css_prefix] %>"] {
35
+ line-height: 0.9em;
36
+ }
37
+
38
+ li [class^="<%= @opts[:css_prefix] %>"], li [class*=" <%= @opts[:css_prefix] %>"] {
39
+ display: inline-block;
40
+ width: 1.25em;
41
+ text-align: center;
42
+ }
43
+
44
+ li .<%= @opts[:css_prefix] %>large[class^="<%= @opts[:css_prefix] %>"], li .<%= @opts[:css_prefix] %>large[class*=" <%= @opts[:css_prefix] %>"] {
45
+ width: 1.875em;
46
+ }
47
+
48
+ li[class^="<%= @opts[:css_prefix] %>"], li[class*=" <%= @opts[:css_prefix] %>"] {
49
+ margin-left: 0;
50
+ list-style-type: none;
51
+ }
52
+
53
+ li[class^="<%= @opts[:css_prefix] %>"]:before, li[class*=" <%= @opts[:css_prefix] %>"]:before {
54
+ text-indent: -2em;
55
+ text-align: center;
56
+ }
57
+
58
+ li[class^="<%= @opts[:css_prefix] %>"].<%= @opts[:css_prefix] %>large:before, li[class*=" <%= @opts[:css_prefix] %>"].<%= @opts[:css_prefix] %>large:before {
59
+ text-indent: -1.333em;
60
+ }
61
+ <% @data[:glyphs].each_with_index do |name, index| %>
62
+ .<%= @opts[:css_prefix] + name %>:before { content: "\<%= (61696+index).to_s(16) %>"; }<% end %>
@@ -1,9 +1,10 @@
1
- /*
2
- Font Custom
3
- */
1
+ /*
2
+ * Font Custom: bare CSS
3
+ */
4
4
 
5
5
  @font-face {
6
6
  font-family: "<%= @opts[:font_name] %>";
7
+ src: url("<%= @data[:file_name] %>.eot");
7
8
  src: url("<%= @data[:file_name] %>.eot?#iefix") format("embedded-opentype"),
8
9
  url("<%= @data[:file_name] %>.woff") format("woff"),
9
10
  url("<%= @data[:file_name] %>.ttf") format("truetype"),
@@ -12,61 +13,16 @@
12
13
  font-style: normal;
13
14
  }
14
15
 
15
- /*
16
- Bootstrap Overrides
17
- */
18
-
19
- [class^="<%= @opts[:css_prefix] %>"]:before, [class*=" <%= @opts[:css_prefix] %>"]:before {
16
+ <%= @data[:glyphs].map {|name| ".#{@opts[:css_prefix] + name}:before"}.join(",\n") %> {
20
17
  font-family: "<%= @opts[:font_name] %>";
21
- font-weight: normal;
22
18
  font-style: normal;
19
+ font-weight: normal;
20
+ font-variant: normal;
21
+ text-transform: none;
22
+ line-height: 1;
23
+ -webkit-font-smoothing: antialiased;
23
24
  display: inline-block;
24
25
  text-decoration: inherit;
25
26
  }
26
-
27
- a [class^="<%= @opts[:css_prefix] %>"], a [class*=" <%= @opts[:css_prefix] %>"] {
28
- display: inline-block;
29
- text-decoration: inherit;
30
- }
31
-
32
- /* makes the font 33% larger relative to the icon container */
33
- .<%= @opts[:css_prefix] %>large:before {
34
- vertical-align: top;
35
- font-size: 1.333em;
36
- }
37
-
38
- /* keeps button heights with and without icons the same */
39
- .btn [class^="<%= @opts[:css_prefix] %>"], .btn [class*=" <%= @opts[:css_prefix] %>"] {
40
- line-height: 0.9em;
41
- }
42
-
43
- li [class^="<%= @opts[:css_prefix] %>"], li [class*=" <%= @opts[:css_prefix] %>"] {
44
- display: inline-block;
45
- width: 1.25em;
46
- text-align: center;
47
- }
48
-
49
- /* 1.5 increased font size for <%= @opts[:css_prefix] %>large * 1.25 width */
50
- li .<%= @opts[:css_prefix] %>large[class^="<%= @opts[:css_prefix] %>"], li .<%= @opts[:css_prefix] %>large[class*=" <%= @opts[:css_prefix] %>"] {
51
- width: 1.875em;
52
- }
53
-
54
- li[class^="<%= @opts[:css_prefix] %>"], li[class*=" <%= @opts[:css_prefix] %>"] {
55
- margin-left: 0;
56
- list-style-type: none;
57
- }
58
-
59
- li[class^="<%= @opts[:css_prefix] %>"]:before, li[class*=" <%= @opts[:css_prefix] %>"]:before {
60
- text-indent: -2em;
61
- text-align: center;
62
- }
63
-
64
- li[class^="<%= @opts[:css_prefix] %>"].<%= @opts[:css_prefix] %>large:before, li[class*=" <%= @opts[:css_prefix] %>"].<%= @opts[:css_prefix] %>large:before {
65
- text-indent: -1.333em;
66
- }
67
-
68
- /*
69
- Icon Classes
70
- */
71
27
  <% @data[:glyphs].each_with_index do |name, index| %>
72
28
  .<%= @opts[:css_prefix] + name %>:before { content: "\<%= (61696+index).to_s(16) %>"; }<% end %>
@@ -1,23 +1,80 @@
1
1
  ##
2
2
  # FONTCUSTOM CONFIG
3
3
  #
4
- # Include this file along with your vectors or pass it to any command with:
5
- # --config=path/to/config.yml
6
- # -c path/to/containing/dir/
4
+ # This file will automatically be loaded if located inside your vector dir.
5
+ # Otherwise, pass it to `compile` or `watch` with:
7
6
  #
8
- # Run `fontcustom help` to learn about various options
7
+ # --config=path/to/config.yml
8
+ # -c path/to/containing/dir/
9
9
  ##
10
10
 
11
- #output: /path/to/output
11
+ # ---------------------------------------------------------------------------- #
12
+ # Output Directory
13
+ # absolute path OR relative path from `pwd`
14
+ #
15
+ # default: INPUT/fontcustom
16
+
17
+ #output: path/to/output
18
+
19
+ # ---------------------------------------------------------------------------- #
20
+ # Templates
21
+ # array of templates to generate alongside fonts
22
+ # accepts shortcuts or paths (absolute, relative to INPUT, or relative to `pwd`)
23
+ #
24
+ # shortcuts:
25
+ # preview
26
+ # css, scss
27
+ # bootstrap, bootstrap-scss
28
+ # bootstrap-ie7, bootstrap-ie7-scss
29
+ #
30
+ # default: [ css, preview ]
12
31
 
13
- #templates: [ scss, preview, relative/path/from/INPUT, relative/path/from/PWD ]
32
+ #templates: [ scss, preview, path/from/INPUT ]
33
+
34
+ # ---------------------------------------------------------------------------- #
35
+ # Font Name
36
+ # automatically normalized to lower-spinal-case
37
+ #
38
+ # default: fontcustom
14
39
 
15
40
  #font_name: my-font
41
+
42
+ # ---------------------------------------------------------------------------- #
43
+ # Font Hash
44
+ # option to attach a cache-breaking fingerprint to each font file
45
+ #
46
+ # default: true
16
47
 
17
48
  #file_hash: false
18
49
 
19
- #css_prefix: glyph-
50
+ # ---------------------------------------------------------------------------- #
51
+ # CSS Class Prefix
52
+ #
53
+ # default: icon-
54
+
55
+ #css_prefix: glyph-
56
+
57
+ # ---------------------------------------------------------------------------- #
58
+ # @Font-face Path
59
+ # font path used in @font-face declarations
60
+ # only affects SCSS shortcut templates and custom templates
61
+ #
62
+ # default: none
63
+
64
+ #font_face_path: assets/fonts/fontcustom
65
+
66
+ # ---------------------------------------------------------------------------- #
67
+ # Debug
68
+ # show raw output from Font Forge
69
+ #
70
+ # default: false
20
71
 
21
72
  #debug: true
22
73
 
74
+ # ---------------------------------------------------------------------------- #
75
+ # Verbose
76
+ # print out all file operations
77
+ #
78
+ # default: true
79
+
23
80
  #verbose: false
@@ -58,13 +58,19 @@ module Fontcustom
58
58
  options[:templates].map do |template|
59
59
  case template
60
60
  when "preview"
61
- File.join gem_lib_path, "templates", "fontcustom.html"
61
+ File.join gem_lib_path, "templates", "fontcustom-preview.html"
62
62
  when "css"
63
63
  File.join gem_lib_path, "templates", "fontcustom.css"
64
64
  when "scss"
65
65
  File.join gem_lib_path, "templates", "_fontcustom.scss"
66
- when "css-ie7"
67
- File.join gem_lib_path, "templates", "fontcustom-ie7.css"
66
+ when "bootstrap"
67
+ File.join gem_lib_path, "templates", "fontcustom-bootstrap.css"
68
+ when "bootstrap-scss"
69
+ File.join gem_lib_path, "templates", "_fontcustom-bootstrap.scss"
70
+ when "bootstrap-ie7"
71
+ File.join gem_lib_path, "templates", "fontcustom-bootstrap-ie7.css"
72
+ when "bootstrap-ie7-scss"
73
+ File.join gem_lib_path, "templates", "_fontcustom-bootstrap-ie7.scss"
68
74
  else
69
75
  if File.exists?(template)
70
76
  template
@@ -1,3 +1,3 @@
1
1
  module Fontcustom
2
- VERSION = "1.0.0.pre"
2
+ VERSION = "1.0.0.pre2"
3
3
  end
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "fonts": [
3
- "fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.woff",
4
- "fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.ttf",
5
- "fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.eot",
6
- "fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.svg"
3
+ "fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.woff",
4
+ "fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.ttf",
5
+ "fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.eot",
6
+ "fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.svg"
7
7
  ],
8
8
  "templates": [
9
9
  "fontcustom.css"
10
10
  ],
11
- "file_name": "fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e",
11
+ "file_name": "fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e",
12
12
  "glyphs": [
13
13
  "a_r3ally-exotic-f1le-name",
14
14
  "c",
@@ -4,10 +4,10 @@ Font Custom - icon webfonts made simple
4
4
 
5
5
  @font-face {
6
6
  font-family: "fontcustom";
7
- src: url("fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.eot?#iefix") format("embedded-opentype"),
8
- url("fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.woff") format("woff"),
9
- url("fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.ttf") format("truetype"),
10
- url("fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.svg#fontcustom") format("svg");
7
+ src: url("fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.eot?#iefix") format("embedded-opentype"),
8
+ url("fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.woff") format("woff"),
9
+ url("fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.ttf") format("truetype"),
10
+ url("fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.svg#fontcustom") format("svg");
11
11
  font-weight: normal;
12
12
  font-style: normal;
13
13
  }
@@ -62,7 +62,7 @@ describe Fontcustom::Generator::Font do
62
62
  end
63
63
 
64
64
  it "should delete fonts from @data[:fonts]" do
65
- subject.should_receive(:remove_file).exactly(4).times.with(/fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e/, :verbose => true)
65
+ subject.should_receive(:remove_file).exactly(4).times.with(/fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e/, :verbose => true)
66
66
  subject.reset_output
67
67
  end
68
68
 
@@ -128,12 +128,12 @@ describe Fontcustom::Generator::Font do
128
128
  gen.collect_data
129
129
  data = gen.instance_variable_get(:@data)
130
130
  data[:glyphs].should =~ ["c", "d", "a_r3ally-exotic-f1le-name"]
131
- data[:file_name].should == "fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e"
131
+ data[:file_name].should == "fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e"
132
132
  data[:fonts].should =~ [
133
- "fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.eot",
134
- "fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.svg",
135
- "fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.ttf",
136
- "fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.woff"
133
+ "fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.eot",
134
+ "fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.svg",
135
+ "fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.ttf",
136
+ "fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.woff"
137
137
  ]
138
138
  end
139
139
  end
@@ -44,7 +44,7 @@ describe Fontcustom::Generator::Template do
44
44
  it "should not delete non-template files" do
45
45
  subject.should_not_receive(:remove_file).with("dont-delete-me.bro")
46
46
  subject.should_not_receive(:remove_file).with("another-font.ttf")
47
- subject.should_not_receive(:remove_file).with(/fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e/)
47
+ subject.should_not_receive(:remove_file).with(/fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e/)
48
48
  subject.reset_output
49
49
  end
50
50
 
@@ -71,18 +71,22 @@ describe Fontcustom::Util do
71
71
  templates = util.get_template_paths options
72
72
  templates.should =~ [
73
73
  File.join(lib, "templates", "fontcustom.css"),
74
- File.join(lib, "templates", "fontcustom.html")
74
+ File.join(lib, "templates", "fontcustom-preview.html")
75
75
  ]
76
76
  end
77
77
 
78
78
  it "should expand shorthand for packaged templates" do
79
79
  lib = util.gem_lib_path
80
- options = { :input => fixture("vectors"), :templates => %W|css scss preview| }
80
+ options = { :input => fixture("vectors"), :templates => %W|preview css scss bootstrap bootstrap-scss bootstrap-ie7 bootstrap-ie7-scss| }
81
81
  templates = util.get_template_paths options
82
82
  templates.should =~ [
83
+ File.join(lib, "templates", "fontcustom-preview.html"),
83
84
  File.join(lib, "templates", "fontcustom.css"),
84
85
  File.join(lib, "templates", "_fontcustom.scss"),
85
- File.join(lib, "templates", "fontcustom.html")
86
+ File.join(lib, "templates", "fontcustom-bootstrap.css"),
87
+ File.join(lib, "templates", "_fontcustom-bootstrap.scss"),
88
+ File.join(lib, "templates", "fontcustom-bootstrap-ie7.css"),
89
+ File.join(lib, "templates", "_fontcustom-bootstrap-ie7.scss")
86
90
  ]
87
91
  end
88
92
 
@@ -10,13 +10,13 @@ RSpec.configure do |c|
10
10
  def data_file_contents
11
11
  {
12
12
  :fonts => %w|
13
- fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.woff
14
- fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.ttf
15
- fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.eot
16
- fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e.svg
13
+ fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.woff
14
+ fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.ttf
15
+ fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.eot
16
+ fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.svg
17
17
  |,
18
18
  :templates => %w|fontcustom.css|,
19
- :file_name => "fontcustom-cc5ce52f2ae4f9ce2e7ee8131bbfee1e",
19
+ :file_name => "fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e",
20
20
  :glyphs => %w|a_r3ally-exotic-f1le-name c d|
21
21
  }
22
22
  end
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.0.0.pre
4
+ version: 1.0.0.pre2
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-04-09 00:00:00.000000000 Z
13
+ date: 2013-04-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  description: Transforms EPS and SVG vectors into icon webfonts. Generates CSS (or
112
- your preferred alternative) for easy inclusion in your projects.
112
+ any custom template) for easy inclusion in your projects.
113
113
  email:
114
114
  - yz@yifei.co
115
115
  - joshua@gross.is
@@ -122,7 +122,6 @@ files:
122
122
  - CHANGELOG.md
123
123
  - CONTRIBUTING.md
124
124
  - Gemfile
125
- - Guardfile
126
125
  - LICENSES.txt
127
126
  - README.md
128
127
  - Rakefile
@@ -137,10 +136,13 @@ files:
137
136
  - lib/fontcustom/scripts/eotlitetool.py
138
137
  - lib/fontcustom/scripts/generate.py
139
138
  - lib/fontcustom/scripts/sfnt2woff
139
+ - lib/fontcustom/templates/_fontcustom-bootstrap-ie7.scss
140
+ - lib/fontcustom/templates/_fontcustom-bootstrap.scss
140
141
  - lib/fontcustom/templates/_fontcustom.scss
141
- - lib/fontcustom/templates/fontcustom-ie7.css
142
+ - lib/fontcustom/templates/fontcustom-bootstrap-ie7.css
143
+ - lib/fontcustom/templates/fontcustom-bootstrap.css
144
+ - lib/fontcustom/templates/fontcustom-preview.html
142
145
  - lib/fontcustom/templates/fontcustom.css
143
- - lib/fontcustom/templates/fontcustom.html
144
146
  - lib/fontcustom/templates/fontcustom.yml
145
147
  - lib/fontcustom/util.rb
146
148
  - lib/fontcustom/version.rb
@@ -151,11 +153,11 @@ files:
151
153
  - spec/fixtures/mixed-output/.fontcustom-data
152
154
  - spec/fixtures/mixed-output/another-font.ttf
153
155
  - 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
156
  - spec/fixtures/mixed-output/fontcustom.css
157
+ - spec/fixtures/mixed-output/fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.eot
158
+ - spec/fixtures/mixed-output/fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.svg
159
+ - spec/fixtures/mixed-output/fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.ttf
160
+ - spec/fixtures/mixed-output/fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.woff
159
161
  - spec/fixtures/not-a-dir
160
162
  - spec/fixtures/vectors/C.svg
161
163
  - spec/fixtures/vectors/D.svg
@@ -179,7 +181,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
179
181
  version: '0'
180
182
  segments:
181
183
  - 0
182
- hash: -3519366396623315767
184
+ hash: 549091687675706102
183
185
  required_rubygems_version: !ruby/object:Gem::Requirement
184
186
  none: false
185
187
  requirements:
@@ -199,11 +201,11 @@ test_files:
199
201
  - spec/fixtures/mixed-output/.fontcustom-data
200
202
  - spec/fixtures/mixed-output/another-font.ttf
201
203
  - 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
204
  - spec/fixtures/mixed-output/fontcustom.css
205
+ - spec/fixtures/mixed-output/fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.eot
206
+ - spec/fixtures/mixed-output/fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.svg
207
+ - spec/fixtures/mixed-output/fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.ttf
208
+ - spec/fixtures/mixed-output/fontcustom_cc5ce52f2ae4f9ce2e7ee8131bbfee1e.woff
207
209
  - spec/fixtures/not-a-dir
208
210
  - spec/fixtures/vectors/C.svg
209
211
  - spec/fixtures/vectors/D.svg
data/Guardfile DELETED
@@ -1,15 +0,0 @@
1
- # A sample Guardfile
2
- # More info at https://github.com/guard/guard#readme
3
-
4
- guard 'spork' do
5
- watch('Gemfile.lock')
6
- watch('spec/spec_helper.rb') { :rspec }
7
- end
8
-
9
- guard 'rspec', :cli => '--color --drb' do
10
- watch(%r{^spec/.+_spec\.rb$})
11
- watch(%r{^lib/fontcustom/(.+)\.rb$}) { |m| "spec/fontcustom/#{m[1]}_spec.rb" }
12
- watch('lib/fontcustom.rb') { 'spec/fontcustom/fontcustom_spec.rb' }
13
- watch('lib/fontcustom/core.rb') { 'spec/fontcustom/fontcustom_spec.rb' }
14
- watch('spec/spec_helper.rb') { 'spec' }
15
- end