cjk-subsetter 0.0.3 → 0.0.4

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: 8357489133e8160fb56635f18577855b918d79dd
4
- data.tar.gz: b49c453c2e97b7cfdd4b2da5f5e8cd049556aa4b
3
+ metadata.gz: ce301c2cc33eb446ed7e7ea98db2750c2929fa7f
4
+ data.tar.gz: 4c10cd516d6658dea61c6ec2860e7bc3ab93d22d
5
5
  SHA512:
6
- metadata.gz: efbd59f6907c83f2d63afe97014d5590d3a0996b0a6420c9b577660fe4ceadcc2f6ab4c75d7087e9fc18ffa839852c20351483bf7ea27f775d59521590d8d1eb
7
- data.tar.gz: 0b28530f575f313437a600ec1752c0bbd3a8e6e5ac14c73ae1bf89f8b1c594221db9cc4ec6226d70412f165ce3ad607a8c36ef527695e98b837e55249de88a05
6
+ metadata.gz: ff327850d2fd7ddd47e459566059e182863acf1df4e3b11399d00e82e167b4e3933bc813a3bf0d13b0b91c795ccf070ec5e32c9cf735ae272aa14dc9bc9bd02e
7
+ data.tar.gz: 1e3a8b92349a302ef91fa1c46ecd99e408fb7af1ab16771c10621bb40981aef34ce74389f1fa89aa0904ae6c33ed816d45b18775b385a7d9d59395002959cd5c
data/lib/rack/style.erb CHANGED
@@ -2,7 +2,8 @@
2
2
  @font-face
3
3
  {
4
4
  font-family: <%= font_key %>;
5
- src: url('<%= font_url %>');
5
+ src: url("<%= font_url['.woff'] %>") format("woff"),
6
+ url("<%= font_url['.ttf'] %>") format("truetype");
6
7
  }
7
8
  <%= klass %> { font-family: <%= font_key %>; }
8
9
  </style>
@@ -70,8 +70,10 @@ module Rack
70
70
  @subset_string_map.each do |font_key, chars_map|
71
71
  subset_string = chars_map.map { |key, value| key }.join
72
72
  font_name = @font_map[font_key].join
73
+ klass = '.%s-' % @prefix + font_key
74
+ font_url = {}
73
75
 
74
- ['.ttf', '.eot'].each do |file_type|
76
+ ['.ttf', '.woff'].each do |file_type|
75
77
  file_path = create_path(subset_string, font_name, file_type)
76
78
  file_is_eot = file_type == '.eot'
77
79
 
@@ -80,7 +82,7 @@ module Rack
80
82
  args = ["java", "-jar", "#{@sfnttool}"]
81
83
 
82
84
  if file_is_eot
83
- args.push "-e"
85
+ args.push "-w"
84
86
  end
85
87
 
86
88
  args.concat ["-s", "#{subset_string}",
@@ -90,11 +92,10 @@ module Rack
90
92
  end
91
93
 
92
94
  p_output = Pathname.new file_path
93
- font_url = @relative_url_root + \
95
+ font_url[file_type] = @relative_url_root + \
94
96
  p_output.relative_path_from(p_public).to_s
95
- klass = '.%s-' % @prefix + font_key
96
- new_body.gsub!(%r{</head>}, template.result(binding) + "</head>")
97
97
  end
98
+ new_body.gsub!(%r{</head>}, template.result(binding) + "</head>")
98
99
  end
99
100
 
100
101
  response.write new_body
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cjk-subsetter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - hxgdzyuyi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-02 00:00:00.000000000 Z
11
+ date: 2014-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri