glyph_imager 0.0.14 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. data/VERSION +1 -1
  2. data/glyph_imager.gemspec +45 -36
  3. data/lib/glyph_imager.rb +19 -27
  4. data/test/fonts/Musica.ttf +0 -0
  5. data/test/test_glyph_imager.rb +9 -3
  6. data/vendor/ttfunk/.gitignore +1 -0
  7. data/vendor/ttfunk/data/fonts/DejaVuSans.ttf +0 -0
  8. data/vendor/ttfunk/data/fonts/comicsans.ttf +0 -0
  9. data/vendor/ttfunk/example.rb +45 -0
  10. data/vendor/ttfunk/lib/ttfunk.rb +102 -0
  11. data/vendor/ttfunk/lib/ttfunk/directory.rb +17 -0
  12. data/vendor/ttfunk/lib/ttfunk/encoding/mac_roman.rb +88 -0
  13. data/vendor/ttfunk/lib/ttfunk/encoding/windows_1252.rb +69 -0
  14. data/vendor/ttfunk/lib/ttfunk/reader.rb +44 -0
  15. data/vendor/ttfunk/lib/ttfunk/resource_file.rb +78 -0
  16. data/vendor/ttfunk/lib/ttfunk/subset.rb +18 -0
  17. data/vendor/ttfunk/lib/ttfunk/subset/base.rb +141 -0
  18. data/vendor/ttfunk/lib/ttfunk/subset/mac_roman.rb +50 -0
  19. data/vendor/ttfunk/lib/ttfunk/subset/unicode.rb +48 -0
  20. data/vendor/ttfunk/lib/ttfunk/subset/unicode_8bit.rb +63 -0
  21. data/vendor/ttfunk/lib/ttfunk/subset/windows_1252.rb +55 -0
  22. data/vendor/ttfunk/lib/ttfunk/subset_collection.rb +72 -0
  23. data/vendor/ttfunk/lib/ttfunk/table.rb +46 -0
  24. data/vendor/ttfunk/lib/ttfunk/table/cmap.rb +34 -0
  25. data/vendor/ttfunk/lib/ttfunk/table/cmap/format00.rb +54 -0
  26. data/vendor/ttfunk/lib/ttfunk/table/cmap/format04.rb +126 -0
  27. data/vendor/ttfunk/lib/ttfunk/table/cmap/format12.rb +37 -0
  28. data/vendor/ttfunk/lib/ttfunk/table/cmap/subtable.rb +82 -0
  29. data/vendor/ttfunk/lib/ttfunk/table/glyf.rb +64 -0
  30. data/vendor/ttfunk/lib/ttfunk/table/glyf/compound.rb +81 -0
  31. data/vendor/ttfunk/lib/ttfunk/table/glyf/simple.rb +37 -0
  32. data/vendor/ttfunk/lib/ttfunk/table/head.rb +44 -0
  33. data/vendor/ttfunk/lib/ttfunk/table/hhea.rb +41 -0
  34. data/vendor/ttfunk/lib/ttfunk/table/hmtx.rb +47 -0
  35. data/vendor/ttfunk/lib/ttfunk/table/kern.rb +79 -0
  36. data/vendor/ttfunk/lib/ttfunk/table/kern/format0.rb +62 -0
  37. data/vendor/ttfunk/lib/ttfunk/table/loca.rb +43 -0
  38. data/vendor/ttfunk/lib/ttfunk/table/maxp.rb +40 -0
  39. data/vendor/ttfunk/lib/ttfunk/table/name.rb +125 -0
  40. data/vendor/ttfunk/lib/ttfunk/table/os2.rb +78 -0
  41. data/vendor/ttfunk/lib/ttfunk/table/post.rb +91 -0
  42. data/vendor/ttfunk/lib/ttfunk/table/post/format10.rb +43 -0
  43. data/vendor/ttfunk/lib/ttfunk/table/post/format20.rb +35 -0
  44. data/vendor/ttfunk/lib/ttfunk/table/post/format25.rb +23 -0
  45. data/vendor/ttfunk/lib/ttfunk/table/post/format30.rb +17 -0
  46. data/vendor/ttfunk/lib/ttfunk/table/post/format40.rb +17 -0
  47. data/vendor/ttfunk/lib/ttfunk/table/simple.rb +14 -0
  48. metadata +46 -37
  49. data/vendor/ttf-ruby-0.1/AUTHORS +0 -1
  50. data/vendor/ttf-ruby-0.1/COPYING +0 -340
  51. data/vendor/ttf-ruby-0.1/README +0 -49
  52. data/vendor/ttf-ruby-0.1/TODO +0 -23
  53. data/vendor/ttf-ruby-0.1/VERSION +0 -1
  54. data/vendor/ttf-ruby-0.1/lib/ttf.rb +0 -20
  55. data/vendor/ttf-ruby-0.1/lib/ttf/datatypes.rb +0 -181
  56. data/vendor/ttf-ruby-0.1/lib/ttf/encodings.rb +0 -140
  57. data/vendor/ttf-ruby-0.1/lib/ttf/exceptions.rb +0 -28
  58. data/vendor/ttf-ruby-0.1/lib/ttf/font_loader.rb +0 -290
  59. data/vendor/ttf-ruby-0.1/lib/ttf/fontchunk.rb +0 -77
  60. data/vendor/ttf-ruby-0.1/lib/ttf/table/cmap.rb +0 -408
  61. data/vendor/ttf-ruby-0.1/lib/ttf/table/cvt.rb +0 -49
  62. data/vendor/ttf-ruby-0.1/lib/ttf/table/fpgm.rb +0 -48
  63. data/vendor/ttf-ruby-0.1/lib/ttf/table/gasp.rb +0 -88
  64. data/vendor/ttf-ruby-0.1/lib/ttf/table/glyf.rb +0 -452
  65. data/vendor/ttf-ruby-0.1/lib/ttf/table/head.rb +0 -86
  66. data/vendor/ttf-ruby-0.1/lib/ttf/table/hhea.rb +0 -96
  67. data/vendor/ttf-ruby-0.1/lib/ttf/table/hmtx.rb +0 -98
  68. data/vendor/ttf-ruby-0.1/lib/ttf/table/kern.rb +0 -186
  69. data/vendor/ttf-ruby-0.1/lib/ttf/table/loca.rb +0 -75
  70. data/vendor/ttf-ruby-0.1/lib/ttf/table/maxp.rb +0 -81
  71. data/vendor/ttf-ruby-0.1/lib/ttf/table/name.rb +0 -226
  72. data/vendor/ttf-ruby-0.1/lib/ttf/table/os2.rb +0 -172
  73. data/vendor/ttf-ruby-0.1/lib/ttf/table/post.rb +0 -120
  74. data/vendor/ttf-ruby-0.1/lib/ttf/table/prep.rb +0 -27
  75. data/vendor/ttf-ruby-0.1/lib/ttf/table/vhea.rb +0 -45
  76. data/vendor/ttf-ruby-0.1/lib/ttf/table/vmtx.rb +0 -36
  77. data/vendor/ttf-ruby-0.1/setup.rb +0 -1558
  78. data/vendor/ttf-ruby-0.1/tools/README +0 -44
  79. data/vendor/ttf-ruby-0.1/tools/ttfcairoglyphviewer +0 -229
  80. data/vendor/ttf-ruby-0.1/tools/ttfdump +0 -396
  81. data/vendor/ttf-ruby-0.1/tools/ttfglyph2svg +0 -144
  82. data/vendor/ttf-ruby-0.1/tools/ttfsubset +0 -273
@@ -1,49 +0,0 @@
1
- TTF/Ruby
2
- ========
3
-
4
- TTF/Ruby is a library to read and write TrueType fonts in Ruby.
5
-
6
- Tables supported are :
7
-
8
- - Cmap *
9
- - Cvt *
10
- - Fpgm *
11
- - Gasp
12
- - Glyf
13
- - Head
14
- - Hhea
15
- - Hmtx
16
- - Kern *
17
- - OS/2
18
- - Post *
19
- - Prep *
20
- - Vhea
21
- - Vmtx
22
-
23
- (Tables marked with an * are only partially supported)
24
-
25
- Requirements
26
- ------------
27
-
28
- Ruby >= 1.8.0: http://www.ruby-lang.org
29
-
30
- Install
31
- -------
32
-
33
- # ruby setup.rb
34
-
35
- Documentation
36
- -------------
37
-
38
- $ rdoc --main "TTFFont::TTF::File"
39
-
40
- Tools
41
- -----
42
-
43
- See tools/README.
44
-
45
- License
46
- -------
47
-
48
- TTF/Ruby is distributed under the terms of the GNU General Public
49
- License. See the COPYING file for more information.
@@ -1,23 +0,0 @@
1
- TODO
2
- ====
3
-
4
- - More character encodings support (cmap and name tables)
5
- - More encoding tables format support in cmap table
6
- - Kerning classes
7
- - More postcript subtables
8
- - Instruction interpreter
9
- - Bitmap tables
10
- - OpenType additional tables
11
- - Font collections
12
-
13
- - More lazy (do not load what is not needed immediately, directly copy tables
14
- which have not been modified internally)
15
- - More helpers to handle low level things such as setting flags
16
- - More helpers for common things
17
- - Improve critical algorithms
18
- - Clean API
19
- - Take care of as many things as possible to reduce user's interaction
20
- (automatically updating data from inter-related tables, making best decisions
21
- regarding TrueType table format options, etc)
22
-
23
- - Extra: a simple glyph editor in Ruby/Gtk and Rcairo
@@ -1 +0,0 @@
1
- 0.1
@@ -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/font_loader'
19
-
20
-
@@ -1,181 +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
- def read_ushort
36
- read(SIZEOF_USHORT).unpack("n")[0]
37
- end
38
- alias :read_ufword :read_ushort
39
- alias :read_f2dot14 :read_ushort
40
-
41
- def read_ushorts(n)
42
- read(SIZEOF_USHORT * n).unpack("n#{n.to_s}")
43
- end
44
- alias :read_ufwords :read_ushorts
45
- alias :read_f2dot14s :read_ushorts
46
-
47
- def read_ulong
48
- read(SIZEOF_ULONG).unpack("N")[0]
49
- end
50
-
51
- def read_ulongs(n)
52
- read(SIZEOF_ULONG * n).unpack("N#{n.to_s}")
53
- end
54
-
55
- def read_fixed
56
- f = read_ulong
57
- #"%d.%d" % [f >> 16, f & 0xff00]
58
- end
59
-
60
- def read_ulong_as_text
61
- read(SIZEOF_ULONG)
62
- end
63
-
64
- def read_byte
65
- read(1).unpack("C")[0]
66
- end
67
-
68
- def read_bytes(n)
69
- read(n).unpack("C" + n.to_s)
70
- end
71
-
72
- def read_long_date_time
73
- # Don't know how to compute dates
74
- read(SIZEOF_LONG_DATE_TIME)
75
- ""
76
- end
77
-
78
- def read_short
79
- # No unpack support for signed network short
80
- n = read_ushort
81
- n = n - 2 * SHORT_BOUND if n >= SHORT_BOUND
82
- n
83
- end
84
- alias :read_fword :read_short
85
-
86
- def read_shorts(n)
87
- arr = []
88
- n.times { arr << read_short }
89
- arr
90
- end
91
- alias :read_fwords :read_shorts
92
-
93
- def read_char
94
- read(1)
95
- end
96
-
97
- def read_chars(n)
98
- read(n)
99
- end
100
-
101
- end
102
-
103
- class Integer
104
-
105
- def to_ushort
106
- [self].pack("n")
107
- end
108
- alias :to_ufword :to_ushort
109
- alias :to_f2dot14 :to_ushort
110
-
111
- def to_ulong
112
- [self].pack("N")
113
- end
114
- alias :to_fixed :to_ulong
115
-
116
- def to_short
117
- n = self
118
- n + 2 * IO::SHORT_BOUND if n < 0
119
- n.to_ushort
120
- end
121
- alias :to_fword :to_short
122
-
123
- def to_byte
124
- [self].pack("C")
125
- end
126
-
127
- end
128
-
129
- class String
130
-
131
- def to_long_date_time
132
- # Don't know how to compute dates
133
- # So just returns something at the good size
134
- " " * IO::SIZEOF_LONG_DATE_TIME
135
- end
136
-
137
- def four_chars!
138
- str = self
139
- while str.length < 4
140
- str += " "
141
- end
142
- self.replace(str.slice(0,4))
143
- end
144
- end
145
-
146
- class Array
147
-
148
- def to_bytes
149
- self.pack("C*")
150
- end
151
-
152
- def to_ushorts
153
- self.pack("n*")
154
- end
155
- alias :to_ufwords :to_ushorts
156
- alias :to_f2dot14s :to_ushorts
157
-
158
- def to_shorts
159
- str = ""
160
- self.each do |int|
161
- str += int.to_short
162
- end
163
- str
164
- end
165
- alias :to_fwords :to_shorts
166
-
167
- def to_ulongs
168
- self.pack("N*")
169
- end
170
- alias :to_fixeds :to_ulongs
171
-
172
- end
173
-
174
- # This allows to sort an array of symbols as if they were strings
175
- class Symbol
176
-
177
- def <=>(symb)
178
- self.to_s <=> symb.to_s
179
- end
180
-
181
- 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 TTFFont
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
@@ -1,28 +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 TTFFont
19
- module TTF
20
-
21
- class MalformedFont < Exception
22
- end
23
-
24
- class TableMissing < Exception
25
- end
26
-
27
- end
28
- end