cjk-subsetter 0.0.1 → 0.0.2

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: f5a3ca8ccd0b7ada0d8f57abcd5213e262a13b76
4
- data.tar.gz: 647e81a6abc23b72af8a998fb0e18b8d2f689c2e
3
+ metadata.gz: c12a9b32b801801da765babd0edf4e4f6f064e42
4
+ data.tar.gz: 7ad44799b33606fc4a8df72aa2fdd5f474456e79
5
5
  SHA512:
6
- metadata.gz: a6319e989c38971de7570417eb2bec62e7e90e07d769861c6a3902bf438c04732cb1740789a132874ae22cb0fb9da280f1e743323a146ec1e6a851bf78a59bff
7
- data.tar.gz: 185fd7eaa06bf1b43c6e177bf3683899fd9bfa6a5fc4ad50b420327a2a082e7c9ac03fc8a7e9dfc6a1db2d9b37f67ad0588ffb41d64db69214b06b5c296b4281
6
+ metadata.gz: 305a2cd05ac25a473a08a5b50782b7f2fc12fd9b96aefb592323e283e61ecae4a31cd04990d1e7f8221fd51a29e49eb4efe50c06621bae339dc73a9d522aa212
7
+ data.tar.gz: 4acd54f28c119332eb4eba9fe9f941aaf226a0c52ef3419871897f5766e70d4797c89e2e55e2db9b5b50644b9402dd14c334e843a11063cc0704db2c4d55d43b
data/README.md ADDED
@@ -0,0 +1,17 @@
1
+ = subsetter
2
+
3
+ 可以在网页中使用中文字体的 Rack 程序。
4
+
5
+ === 原理
6
+
7
+ 通过 sfntly (code.google.com/p/sfntly/) 来切割中文字体
8
+
9
+ === 依赖
10
+
11
+ - java 环境
12
+ - Ruby
13
+
14
+ === 感谢以下开源项目
15
+
16
+ - sfntly https://code.google.com/p/sfntly/
17
+
data/lib/rack/style.erb CHANGED
@@ -2,7 +2,7 @@
2
2
  @font-face
3
3
  {
4
4
  font-family: <%= font_key %>;
5
- src: url('/<%= relative_path %>');
5
+ src: url('<%= font_url %>');
6
6
  }
7
7
  <%= klass %> { font-family: <%= font_key %>; }
8
8
  </style>
@@ -13,6 +13,7 @@ module Rack
13
13
  @font_map = options[:font_map]
14
14
  @font_source = options[:font_source]
15
15
  @public_path = options[:font_dist][:public_path]
16
+ @relative_url_root = options[:relative_url_root] || '/'
16
17
  @font_dist = ::File.expand_path(options[:font_dist][:dir], @public_path)
17
18
  @sfnttool = ::File.expand_path("../tools/sfnttool.jar", __FILE__)
18
19
  end
@@ -78,7 +79,8 @@ module Rack
78
79
  end
79
80
 
80
81
  p_output = Pathname.new file_path
81
- relative_path = p_output.relative_path_from p_public
82
+ font_url = @relative_url_root + \
83
+ p_output.relative_path_from(p_public).to_s
82
84
  klass = '.%s-' % @prefix + font_key
83
85
  new_body.gsub!(%r{</head>}, template.result(binding) + "</head>")
84
86
  end
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.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - hxgdzyuyi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-20 00:00:00.000000000 Z
11
+ date: 2013-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -141,12 +141,12 @@ email: hxgdzyuyi@gmail.com
141
141
  executables: []
142
142
  extensions: []
143
143
  extra_rdoc_files:
144
- - README.rdoc
144
+ - README.md
145
145
  files:
146
146
  - lib/rack/style.erb
147
147
  - lib/rack/subsetter.rb
148
148
  - lib/rack/tools/sfnttool.jar
149
- - README.rdoc
149
+ - README.md
150
150
  homepage: https://bitbucket.org/hxgdzyuyi/cjk-subsetter/overview
151
151
  licenses:
152
152
  - Apache License 2.0
data/README.rdoc DELETED
@@ -1,19 +0,0 @@
1
- = subsetter
2
-
3
- Description goes here.
4
-
5
- == Contributing to subsetter
6
-
7
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
- * Fork the project.
10
- * Start a feature/bugfix branch.
11
- * Commit and push until you are happy with your contribution.
12
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
-
15
- == Copyright
16
-
17
- Copyright (c) 2013 yangqing. See LICENSE.txt for
18
- further details.
19
-