prawn 0.2.3 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. data/README +6 -10
  2. data/Rakefile +4 -13
  3. data/data/encodings/win_ansi.txt +29 -0
  4. data/data/images/fractal.jpg +0 -0
  5. data/data/images/letterhead.jpg +0 -0
  6. data/examples/bounding_box/bounding_boxes.rb +44 -0
  7. data/examples/bounding_box/lazy_bounding_boxes.rb +28 -0
  8. data/examples/bounding_box/padded_box.rb +24 -0
  9. data/examples/{russian_boxes.rb → bounding_box/russian_boxes.rb} +9 -6
  10. data/examples/general/background.rb +20 -0
  11. data/examples/{canvas.rb → general/canvas.rb} +6 -2
  12. data/examples/general/measurement_units.rb +52 -0
  13. data/examples/{multi_page_layout.rb → general/multi_page_layout.rb} +6 -3
  14. data/examples/{page_geometry.rb → general/page_geometry.rb} +6 -2
  15. data/examples/{image.rb → graphics/basic_images.rb} +8 -4
  16. data/examples/graphics/cmyk.rb +13 -0
  17. data/examples/graphics/curves.rb +12 -0
  18. data/examples/{hexagon.rb → graphics/hexagon.rb} +5 -5
  19. data/examples/graphics/image_fit.rb +16 -0
  20. data/examples/graphics/image_flow.rb +38 -0
  21. data/examples/graphics/image_position.rb +18 -0
  22. data/examples/{line.rb → graphics/line.rb} +4 -2
  23. data/examples/{png_types.rb → graphics/png_types.rb} +4 -4
  24. data/examples/{polygons.rb → graphics/polygons.rb} +5 -4
  25. data/examples/graphics/remote_images.rb +12 -0
  26. data/examples/{ruport_helpers.rb → graphics/ruport_style_helpers.rb} +8 -5
  27. data/examples/graphics/stroke_bounds.rb +23 -0
  28. data/examples/{chinese_text_wrapping.rb → m17n/chinese_text_wrapping.rb} +7 -4
  29. data/examples/m17n/euro.rb +16 -0
  30. data/examples/m17n/sjis.rb +29 -0
  31. data/examples/m17n/utf8.rb +14 -0
  32. data/examples/m17n/win_ansi_charset.rb +55 -0
  33. data/examples/{addressbook.csv → table/addressbook.csv} +0 -0
  34. data/examples/{cell.rb → table/cell.rb} +8 -6
  35. data/examples/{currency.csv → table/currency.csv} +0 -0
  36. data/examples/{fancy_table.rb → table/fancy_table.rb} +9 -6
  37. data/examples/{ruport_formatter.rb → table/ruport_formatter.rb} +6 -3
  38. data/examples/{table.rb → table/table.rb} +6 -2
  39. data/examples/table/table_alignment.rb +18 -0
  40. data/examples/table/table_border_color.rb +17 -0
  41. data/examples/table/table_colspan.rb +19 -0
  42. data/examples/table/table_header_color.rb +19 -0
  43. data/examples/table/table_header_underline.rb +15 -0
  44. data/examples/{alignment.rb → text/alignment.rb} +5 -2
  45. data/examples/text/family_based_styling.rb +25 -0
  46. data/examples/{flowing_text_with_header_and_footer.rb → text/flowing_text_with_header_and_footer.rb} +19 -8
  47. data/examples/text/font_calculations.rb +91 -0
  48. data/examples/text/font_size.rb +34 -0
  49. data/examples/{kerning.rb → text/kerning.rb} +5 -1
  50. data/examples/text/simple_text.rb +18 -0
  51. data/examples/text/simple_text_ttf.rb +18 -0
  52. data/examples/{span.rb → text/span.rb} +5 -2
  53. data/examples/text/text_box.rb +26 -0
  54. data/examples/{text_flow.rb → text/text_flow.rb} +5 -2
  55. data/lib/prawn.rb +26 -20
  56. data/lib/prawn/compatibility.rb +5 -8
  57. data/lib/prawn/document.rb +29 -13
  58. data/lib/prawn/document/annotations.rb +63 -0
  59. data/lib/prawn/document/bounding_box.rb +18 -3
  60. data/lib/prawn/document/destinations.rb +81 -0
  61. data/lib/prawn/document/internals.rb +16 -2
  62. data/lib/prawn/document/page_geometry.rb +58 -57
  63. data/lib/prawn/document/span.rb +8 -0
  64. data/lib/prawn/document/table.rb +81 -31
  65. data/lib/prawn/document/text.rb +66 -21
  66. data/lib/prawn/document/text/box.rb +77 -0
  67. data/lib/prawn/encoding.rb +121 -0
  68. data/lib/prawn/errors.rb +4 -0
  69. data/lib/prawn/font.rb +70 -42
  70. data/lib/prawn/font/metrics.rb +64 -119
  71. data/lib/prawn/graphics.rb +105 -87
  72. data/lib/prawn/graphics/cell.rb +55 -28
  73. data/lib/prawn/graphics/color.rb +8 -0
  74. data/lib/prawn/images.rb +55 -12
  75. data/lib/prawn/images/jpg.rb +2 -1
  76. data/lib/prawn/images/png.rb +2 -1
  77. data/lib/prawn/literal_string.rb +14 -0
  78. data/lib/prawn/measurement_extensions.rb +46 -0
  79. data/lib/prawn/measurements.rb +71 -0
  80. data/lib/prawn/name_tree.rb +165 -0
  81. data/lib/prawn/pdf_object.rb +8 -1
  82. data/spec/annotations_spec.rb +90 -0
  83. data/spec/destinations_spec.rb +15 -0
  84. data/spec/document_spec.rb +39 -2
  85. data/spec/font_spec.rb +22 -0
  86. data/spec/graphics_spec.rb +99 -87
  87. data/spec/images_spec.rb +29 -1
  88. data/spec/measurement_units_spec.rb +23 -0
  89. data/spec/metrics_spec.rb +3 -2
  90. data/spec/name_tree_spec.rb +103 -0
  91. data/spec/pdf_object_spec.rb +15 -5
  92. data/spec/png_spec.rb +14 -14
  93. data/spec/spec_helper.rb +8 -6
  94. data/spec/table_spec.rb +40 -0
  95. data/spec/text_spec.rb +6 -4
  96. data/vendor/ttfunk/data/fonts/DejaVuSans.ttf +0 -0
  97. data/vendor/ttfunk/data/fonts/comicsans.ttf +0 -0
  98. data/vendor/ttfunk/example.rb +5 -0
  99. data/vendor/ttfunk/lib/ttfunk.rb +48 -0
  100. data/vendor/ttfunk/lib/ttfunk/table.rb +27 -0
  101. data/vendor/ttfunk/lib/ttfunk/table/cmap.rb +94 -0
  102. data/vendor/ttfunk/lib/ttfunk/table/directory.rb +25 -0
  103. data/vendor/ttfunk/lib/ttfunk/table/head.rb +25 -0
  104. data/vendor/ttfunk/lib/ttfunk/table/hhea.rb +27 -0
  105. data/vendor/ttfunk/lib/ttfunk/table/hmtx.rb +20 -0
  106. data/vendor/ttfunk/lib/ttfunk/table/kern.rb +48 -0
  107. data/vendor/ttfunk/lib/ttfunk/table/maxp.rb +17 -0
  108. data/vendor/ttfunk/lib/ttfunk/table/name.rb +52 -0
  109. metadata +93 -62
  110. data/examples/bounding_boxes.rb +0 -30
  111. data/examples/curves.rb +0 -10
  112. data/examples/family_based_styling.rb +0 -21
  113. data/examples/font_size.rb +0 -19
  114. data/examples/image2.rb +0 -13
  115. data/examples/image_flow.rb +0 -29
  116. data/examples/lazy_bounding_boxes.rb +0 -19
  117. data/examples/remote_images.rb +0 -7
  118. data/examples/simple_text.rb +0 -15
  119. data/examples/simple_text_ttf.rb +0 -16
  120. data/examples/sjis.rb +0 -21
  121. data/examples/utf8.rb +0 -12
  122. data/vendor/font_ttf/ttf.rb +0 -20
  123. data/vendor/font_ttf/ttf/datatypes.rb +0 -189
  124. data/vendor/font_ttf/ttf/encodings.rb +0 -140
  125. data/vendor/font_ttf/ttf/exceptions.rb +0 -28
  126. data/vendor/font_ttf/ttf/file.rb +0 -290
  127. data/vendor/font_ttf/ttf/fontchunk.rb +0 -77
  128. data/vendor/font_ttf/ttf/table/cmap.rb +0 -408
  129. data/vendor/font_ttf/ttf/table/cvt.rb +0 -49
  130. data/vendor/font_ttf/ttf/table/fpgm.rb +0 -48
  131. data/vendor/font_ttf/ttf/table/gasp.rb +0 -88
  132. data/vendor/font_ttf/ttf/table/glyf.rb +0 -452
  133. data/vendor/font_ttf/ttf/table/head.rb +0 -86
  134. data/vendor/font_ttf/ttf/table/hhea.rb +0 -96
  135. data/vendor/font_ttf/ttf/table/hmtx.rb +0 -98
  136. data/vendor/font_ttf/ttf/table/kern.rb +0 -186
  137. data/vendor/font_ttf/ttf/table/loca.rb +0 -75
  138. data/vendor/font_ttf/ttf/table/maxp.rb +0 -81
  139. data/vendor/font_ttf/ttf/table/name.rb +0 -222
  140. data/vendor/font_ttf/ttf/table/os2.rb +0 -172
  141. data/vendor/font_ttf/ttf/table/post.rb +0 -120
  142. data/vendor/font_ttf/ttf/table/prep.rb +0 -27
  143. data/vendor/font_ttf/ttf/table/vhea.rb +0 -45
  144. data/vendor/font_ttf/ttf/table/vmtx.rb +0 -36
@@ -1,30 +0,0 @@
1
- $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
2
- require 'prawn'
3
-
4
- Prawn::Document.generate("bounding_boxes.pdf") do
5
-
6
- bounding_box [100,600], :width => 200 do
7
- text "The rain in spain falls mainly on the plains " * 5
8
- stroke do
9
- line bounds.top_left, bounds.top_right
10
- line bounds.bottom_left, bounds.bottom_right
11
- end
12
- end
13
-
14
- bounding_box [100,500], :width => 200, :height => 200 do
15
- stroke do
16
- circle_at [100,100], :radius => 100
17
- line bounds.top_left, bounds.bottom_right
18
- line bounds.top_right, bounds.bottom_left
19
- end
20
-
21
- bounding_box [50,150], :width => 100, :height => 100 do
22
- stroke_rectangle bounds.top_left, bounds.width, bounds.height
23
- end
24
- end
25
-
26
- end
27
-
28
-
29
-
30
-
@@ -1,10 +0,0 @@
1
- # encoding: utf-8
2
-
3
- $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
4
- require "prawn"
5
-
6
- pdf = Prawn::Document.new
7
- pdf.move_to [100,100]
8
- pdf.stroke_curve_to [50,50],:bounds => [[20,90], [90,90]]
9
- pdf.fill_circle_at [200,200], :radius => 10
10
- pdf.render_file "curves.pdf"
@@ -1,21 +0,0 @@
1
- # coding: utf-8
2
-
3
- $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
4
- require "prawn"
5
-
6
- Prawn::Document.generate("family_style.pdf") do
7
- ["Courier","Helvetica","Times-Roman"].each do |f|
8
- [:bold,:bold_italic,:italic,:normal].each do |s|
9
- font f, :style => s
10
- text "I'm writing in #{f} (#{s})"
11
- end
12
- end
13
-
14
- font "Helvetica"
15
-
16
- text "Normal"
17
- text "Bold", :style => :bold
18
- text "Bold Italic", :style => :bold_italic
19
- text "Italic", :style => :italic
20
- text "Normal"
21
- end
@@ -1,19 +0,0 @@
1
- # encoding: utf-8
2
-
3
- $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
4
- require "prawn"
5
-
6
- Prawn::Document.generate "font_size.pdf", :page_size => "A4" do
7
- font 'Helvetica'
8
- font.size = 16
9
-
10
- text 'Font at 16 point'
11
-
12
- font.size 9 do
13
- text 'Font at 9 point'
14
- text 'Font at manual override 20 point', :size => 20
15
- text 'Font at 9 point'
16
- end
17
-
18
- text 'Font at 16 point'
19
- end
@@ -1,13 +0,0 @@
1
- # encoding: utf-8
2
-
3
- $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
4
- require "prawn"
5
-
6
- Prawn::Document.generate("image2.pdf", :page_layout => :landscape) do
7
- pigs = "#{Prawn::BASEDIR}/data/images/pigs.jpg"
8
- image pigs, :at => [50,450], :width => 450
9
-
10
- dice = "#{Prawn::BASEDIR}/data/images/dice.png"
11
- image dice, :at => [50, 450], :scale => 0.75
12
- end
13
-
@@ -1,29 +0,0 @@
1
- # encoding: utf-8
2
-
3
- $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
4
- require "prawn"
5
-
6
- Prawn::Document.generate("image-flow.pdf", :page_layout => :landscape) do
7
- stef = "#{Prawn::BASEDIR}/data/images/stef.jpg"
8
-
9
- text "o hai"
10
-
11
- image stef
12
-
13
- text "flowing text"
14
-
15
- image stef, :position => :center
16
-
17
- text "beneath images"
18
-
19
- image stef, :position => :right
20
-
21
- text "again"
22
-
23
- image stef, :position => :left
24
-
25
- text "and again"
26
-
27
- image stef, :position => 50
28
-
29
- end
@@ -1,19 +0,0 @@
1
- $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
2
- require "prawn"
3
-
4
- file = "lazy_bounding_boxes.pdf"
5
- Prawn::Document.generate(file, :skip_page_creation => true) do
6
- point = [bounds.right-50, bounds.bottom + 25]
7
- page_counter = lazy_bounding_box(point, :width => 50) do
8
- text "Page: #{page_count}"
9
- end
10
-
11
- 10.times do
12
- start_new_page
13
- text "Some text"
14
- page_counter.draw
15
- end
16
- end
17
-
18
-
19
-
@@ -1,7 +0,0 @@
1
- $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
2
- require "prawn"
3
- require "open-uri"
4
-
5
- Prawn::Document.generate("remote_images.pdf") do
6
- image open("http://prawn.majesticseacreature.com/media/prawn_logo.png")
7
- end
@@ -1,15 +0,0 @@
1
- # encoding: utf-8
2
-
3
- $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
4
- require "prawn"
5
-
6
- Prawn::Document.generate "hello.pdf" do
7
- fill_color "0000ff"
8
- text "Hello World", :at => [200,720], :size => 32
9
- font "Times-Roman"
10
- fill_color "ff0000"
11
- text "Overcoming singular font limitation", :at => [5,5]
12
- start_new_page
13
- font "Courier"
14
- text "Goodbye World", :at => [288,50]
15
- end
@@ -1,16 +0,0 @@
1
- # encoding: utf-8
2
-
3
- $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
4
- require "prawn"
5
-
6
- Prawn::Document.generate "hello-ttf.pdf" do
7
- fill_color "0000ff"
8
- font "#{Prawn::BASEDIR}/data/fonts/comicsans.ttf"
9
- text "Hello World", :at => [200,720], :size => 32
10
-
11
- font "#{Prawn::BASEDIR}/data/fonts/Chalkboard.ttf"
12
-
13
- pad(20) do
14
- text "This is chalkboard wrapping " * 20
15
- end
16
- end
@@ -1,21 +0,0 @@
1
- # coding: utf-8
2
-
3
- # Tests passing non utf-8 data into Prawns text function. Should
4
- # be transparently converted to utf-8 and rendered as usual.
5
- #
6
- # NOTE: only works on ruby1.9 compatible VMs, and requires the current
7
- # font to include japanese glyphs. On 1.8.x comaptible VMs, an exception
8
- # will be raised.
9
-
10
- $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
11
- require "prawn"
12
-
13
- ruby_19 do
14
- datafile = File.join(File.dirname(__FILE__), "..", "data", "shift_jis_text.txt")
15
- sjis_str = File.open(datafile, "r:shift_jis") { |f| f.gets }
16
-
17
- Prawn::Document.generate("sjis.pdf") do
18
- font "#{Prawn::BASEDIR}/data/fonts/gkai00mp.ttf"
19
- text sjis_str
20
- end
21
- end
@@ -1,12 +0,0 @@
1
- # coding: utf-8
2
-
3
- $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
4
- require "prawn"
5
-
6
- Prawn::Document.generate("utf8.pdf") do
7
- font "#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf"
8
- text "ὕαλον ϕαγεῖν δύναμαι· τοῦτο οὔ με βλάπτει." * 20
9
- end
10
-
11
-
12
-
@@ -1,20 +0,0 @@
1
- # TTF/Ruby, a library to read and write TrueType fonts in Ruby.
2
- # Copyright (C) 2006 Mathieu Blondel
3
- #
4
- # This program is free software; you can redistribute it and/or modify
5
- # it under the terms of the GNU General Public License as published by
6
- # the Free Software Foundation; either version 2 of the License, or
7
- # (at your option) any later version.
8
- #
9
- # This program is distributed in the hope that it will be useful,
10
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- # GNU General Public License for more details.
13
- #
14
- # You should have received a copy of the GNU General Public License
15
- # along with this program; if not, write to the Free Software
16
- # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
-
18
- require 'ttf/file'
19
-
20
-
@@ -1,189 +0,0 @@
1
- # TTF/Ruby, a library to read and write TrueType fonts in Ruby.
2
- # Copyright (C) 2006 Mathieu Blondel
3
- #
4
- # This program is free software; you can redistribute it and/or modify
5
- # it under the terms of the GNU General Public License as published by
6
- # the Free Software Foundation; either version 2 of the License, or
7
- # (at your option) any later version.
8
- #
9
- # This program is distributed in the hope that it will be useful,
10
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- # GNU General Public License for more details.
13
- #
14
- # You should have received a copy of the GNU General Public License
15
- # along with this program; if not, write to the Free Software
16
- # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
-
18
- class IO
19
- SIZEOF_USHORT = 2
20
- SIZEOF_ULONG = 4
21
- SIZEOF_FIXED = 4
22
- SIZEOF_LONG_DATE_TIME = 8
23
- SIZEOF_SHORT = SIZEOF_FWORD = 2
24
- SHORT_BOUND = 2 ** (8 * SIZEOF_SHORT - 1)
25
- USHORT_BOUND = SHORT_BOUND * 2
26
-
27
- def at_offset(offset)
28
- prev_pos = self.pos
29
- self.pos = offset
30
- ret = yield
31
- self.pos = prev_pos
32
- ret
33
- end
34
-
35
- alias :old_read :read
36
-
37
- #ef read(n)
38
- # ret = old_read(n)
39
- # raise Font::TTF::MalformedFont if ret.nil?
40
- # ret
41
- #end
42
-
43
- def read_ushort
44
- read(SIZEOF_USHORT).unpack("n")[0]
45
- end
46
- alias :read_ufword :read_ushort
47
- alias :read_f2dot14 :read_ushort
48
-
49
- def read_ushorts(n)
50
- read(SIZEOF_USHORT * n).unpack("n#{n.to_s}")
51
- end
52
- alias :read_ufwords :read_ushorts
53
- alias :read_f2dot14s :read_ushorts
54
-
55
- def read_ulong
56
- read(SIZEOF_ULONG).unpack("N")[0]
57
- end
58
-
59
- def read_ulongs(n)
60
- read(SIZEOF_ULONG * n).unpack("N#{n.to_s}")
61
- end
62
-
63
- def read_fixed
64
- f = read_ulong
65
- #"%d.%d" % [f >> 16, f & 0xff00]
66
- end
67
-
68
- def read_ulong_as_text
69
- read(SIZEOF_ULONG)
70
- end
71
-
72
- def read_byte
73
- read(1).unpack("C")[0]
74
- end
75
-
76
- def read_bytes(n)
77
- read(n).unpack("C" + n.to_s)
78
- end
79
-
80
- def read_long_date_time
81
- # Don't know how to compute dates
82
- read(SIZEOF_LONG_DATE_TIME)
83
- ""
84
- end
85
-
86
- def read_short
87
- # No unpack support for signed network short
88
- n = read_ushort
89
- n = n - 2 * SHORT_BOUND if n >= SHORT_BOUND
90
- n
91
- end
92
- alias :read_fword :read_short
93
-
94
- def read_shorts(n)
95
- arr = []
96
- n.times { arr << read_short }
97
- arr
98
- end
99
- alias :read_fwords :read_shorts
100
-
101
- def read_char
102
- read(1)
103
- end
104
-
105
- def read_chars(n)
106
- read(n)
107
- end
108
-
109
- end
110
-
111
- class Integer
112
-
113
- def to_ushort
114
- [self].pack("n")
115
- end
116
- alias :to_ufword :to_ushort
117
- alias :to_f2dot14 :to_ushort
118
-
119
- def to_ulong
120
- [self].pack("N")
121
- end
122
- alias :to_fixed :to_ulong
123
-
124
- def to_short
125
- n = self
126
- n + 2 * IO::SHORT_BOUND if n < 0
127
- n.to_ushort
128
- end
129
- alias :to_fword :to_short
130
-
131
- def to_byte
132
- [self].pack("C")
133
- end
134
-
135
- end
136
-
137
- class String
138
-
139
- def to_long_date_time
140
- # Don't know how to compute dates
141
- # So just returns something at the good size
142
- " " * IO::SIZEOF_LONG_DATE_TIME
143
- end
144
-
145
- def four_chars!
146
- str = self
147
- while str.length < 4
148
- str += " "
149
- end
150
- self.replace(str.slice(0,4))
151
- end
152
- end
153
-
154
- class Array
155
-
156
- def to_bytes
157
- self.pack("C*")
158
- end
159
-
160
- def to_ushorts
161
- self.pack("n*")
162
- end
163
- alias :to_ufwords :to_ushorts
164
- alias :to_f2dot14s :to_ushorts
165
-
166
- def to_shorts
167
- str = ""
168
- self.each do |int|
169
- str += int.to_short
170
- end
171
- str
172
- end
173
- alias :to_fwords :to_shorts
174
-
175
- def to_ulongs
176
- self.pack("N*")
177
- end
178
- alias :to_fixeds :to_ulongs
179
-
180
- end
181
-
182
- # This allows to sort an array of symbols as if they were strings
183
- class Symbol
184
-
185
- def <=>(symb)
186
- self.to_s <=> symb.to_s
187
- end
188
-
189
- end
@@ -1,140 +0,0 @@
1
- # TTF/Ruby, a library to read and write TrueType fonts in Ruby.
2
- # Copyright (C) 2006 Mathieu Blondel
3
- #
4
- # This program is free software; you can redistribute it and/or modify
5
- # it under the terms of the GNU General Public License as published by
6
- # the Free Software Foundation; either version 2 of the License, or
7
- # (at your option) any later version.
8
- #
9
- # This program is distributed in the hope that it will be useful,
10
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- # GNU General Public License for more details.
13
- #
14
- # You should have received a copy of the GNU General Public License
15
- # along with this program; if not, write to the Free Software
16
- # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
-
18
- module Font
19
- module TTF
20
- module Encodings
21
-
22
- module Platform
23
- UNICODE = 0
24
- MACINTOSH = 1
25
- ISO = 2
26
- MICROSOFT = 3
27
-
28
- ID2NAME = {
29
- UNICODE => "Unicode",
30
- MACINTOSH => "Macintosh",
31
- ISO => "ISO",
32
- MICROSOFT => "Microsoft"
33
- }
34
- end
35
-
36
- module UnicodeEncoding
37
- # When Platform == 0
38
- DEFAULT_SEMANTICS = 0
39
- VERSION_1_1_SEMANTICS = 1
40
- ISO_10646_1993_SEMANTICS = 2
41
- UNICODE = 3
42
- end
43
-
44
- module MicrosoftEncoding
45
- # When Platform == 3
46
- SYMBOL = 0
47
- UNICODE = 1
48
- SHIFTJIS = 2
49
- BIG5 = 3
50
- PRC = 4
51
- WASUNG = 5
52
- JOHAB = 6
53
-
54
- ID2NAME = {
55
- SYMBOL => "Symbol",
56
- UNICODE => "Unicode",
57
- SHIFTJIS => "ShiftJIS",
58
- BIG5 => "Big5",
59
- PRC => "PRC",
60
- WASUNG => "Wasung",
61
- JOHAB => "Johab"
62
- }
63
- end
64
-
65
- module MacintoshEncoding
66
- # When Platform == 1
67
- ROMAN = 0
68
- JAPANESE = 1
69
- TRADITIONAL_CHINESE = 2
70
- KOREAN = 3
71
- ARABIC = 4
72
- HEBREW = 5
73
- GREEK = 6
74
- RUSSIAN = 7
75
- RSYMBOL = 8
76
- DEVANAGARI = 9
77
- GURMUKHI = 10
78
- GUJARATI = 11
79
- ORIYA = 12
80
- BENGALI = 13
81
- TAMIL = 14
82
- TELUGU = 15
83
- KANNADA = 16
84
- MALAYALAM = 17
85
- SINHALESE = 18
86
- BURMESE = 19
87
- KHMER = 20
88
- THAI = 21
89
- LAOTIAN = 22
90
- GEORGIAN = 23
91
- ARMENIAN = 24
92
- SIMPLIFIED_CHINESE = 25
93
- TIBETAN = 26
94
- MONGOLIAN = 27
95
- GEEZ = 28
96
- SLAVIC = 29
97
- VIETNAMESE = 30
98
- SINDHI = 31
99
- UNINTERPRETED = 32
100
-
101
- ID2NAME = {
102
- ROMAN => "Roman",
103
- JAPANESE => "Japanese",
104
- TRADITIONAL_CHINESE => "Traditional Chinese",
105
- KOREAN => "Korean",
106
- ARABIC => "Arabic",
107
- HEBREW => "Hebrew",
108
- GREEK => "Greek",
109
- RUSSIAN => "Russian",
110
- RSYMBOL => "RSymbol",
111
- DEVANAGARI => "Devanagari",
112
- GURMUKHI => "Gurmukhi",
113
- GUJARATI => "Gujarati",
114
- ORIYA => "Orya",
115
- BENGALI => "Bengali",
116
- TAMIL => "Tamil",
117
- TELUGU => "Telugu",
118
- KANNADA => "Kannada",
119
- MALAYALAM => "Malayalam",
120
- SINHALESE => "Sinhalese",
121
- BURMESE => "Burmese",
122
- KHMER => "Khmer",
123
- THAI => "Thai",
124
- LAOTIAN => "Laotian",
125
- GEORGIAN => "Georgian",
126
- ARMENIAN => "Armenian",
127
- SIMPLIFIED_CHINESE => "Simplified Chinese",
128
- TIBETAN => "Tibetan",
129
- MONGOLIAN => "Mongolian",
130
- GEEZ => "Geez",
131
- SLAVIC => "Slavic",
132
- VIETNAMESE => "Vietnamese",
133
- SINDHI => "Sindhi",
134
- UNINTERPRETED => "Uninterpreted"
135
- }
136
- end
137
-
138
- end
139
- end
140
- end