fontcustom 1.1.0.pre2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/CONTRIBUTING.md +2 -3
- data/README.md +37 -12
- data/Rakefile +3 -3
- data/fontcustom.gemspec +11 -10
- data/lib/fontcustom.rb +18 -22
- data/lib/fontcustom/cli.rb +29 -30
- data/lib/fontcustom/generator/font.rb +23 -34
- data/lib/fontcustom/generator/template.rb +26 -24
- data/lib/fontcustom/options.rb +51 -48
- data/lib/fontcustom/scripts/generate.py +2 -2
- data/lib/fontcustom/templates/_fontcustom-bootstrap.scss +5 -5
- data/lib/fontcustom/templates/_fontcustom-rails.scss +5 -5
- data/lib/fontcustom/templates/_fontcustom.scss +8 -5
- data/lib/fontcustom/templates/fontcustom-bootstrap-ie7.css +1 -1
- data/lib/fontcustom/templates/fontcustom-bootstrap.css +1 -1
- data/lib/fontcustom/templates/fontcustom-preview.html +67 -22
- data/lib/fontcustom/templates/fontcustom.css +4 -1
- data/lib/fontcustom/templates/fontcustom.yml +14 -14
- data/lib/fontcustom/util.rb +18 -8
- data/lib/fontcustom/version.rb +1 -1
- data/lib/fontcustom/watcher.rb +24 -22
- data/spec/fixtures/shared/templates/custom.css +6 -0
- data/spec/fixtures/shared/templates/regular.css +3 -0
- data/spec/fontcustom/generator/font_spec.rb +14 -14
- data/spec/fontcustom/generator/template_spec.rb +34 -21
- data/spec/fontcustom/options_spec.rb +45 -69
- data/spec/fontcustom/util_spec.rb +26 -5
- data/spec/fontcustom/watcher_spec.rb +6 -6
- data/spec/spec_helper.rb +8 -8
- metadata +11 -11
- data/TODO.md +0 -21
@@ -21,13 +21,12 @@ module Fontcustom
|
|
21
21
|
|
22
22
|
def get_data
|
23
23
|
if File.exists? opts.data_cache
|
24
|
-
@data = JSON.parse
|
24
|
+
@data = JSON.parse File.read(opts.data_cache), :symbolize_names => true
|
25
25
|
else
|
26
|
-
raise Fontcustom::Error, "
|
26
|
+
raise Fontcustom::Error, "`#{relative_to_root(opts.data_cache)}` is missing. This file is required to generate templates."
|
27
27
|
end
|
28
|
-
rescue
|
29
|
-
|
30
|
-
raise Fontcustom::Error, "#{relative_to_root(opts.data_cache)} is empty or corrupted. Try deleting the file and running Fontcustom::Generator::Font again to regenerate the data file. Old generated files may need to be deleted manually."
|
28
|
+
rescue
|
29
|
+
raise Fontcustom::Error, "Couldn't parse `#{relative_to_root(opts.data_cache)}`. Delete it to start from scratch. Any previously generated files will need to be deleted manually."
|
31
30
|
end
|
32
31
|
|
33
32
|
def reset_output
|
@@ -51,33 +50,36 @@ module Fontcustom
|
|
51
50
|
fonts = Pathname.new opts.output[:fonts]
|
52
51
|
css = Pathname.new opts.output[:css]
|
53
52
|
preview = Pathname.new opts.output[:preview]
|
54
|
-
@
|
55
|
-
@
|
56
|
-
@
|
57
|
-
File.join opts.preprocessor_path, name
|
58
|
-
else
|
59
|
-
@data[:paths][:css_to_fonts]
|
60
|
-
end
|
53
|
+
@font_path = File.join fonts.relative_path_from(css).to_s, name
|
54
|
+
@font_path_alt = opts.preprocessor_path.nil? ? @font_path : File.join(opts.preprocessor_path, name)
|
55
|
+
@font_path_preview = File.join fonts.relative_path_from(preview).to_s, name
|
61
56
|
end
|
62
57
|
|
63
58
|
def generate
|
64
59
|
@glyphs = @data[:glyphs]
|
65
|
-
|
66
|
-
|
60
|
+
created = []
|
61
|
+
packaged = %w|fontcustom-bootstrap-ie7.css fontcustom.css _fontcustom-bootstrap-ie7.scss _fontcustom-rails.scss
|
62
|
+
fontcustom-bootstrap.css fontcustom-preview.html _fontcustom-bootstrap.scss _fontcustom.scss|
|
63
|
+
css_exts = %w|.css .scss .sass .less .stylus|
|
67
64
|
begin
|
68
|
-
created = []
|
69
65
|
opts.templates.each do |source|
|
70
66
|
name = File.basename source
|
71
67
|
ext = File.extname source
|
72
|
-
target =
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
68
|
+
target = name.dup
|
69
|
+
|
70
|
+
if packaged.include?(name) && opts.font_name != DEFAULT_OPTIONS[:font_name]
|
71
|
+
target.sub! DEFAULT_OPTIONS[:font_name], opts.font_name
|
72
|
+
end
|
73
|
+
|
74
|
+
target = if opts.output.keys.include? name.to_sym
|
75
|
+
File.join opts.output[name.to_sym], target
|
76
|
+
elsif css_exts.include? ext
|
77
|
+
File.join opts.output[:css], target
|
78
|
+
elsif name == "fontcustom-preview.html"
|
79
|
+
File.join opts.output[:preview], target
|
80
|
+
else
|
81
|
+
File.join opts.output[:fonts], target
|
82
|
+
end
|
81
83
|
|
82
84
|
template source, target, :verbose => false
|
83
85
|
created << target
|
data/lib/fontcustom/options.rb
CHANGED
@@ -2,18 +2,17 @@ require "yaml"
|
|
2
2
|
require "thor/shell"
|
3
3
|
require "thor/shell/basic"
|
4
4
|
require "thor/shell/color"
|
5
|
-
require "thor/core_ext/hash_with_indifferent_access"
|
6
5
|
require "fontcustom/util"
|
7
6
|
|
8
7
|
module Fontcustom
|
9
8
|
class Options
|
10
9
|
include Util
|
11
10
|
|
12
|
-
attr_reader :project_root, :input, :output, :config, :data_cache, :
|
13
|
-
:font_name, :file_hash, :css_prefix, :preprocessor_path, :skip_first, :debug, :verbose
|
11
|
+
attr_reader :project_root, :input, :output, :config, :templates, :font_name, :css_prefix, :data_cache, :preprocessor_path, :no_hash, :debug, :quiet, :skip_first
|
14
12
|
|
15
13
|
def initialize(options = {})
|
16
14
|
check_fontforge
|
15
|
+
options = symbolize_hash(options)
|
17
16
|
|
18
17
|
# Overwrite example defaults (used in Thor's help) with real defaults, if unchanged
|
19
18
|
EXAMPLE_OPTIONS.keys.each do |key|
|
@@ -39,7 +38,7 @@ module Fontcustom
|
|
39
38
|
|
40
39
|
def set_config_path
|
41
40
|
@config = if @cli_options[:config]
|
42
|
-
path =
|
41
|
+
path = expand_path @cli_options[:config]
|
43
42
|
|
44
43
|
# :config is the path to fontcustom.yml
|
45
44
|
if File.exists?(path) && ! File.directory?(path)
|
@@ -50,7 +49,7 @@ module Fontcustom
|
|
50
49
|
File.join path, "fontcustom.yml"
|
51
50
|
|
52
51
|
else
|
53
|
-
raise Fontcustom::Error, "The configuration file
|
52
|
+
raise Fontcustom::Error, "The configuration file wasn't found. Check `#{relative_to_root(path)}` and try again."
|
54
53
|
end
|
55
54
|
else
|
56
55
|
# fontcustom.yml is in the project_root
|
@@ -69,12 +68,20 @@ module Fontcustom
|
|
69
68
|
|
70
69
|
def load_config
|
71
70
|
@config_options = {}
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
71
|
+
if @config
|
72
|
+
say_message :status, "Loading configuration file at `#{relative_to_root(@config)}`."
|
73
|
+
begin
|
74
|
+
config = YAML.load File.open(@config)
|
75
|
+
if config # empty YAML returns false
|
76
|
+
@config_options = symbolize_hash(config)
|
77
|
+
else
|
78
|
+
say_message :status, "Configuration file was empty. Using defaults."
|
79
|
+
end
|
80
|
+
rescue Exception => e
|
81
|
+
raise Fontcustom::Error, "The configuration file failed to load. Message: #{e.message}"
|
82
|
+
end
|
83
|
+
else
|
84
|
+
say_message :status, "No configuration file set. Generate one with `fontcustom config` to save your settings."
|
78
85
|
end
|
79
86
|
end
|
80
87
|
|
@@ -83,73 +90,69 @@ module Fontcustom
|
|
83
90
|
|
84
91
|
options = DEFAULT_OPTIONS.dup
|
85
92
|
options = options.merge @config_options
|
86
|
-
options = options.merge @cli_options
|
93
|
+
options = options.merge symbolize_hash(@cli_options)
|
87
94
|
remove_instance_variable :@config_options
|
88
95
|
remove_instance_variable :@cli_options
|
89
96
|
|
90
97
|
# :config is excluded since it's already been set
|
91
|
-
keys = %w|project_root input output data_cache templates font_name
|
92
|
-
keys.each { |key| instance_variable_set("@#{key}", options[key]) }
|
98
|
+
keys = %w|project_root input output data_cache templates font_name css_prefix preprocessor_path skip_first no_hash debug quiet|
|
99
|
+
keys.each { |key| instance_variable_set("@#{key}", options[key.to_sym]) }
|
93
100
|
|
94
|
-
@font_name = @font_name.strip.gsub(/\W/,
|
101
|
+
@font_name = @font_name.strip.gsub(/\W/, "-")
|
95
102
|
end
|
96
103
|
|
97
104
|
def set_data_path
|
98
105
|
@data_cache = if ! @data_cache.nil?
|
99
|
-
|
106
|
+
expand_path @data_cache
|
100
107
|
elsif @config
|
101
|
-
File.join File.dirname(@config),
|
108
|
+
File.join File.dirname(@config), ".fontcustom-data"
|
102
109
|
else
|
103
|
-
File.join @project_root,
|
110
|
+
File.join @project_root, ".fontcustom-data"
|
104
111
|
end
|
105
112
|
end
|
106
113
|
|
107
114
|
def set_input_paths
|
108
115
|
if @input.is_a? Hash
|
109
|
-
@input =
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
raise Fontcustom::Error, "INPUT[\"vectors\"] should be a directory. Check #{relative_to_root(input[:vectors])} and try again."
|
116
|
+
@input = symbolize_hash(@input)
|
117
|
+
if @input.has_key? :vectors
|
118
|
+
@input[:vectors] = expand_path @input[:vectors]
|
119
|
+
unless File.directory? @input[:vectors]
|
120
|
+
raise Fontcustom::Error, "INPUT[:vectors] should be a directory. Check `#{relative_to_root(@input[:vectors])}` and try again."
|
115
121
|
end
|
116
122
|
else
|
117
|
-
raise Fontcustom::Error, "INPUT (as a hash) should contain a
|
123
|
+
raise Fontcustom::Error, "INPUT (as a hash) should contain a :vectors key."
|
118
124
|
end
|
119
125
|
|
120
|
-
if @input.has_key?
|
121
|
-
@input[:templates] =
|
126
|
+
if @input.has_key? :templates
|
127
|
+
@input[:templates] = expand_path @input[:templates]
|
122
128
|
unless File.directory? @input[:templates]
|
123
|
-
raise Fontcustom::Error, "INPUT[
|
129
|
+
raise Fontcustom::Error, "INPUT[:templates] should be a directory. Check `#{relative_to_root(@input[:templates])}` and try again."
|
124
130
|
end
|
125
131
|
else
|
126
132
|
@input[:templates] = @input[:vectors]
|
127
133
|
end
|
128
|
-
|
129
|
-
input =
|
134
|
+
else
|
135
|
+
input = @input ? expand_path(@input) : @project_root
|
130
136
|
unless File.directory? input
|
131
|
-
raise Fontcustom::Error, "INPUT (as a string) should be a directory. Check
|
137
|
+
raise Fontcustom::Error, "INPUT (as a string) should be a directory. Check `#{relative_to_root(input)}` and try again."
|
132
138
|
end
|
133
|
-
@input =
|
134
|
-
:vectors => input,
|
135
|
-
:templates => input
|
136
|
-
})
|
139
|
+
@input = { :vectors => input, :templates => input }
|
137
140
|
end
|
138
141
|
|
139
142
|
if Dir[File.join(@input[:vectors], "*.{svg,eps}")].empty?
|
140
|
-
raise Fontcustom::Error, "
|
143
|
+
raise Fontcustom::Error, "`#{relative_to_root(@input[:vectors])}` doesn't contain any vectors (*.svg or *.eps files)."
|
141
144
|
end
|
142
145
|
end
|
143
146
|
|
144
147
|
def set_output_paths
|
145
148
|
if @output.is_a? Hash
|
146
|
-
@output =
|
147
|
-
raise Fontcustom::Error, "OUTPUT (as a hash) should contain a
|
149
|
+
@output = symbolize_hash(@output)
|
150
|
+
raise Fontcustom::Error, "OUTPUT (as a hash) should contain a :fonts key." unless @output.has_key? :fonts
|
148
151
|
|
149
152
|
@output.each do |key, val|
|
150
|
-
@output[key] =
|
153
|
+
@output[key] = expand_path val
|
151
154
|
if File.exists?(val) && ! File.directory?(val)
|
152
|
-
raise Fontcustom::Error, "OUTPUT[
|
155
|
+
raise Fontcustom::Error, "OUTPUT[:#{key.to_s}] should be a directory, not a file. Check `#{relative_to_root(val)}` and try again."
|
153
156
|
end
|
154
157
|
end
|
155
158
|
|
@@ -157,20 +160,20 @@ module Fontcustom
|
|
157
160
|
@output[:preview] ||= @output[:fonts]
|
158
161
|
else
|
159
162
|
if @output.is_a? String
|
160
|
-
output =
|
163
|
+
output = expand_path @output
|
161
164
|
if File.exists?(output) && ! File.directory?(output)
|
162
|
-
raise Fontcustom::Error, "OUTPUT should be a directory, not a file. Check
|
165
|
+
raise Fontcustom::Error, "OUTPUT should be a directory, not a file. Check `#{relative_to_root(output)}` and try again."
|
163
166
|
end
|
164
167
|
else
|
165
168
|
output = File.join @project_root, @font_name
|
166
|
-
say_message :status, "All generated files will be
|
169
|
+
say_message :status, "All generated files will be saved to `#{relative_to_root(output)}/`."
|
167
170
|
end
|
168
171
|
|
169
|
-
@output =
|
172
|
+
@output = {
|
170
173
|
:fonts => output,
|
171
174
|
:css => output,
|
172
175
|
:preview => output
|
173
|
-
}
|
176
|
+
}
|
174
177
|
end
|
175
178
|
end
|
176
179
|
|
@@ -201,9 +204,9 @@ module Fontcustom
|
|
201
204
|
when "bootstrap-ie7-scss"
|
202
205
|
File.join template_path, "_fontcustom-bootstrap-ie7.scss"
|
203
206
|
else
|
204
|
-
|
205
|
-
raise Fontcustom::Error, "The custom template at
|
206
|
-
|
207
|
+
template = File.expand_path File.join(@input[:templates], template) unless template[0] == "/"
|
208
|
+
raise Fontcustom::Error, "The custom template at `#{relative_to_root(template)}` does not exist." unless File.exists? template
|
209
|
+
template
|
207
210
|
end
|
208
211
|
end
|
209
212
|
end
|
@@ -9,7 +9,7 @@ try:
|
|
9
9
|
import argparse
|
10
10
|
parser = argparse.ArgumentParser(description='Convert a directory of svg and eps files into a unified font file.')
|
11
11
|
parser.add_argument('dir', metavar='directory', type=unicode, nargs=2, help='directory of vector files')
|
12
|
-
parser.add_argument('--name', metavar='fontname', type=unicode, nargs='?',
|
12
|
+
parser.add_argument('--name', metavar='fontname', type=unicode, nargs='?', help='reference name of the font (no spaces)')
|
13
13
|
parser.add_argument('--nohash', '-n', action='store_true', help='disable hash fingerprinting of font files')
|
14
14
|
parser.add_argument('--debug', '-d', action='store_true', help='display debug messages')
|
15
15
|
args = parser.parse_args()
|
@@ -19,7 +19,7 @@ except ImportError:
|
|
19
19
|
# Older Pythons don't have argparse, so we use optparse instead
|
20
20
|
import optparse
|
21
21
|
parser = optparse.OptionParser(description='Convert a directory of svg and eps files into a unified font file.')
|
22
|
-
parser.add_option('--name', metavar='fontname', type='string', nargs='?',
|
22
|
+
parser.add_option('--name', metavar='fontname', type='string', nargs='?', help='reference name of the font (no spaces)')
|
23
23
|
parser.add_option('--nohash', '-n', action='store_true', help='disable hash fingerprinting of font files')
|
24
24
|
parser.add_argument('--debug', '-d', action='store_true', help='display debug messages')
|
25
25
|
(args, posargs) = parser.parse_args()
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
@font-face {
|
7
7
|
font-family: "<%= @opts.font_name %>";
|
8
|
-
src: url("<%= @
|
9
|
-
src: url("<%= @
|
10
|
-
url("<%= @
|
11
|
-
url("<%= @
|
12
|
-
url("<%= @
|
8
|
+
src: url("<%= @font_path_alt %>.eot");
|
9
|
+
src: url("<%= @font_path_alt %>.eot?#iefix") format("embedded-opentype"),
|
10
|
+
url("<%= @font_path_alt %>.woff") format("woff"),
|
11
|
+
url("<%= @font_path_alt %>.ttf") format("truetype"),
|
12
|
+
url("<%= @font_path_alt %>.svg#<%= @opts.font_name %>") format("svg");
|
13
13
|
font-weight: normal;
|
14
14
|
font-style: normal;
|
15
15
|
}
|
@@ -4,11 +4,11 @@
|
|
4
4
|
|
5
5
|
@font-face {
|
6
6
|
font-family: "<%= @opts.font_name %>";
|
7
|
-
src: font-url("<%= @
|
8
|
-
src: font-url("<%= @
|
9
|
-
font-url("<%= @
|
10
|
-
font-url("<%= @
|
11
|
-
font-url("<%= @
|
7
|
+
src: font-url("<%= @font_path_alt %>.eot");
|
8
|
+
src: font-url("<%= @font_path_alt %>.eot?#iefix") format("embedded-opentype"),
|
9
|
+
font-url("<%= @font_path_alt %>.woff") format("woff"),
|
10
|
+
font-url("<%= @font_path_alt %>.ttf") format("truetype"),
|
11
|
+
font-url("<%= @font_path_alt %>.svg#<%= @opts.font_name %>") format("svg");
|
12
12
|
font-weight: normal;
|
13
13
|
font-style: normal;
|
14
14
|
}
|
@@ -4,15 +4,18 @@
|
|
4
4
|
|
5
5
|
@font-face {
|
6
6
|
font-family: "<%= @opts.font_name %>";
|
7
|
-
src: url("<%= @
|
8
|
-
src: url("<%= @
|
9
|
-
url("<%= @
|
10
|
-
url("<%= @
|
11
|
-
url("<%= @
|
7
|
+
src: url("<%= @font_path_alt %>.eot");
|
8
|
+
src: url("<%= @font_path_alt %>.eot?#iefix") format("embedded-opentype"),
|
9
|
+
url("<%= @font_path_alt %>.woff") format("woff"),
|
10
|
+
url("<%= @font_path_alt %>.ttf") format("truetype"),
|
11
|
+
url("<%= @font_path_alt %>.svg#<%= @opts.font_name %>") format("svg");
|
12
12
|
font-weight: normal;
|
13
13
|
font-style: normal;
|
14
14
|
}
|
15
15
|
|
16
|
+
[data-icon]:before { content: attr(data-icon); }
|
17
|
+
|
18
|
+
[data-icon]:before,
|
16
19
|
<%= @glyphs.map {|name| ".#{@opts.css_prefix + name}:before"}.join(",\n") %> {
|
17
20
|
font-family: "<%= @opts.font_name %>";
|
18
21
|
font-style: normal;
|
@@ -20,28 +20,39 @@
|
|
20
20
|
font: 16px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
|
21
21
|
}
|
22
22
|
|
23
|
-
a,
|
23
|
+
a,
|
24
24
|
a:visited {
|
25
25
|
color: #888;
|
26
26
|
text-decoration: underline;
|
27
27
|
}
|
28
|
-
a:hover,
|
28
|
+
a:hover,
|
29
29
|
a:focus { color: #000; }
|
30
30
|
|
31
|
-
|
31
|
+
header {
|
32
32
|
border-bottom: 2px solid #ddd;
|
33
|
+
margin-bottom: 20px;
|
34
|
+
overflow: hidden;
|
35
|
+
padding: 20px 0;
|
36
|
+
}
|
37
|
+
|
38
|
+
header h1 {
|
33
39
|
color: #888;
|
40
|
+
float: left;
|
34
41
|
font-size: 36px;
|
35
42
|
font-weight: 300;
|
36
|
-
|
37
|
-
|
43
|
+
}
|
44
|
+
|
45
|
+
header a {
|
46
|
+
float: right;
|
47
|
+
font-size: 14px;
|
38
48
|
}
|
39
49
|
|
40
50
|
.container {
|
41
51
|
margin: 0 auto;
|
42
|
-
|
52
|
+
max-width: 1200px;
|
53
|
+
min-width: 960px;
|
43
54
|
padding: 0 40px;
|
44
|
-
width:
|
55
|
+
width: 90%;
|
45
56
|
}
|
46
57
|
|
47
58
|
.glyph {
|
@@ -50,20 +61,41 @@
|
|
50
61
|
margin-bottom: 20px;
|
51
62
|
}
|
52
63
|
|
53
|
-
.preview-glyphs { vertical-align: bottom; }
|
64
|
+
.preview-glyphs { vertical-align: bottom; }
|
54
65
|
|
55
|
-
.preview-scale {
|
66
|
+
.preview-scale {
|
56
67
|
color: #888;
|
57
|
-
font-size: 12px;
|
68
|
+
font-size: 12px;
|
58
69
|
margin-top: 5px;
|
59
70
|
}
|
60
71
|
|
61
72
|
.step {
|
62
73
|
display: inline-block;
|
63
74
|
line-height: 1;
|
75
|
+
position: relative;
|
64
76
|
width: 10%;
|
65
77
|
}
|
66
78
|
|
79
|
+
.step .letters,
|
80
|
+
.step i {
|
81
|
+
-webkit-transition: opacity .3s;
|
82
|
+
-moz-transition: opacity .3s;
|
83
|
+
-ms-transition: opacity .3s;
|
84
|
+
-o-transition: opacity .3s;
|
85
|
+
transition: opacity .3s;
|
86
|
+
}
|
87
|
+
|
88
|
+
.step:hover .letters { opacity: 1; }
|
89
|
+
.step:hover i { opacity: .3; }
|
90
|
+
|
91
|
+
.letters {
|
92
|
+
opacity: .3;
|
93
|
+
position: absolute;
|
94
|
+
}
|
95
|
+
|
96
|
+
.characters-off .letters { display: none; }
|
97
|
+
.characters-off .step:hover i { opacity: 1; }
|
98
|
+
|
67
99
|
<% scale.each do |n| %>
|
68
100
|
.size-<%= n %> { font-size: <%= n %>px; }
|
69
101
|
<% end %>
|
@@ -81,7 +113,7 @@
|
|
81
113
|
|
82
114
|
.usage .class { width: 250px; }
|
83
115
|
|
84
|
-
|
116
|
+
footer {
|
85
117
|
color: #888;
|
86
118
|
font-size: 12px;
|
87
119
|
padding: 20px 0;
|
@@ -91,15 +123,18 @@
|
|
91
123
|
|
92
124
|
@font-face {
|
93
125
|
font-family: "<%= @opts.font_name %>";
|
94
|
-
src: url("<%= @
|
95
|
-
src: url("<%= @
|
96
|
-
url("<%= @
|
97
|
-
url("<%= @
|
98
|
-
url("<%= @
|
126
|
+
src: url("<%= @font_path_preview %>.eot");
|
127
|
+
src: url("<%= @font_path_preview %>.eot?#iefix") format("embedded-opentype"),
|
128
|
+
url("<%= @font_path_preview %>.woff") format("woff"),
|
129
|
+
url("<%= @font_path_preview %>.ttf") format("truetype"),
|
130
|
+
url("<%= @font_path_preview %>.svg#<%= @opts.font_name %>") format("svg");
|
99
131
|
font-weight: normal;
|
100
132
|
font-style: normal;
|
101
133
|
}
|
102
134
|
|
135
|
+
[data-icon]:before { content: attr(data-icon); }
|
136
|
+
|
137
|
+
[data-icon]:before,
|
103
138
|
<%= @glyphs.map {|name| ".#{@opts.css_prefix + name}:before"}.join(",\n") %> {
|
104
139
|
font-family: "<%= @opts.font_name %>";
|
105
140
|
font-style: normal;
|
@@ -116,19 +151,29 @@
|
|
116
151
|
</style>
|
117
152
|
|
118
153
|
<!--[if lte IE 8]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
|
154
|
+
|
155
|
+
<script>
|
156
|
+
function toggleCharacters() {
|
157
|
+
var body = document.getElementsByTagName('body')[0];
|
158
|
+
body.className = body.className === 'characters-off' ? '' : 'characters-off';
|
159
|
+
}
|
160
|
+
</script>
|
119
161
|
</head>
|
120
162
|
|
121
163
|
<body>
|
122
|
-
<div class="container">
|
123
|
-
<
|
164
|
+
<div id="page" class="container">
|
165
|
+
<header>
|
166
|
+
<h1><%= @opts.font_name %> contains <%= @glyphs.length %> glyphs:</h1>
|
167
|
+
<a onclick="toggleCharacters(); return false;" href="#">Toggle Preview Characters</a>
|
168
|
+
</header>
|
124
169
|
|
125
170
|
<% @glyphs.each_with_index do |name, index| %>
|
126
171
|
<div class="glyph">
|
127
172
|
<div class="preview-glyphs">
|
128
|
-
<% scale.each do |n| %><
|
173
|
+
<% scale.each do |n| %><span class="step size-<%= n %>"><span class="letters">Pp</span><i class="<%= @opts.css_prefix + name %>"></i></span><% end %>
|
129
174
|
</div>
|
130
175
|
<div class="preview-scale">
|
131
|
-
<% scale.each do |n| %><span class="step"><%= n %></span><% end %>
|
176
|
+
<% scale.each do |n| %><span class="step"><%= n %></span><% end %>
|
132
177
|
</div>
|
133
178
|
<div class="usage">
|
134
179
|
<input class="class" type="text" readonly="readonly" onClick="this.select();" value=".<%= @opts.css_prefix + name %>" />
|
@@ -137,9 +182,9 @@
|
|
137
182
|
</div>
|
138
183
|
<% end %>
|
139
184
|
|
140
|
-
<
|
185
|
+
<footer>
|
141
186
|
Made with love using <a href="http://fontcustom.com">Font Custom</a>.
|
142
|
-
</
|
187
|
+
</footer>
|
143
188
|
</div>
|
144
189
|
</body>
|
145
190
|
</html>
|