typographic-unit 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/config/hoe.rb CHANGED
@@ -65,7 +65,19 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
65
65
 
66
66
  end
67
67
 
68
+ Rake::RDocTask.new(:docs) do |rd|
69
+ rd.main = "README.txt"
70
+ rd.rdoc_dir = "doc"
71
+ Dir.glob("lib/**/*.rb") do |path| rd.rdoc_files << path end
72
+ rd.rdoc_files += ["README.txt", "History.txt", "License.txt"]
73
+ rd.title = GEM_NAME + " documentation"
74
+ rd.options += ["--opname", "index.html",
75
+ "--line-numbers",
76
+ "--inline-source",
77
+ "--charset", "UTF-8"]
78
+ end
79
+
68
80
  CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
69
81
  PATH = RUBYFORGE_PROJECT
70
82
  hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
71
- hoe.rsync_args = '-av --delete --ignore-errors'
83
+ hoe.rsync_args = '-av --delete --ignore-errors'
@@ -2,7 +2,7 @@ module TypographicUnit
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -184,6 +184,7 @@ module TypographicUnit
184
184
  unit :sp, self, 1
185
185
  end
186
186
 
187
+ # TeXPoint is a unit of TeX point. 1 TeX point equals 65536 scaled point.
187
188
  class TeXPoint < Unit
188
189
  unit :pt, ScaledPoint, 65536
189
190
  end
@@ -192,6 +193,7 @@ module TypographicUnit
192
193
  unit :pc, TeXPoint, 12
193
194
  end
194
195
 
196
+ # Inch is a unit of inch. 7227 TeX point equals 100 inch.
195
197
  class Inch < Unit
196
198
  unit :in, TeXPoint, Rational(7227, 100)
197
199
  end
@@ -224,14 +226,68 @@ module TypographicUnit
224
226
  unit :cc, DidotPoint, 12
225
227
  end
226
228
 
227
- # Japanese Q(級)
229
+ # Q is a unit of Japanese Q(級).
228
230
  class Q < Unit
229
231
  unit :q, Millimeter, Rational(25, 100)
230
232
  end
231
233
 
232
- # JIS point
233
- class JISPoint < Unit
234
- unit :jis_pt, Millimeter, Rational(3514, 10000)
234
+ # AmericanPoint is a unit of American point.
235
+ # See http://www.ops.dti.ne.jp/~robundo/TMTaroY01.html for details.
236
+ class AmericanPoint < Unit
237
+ unit :american_pt, Millimeter, Rational(3514, 10000)
238
+ end
239
+
240
+ # JISPoint is a unit of JIS point. JIS point is just same as American point.
241
+ class JISPoint < AmericanPoint
242
+ unit :jis_pt, AmericanPoint, 1
243
+ end
244
+
245
+ # Gou is a unit of Japanese Gou(号).
246
+ # See http://www.um.u-tokyo.ac.jp/publish_db/1996Moji/05/5901.html and
247
+ # http://www.asahi-net.or.jp/~ax2s-kmtn/ref/type_size.html for details.
248
+ # In this library, "初号" is Gou.new(:first) or 0.gou.
249
+ class Gou < Unit
250
+ unit :gou, AmericanPoint, nil
251
+
252
+ def initialize(value)
253
+ if value.kind_of?(Unit)
254
+ raise ArgumentError.new, value
255
+ end
256
+ unless (0..8).include?(value) or value == :first
257
+ raise ArgumentError.new, value
258
+ end
259
+ @value = value
260
+ end
261
+
262
+ # Return a size according to "初号".
263
+ def self.first
264
+ 0.gou
265
+ end
266
+
267
+ # Convert the value into american point.
268
+ def scaled_point
269
+ val = case @value
270
+ when :first, 0
271
+ 42.american_pt
272
+ when 1
273
+ 27.5.american_pt
274
+ when 2
275
+ 21.american_pt
276
+ when 3
277
+ 15.75.american_pt
278
+ when 4
279
+ 13.75.american_pt
280
+ when 5
281
+ 10.5.american_pt
282
+ when 6
283
+ 7.875.american_pt
284
+ when 7
285
+ 5.25.american_pt
286
+ when 8
287
+ 3.9375.american_pt
288
+ end
289
+ val.kind_of?(ScaledPoint) ? val : val.scaled_point
290
+ end
235
291
  end
236
292
  end
237
293
 
@@ -53,6 +53,10 @@ describe TypographicUnit do
53
53
  1.jis_pt.should == 0.3514.mm
54
54
  end
55
55
 
56
+ it "1.american_pt == 1.jis_pt" do
57
+ 1.american_pt.should == 1.jis_pt
58
+ end
59
+
56
60
  it "1.cm - 1.mm == 0.8.cm + 1.mm" do
57
61
  (1.cm - 1.mm).should == 0.8.cm + 1.mm
58
62
  end
@@ -279,3 +283,45 @@ describe TypographicUnit::Meter do
279
283
  (0.0254.m >> :in).should == 1.in
280
284
  end
281
285
  end
286
+
287
+ describe TypographicUnit::Gou do
288
+ it "0.gou => 42.american_pt" do
289
+ (0.gou >> :american_pt).should == 42.american_pt
290
+ end
291
+
292
+ it "Gou.first => 0.gou" do
293
+ TypographicUnit::Gou.first.should == 0.gou
294
+ end
295
+
296
+ it "0.gou => 2.gou x 2" do
297
+ (0.gou >> :american_pt).should == (2.gou >> :american_pt) * 2
298
+ end
299
+
300
+ it "2.gou => 5.gou x 2" do
301
+ (2.gou >> :american_pt).should == (5.gou >> :american_pt) * 2
302
+ end
303
+
304
+ it "5.gou => 7.gou x 2" do
305
+ (5.gou >> :american_pt).should == (7.gou >> :american_pt) * 2
306
+ end
307
+
308
+ it "1.gou => 27.5.american_pt" do
309
+ (1.gou >> :american_pt).should == 27.5.american_pt
310
+ end
311
+
312
+ it "1.gou => 4.gou x 2" do
313
+ (1.gou >> :american_pt).should == (4.gou >> :american_pt) * 2
314
+ end
315
+
316
+ it "3.gou => 15.75.american_pt" do
317
+ (3.gou >> :american_pt).should == 15.75.american_pt
318
+ end
319
+
320
+ it "3.gou => 6.gou x 2" do
321
+ (3.gou >> :american_pt).should == (6.gou >> :american_pt) * 2
322
+ end
323
+
324
+ it "6.gou => 8.gou x 2" do
325
+ (6.gou >> :american_pt).should == (8.gou >> :american_pt) * 2
326
+ end
327
+ end
data/website/index.html CHANGED
@@ -33,7 +33,7 @@
33
33
  <h1>TypographicUnit</h1>
34
34
  <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/typographicunit"; return false'>
35
35
  <p>Get Version</p>
36
- <a href="http://rubyforge.org/projects/typographicunit" class="numbers">0.1.0</a>
36
+ <a href="http://rubyforge.org/projects/typographicunit" class="numbers">0.1.1</a>
37
37
  </div>
38
38
  <h2>What</h2>
39
39
 
@@ -55,7 +55,9 @@ to TeX. This library can handle the following units:</p>
55
55
  <li>Didot Point(dd)</li>
56
56
  <li>Cicero(cc)</li>
57
57
  <li>Japanese Q(q)</li>
58
+ <li>American Point(american_pt)</li>
58
59
  <li><span class="caps">JIS</span> Point(jis_pt)</li>
60
+ <li>Japanese Gou(gou)</li>
59
61
  </ul>
60
62
 
61
63
 
@@ -151,15 +153,23 @@ to TeX. This library can handle the following units:</p>
151
153
  <p>Comments are welcome. Send an email to <a href="mailto:keita.yamaguchi@gmail.com">Keita Yamaguchi</a> via the <a href="http://groups.google.com/group/ruby-typographic-unit">forum</a></p>
152
154
 
153
155
 
154
- <h2>Links</h2>
155
-
156
-
156
+ <h2>Links
157
+ <ul>
158
+ <li>TypographicUnit
157
159
  <ul>
158
160
  <li><a href="http://typographicunit.rubyforge.org/">Project Home</a></li>
159
161
  <li><a href="http://rubyforge.org/projects/typographicunit/">RubyForge/TypographicUnit</a></li>
160
162
  </ul>
163
+ </li>
164
+ <li>Reference
165
+ <ul>
166
+ <li><a href="http://ja.wikipedia.org/wiki/%E6%B4%BB%E5%AD%97">Wikipedia:活字</a></li>
167
+ <li><a href="http://www.um.u-tokyo.ac.jp/publish_db/1996Moji/05/5901.html">歴史の文字 記載・活字・活版 第三部 活版の世界</a></li>
168
+ <li><a href="http://www.asahi-net.or.jp/~ax2s-kmtn/ref/type_size.html">CyberLibrarian:文字サイズ</a></li>
169
+ </ul></li>
170
+ </ul></h2>
161
171
  <p class="coda">
162
- <a href="keita.yamaguchi@gmail.com">Keita Yamaguchi</a>, 19th December 2007<br>
172
+ <a href="keita.yamaguchi@gmail.com">Keita Yamaguchi</a>, 30th December 2007<br>
163
173
  Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
164
174
  </p>
165
175
  </div>
data/website/index.txt CHANGED
@@ -17,7 +17,9 @@ to TeX. This library can handle the following units:
17
17
  * Didot Point(dd)
18
18
  * Cicero(cc)
19
19
  * Japanese Q(q)
20
+ * American Point(american_pt)
20
21
  * JIS Point(jis_pt)
22
+ * Japanese Gou(gou)
21
23
 
22
24
  h2. Installing
23
25
 
@@ -92,6 +94,10 @@ h2. Contact
92
94
  Comments are welcome. Send an email to "Keita Yamaguchi":mailto:keita.yamaguchi@gmail.com via the "forum":http://groups.google.com/group/ruby-typographic-unit
93
95
 
94
96
  h2. Links
95
-
96
- * "Project Home":http://typographicunit.rubyforge.org/
97
- * "RubyForge/TypographicUnit":http://rubyforge.org/projects/typographicunit/
97
+ * TypographicUnit
98
+ ** "Project Home":http://typographicunit.rubyforge.org/
99
+ ** "RubyForge/TypographicUnit":http://rubyforge.org/projects/typographicunit/
100
+ * Reference
101
+ ** "Wikipedia:活字":http://ja.wikipedia.org/wiki/%E6%B4%BB%E5%AD%97
102
+ ** "歴史の文字 記載・活字・活版 第三部 活版の世界":http://www.um.u-tokyo.ac.jp/publish_db/1996Moji/05/5901.html
103
+ ** "CyberLibrarian:文字サイズ":http://www.asahi-net.or.jp/~ax2s-kmtn/ref/type_size.html
metadata CHANGED
@@ -1,33 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.2
3
- specification_version: 1
4
2
  name: typographic-unit
5
3
  version: !ruby/object:Gem::Version
6
- version: 0.1.0
7
- date: 2007-12-19 00:00:00 +09:00
8
- summary: TypographicUnit is a library for converting between typographic units according to TeX.
9
- require_paths:
10
- - lib
11
- email: keita.yamaguchi@gmail.com
12
- homepage: http://typographicunit.rubyforge.org
13
- rubyforge_project: typographicunit
14
- description: TypographicUnit is a library for converting between typographic units according to TeX.
15
- autorequire:
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
4
+ version: 0.1.1
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors:
30
7
  - Keita Yamaguchi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2007-12-30 00:00:00 +09:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: TypographicUnit is a library for converting between typographic units according to TeX.
17
+ email: keita.yamaguchi@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - History.txt
24
+ - License.txt
25
+ - Manifest.txt
26
+ - README.txt
27
+ - website/index.txt
31
28
  files:
32
29
  - History.txt
33
30
  - License.txt
@@ -55,22 +52,32 @@ files:
55
52
  - website/javascripts/rounded_corners_lite.inc.js
56
53
  - website/stylesheets/screen.css
57
54
  - website/template.rhtml
58
- test_files: []
59
-
55
+ has_rdoc: true
56
+ homepage: http://typographicunit.rubyforge.org
57
+ post_install_message:
60
58
  rdoc_options:
61
59
  - --main
62
60
  - README.txt
63
- extra_rdoc_files:
64
- - History.txt
65
- - License.txt
66
- - Manifest.txt
67
- - README.txt
68
- - website/index.txt
69
- executables: []
70
-
71
- extensions: []
72
-
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: "0"
68
+ version:
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: "0"
74
+ version:
73
75
  requirements: []
74
76
 
75
- dependencies: []
77
+ rubyforge_project: typographicunit
78
+ rubygems_version: 1.0.1
79
+ signing_key:
80
+ specification_version: 2
81
+ summary: TypographicUnit is a library for converting between typographic units according to TeX.
82
+ test_files: []
76
83