ttfunk 1.5.1 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +5 -5
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/CHANGELOG.md +60 -0
  5. data/README.md +2 -1
  6. data/lib/ttfunk.rb +45 -0
  7. data/lib/ttfunk/aggregate.rb +15 -0
  8. data/lib/ttfunk/bin_utils.rb +47 -0
  9. data/lib/ttfunk/bit_field.rb +31 -0
  10. data/lib/ttfunk/collection.rb +3 -1
  11. data/lib/ttfunk/directory.rb +6 -0
  12. data/lib/ttfunk/encoded_string.rb +97 -0
  13. data/lib/ttfunk/max.rb +25 -0
  14. data/lib/ttfunk/min.rb +25 -0
  15. data/lib/ttfunk/one_based_array.rb +36 -0
  16. data/lib/ttfunk/otf_encoder.rb +61 -0
  17. data/lib/ttfunk/placeholder.rb +13 -0
  18. data/lib/ttfunk/reader.rb +34 -32
  19. data/lib/ttfunk/resource_file.rb +7 -5
  20. data/lib/ttfunk/sci_form.rb +29 -0
  21. data/lib/ttfunk/sub_table.rb +38 -0
  22. data/lib/ttfunk/subset.rb +2 -0
  23. data/lib/ttfunk/subset/base.rb +61 -120
  24. data/lib/ttfunk/subset/code_page.rb +89 -0
  25. data/lib/ttfunk/subset/mac_roman.rb +5 -42
  26. data/lib/ttfunk/subset/unicode.rb +12 -6
  27. data/lib/ttfunk/subset/unicode_8bit.rb +14 -12
  28. data/lib/ttfunk/subset/windows_1252.rb +5 -47
  29. data/lib/ttfunk/subset_collection.rb +4 -0
  30. data/lib/ttfunk/sum.rb +20 -0
  31. data/lib/ttfunk/table.rb +4 -0
  32. data/lib/ttfunk/table/cff.rb +69 -0
  33. data/lib/ttfunk/table/cff/charset.rb +212 -0
  34. data/lib/ttfunk/table/cff/charsets.rb +14 -0
  35. data/lib/ttfunk/table/cff/charsets/expert.rb +189 -0
  36. data/lib/ttfunk/table/cff/charsets/expert_subset.rb +119 -0
  37. data/lib/ttfunk/table/cff/charsets/iso_adobe.rb +241 -0
  38. data/lib/ttfunk/table/cff/charsets/standard_strings.rb +404 -0
  39. data/lib/ttfunk/table/cff/charstring.rb +487 -0
  40. data/lib/ttfunk/table/cff/charstrings_index.rb +39 -0
  41. data/lib/ttfunk/table/cff/dict.rb +266 -0
  42. data/lib/ttfunk/table/cff/encoding.rb +220 -0
  43. data/lib/ttfunk/table/cff/encodings.rb +12 -0
  44. data/lib/ttfunk/table/cff/encodings/expert.rb +206 -0
  45. data/lib/ttfunk/table/cff/encodings/standard.rb +181 -0
  46. data/lib/ttfunk/table/cff/fd_selector.rb +150 -0
  47. data/lib/ttfunk/table/cff/font_dict.rb +79 -0
  48. data/lib/ttfunk/table/cff/font_index.rb +29 -0
  49. data/lib/ttfunk/table/cff/header.rb +33 -0
  50. data/lib/ttfunk/table/cff/index.rb +125 -0
  51. data/lib/ttfunk/table/cff/one_based_index.rb +31 -0
  52. data/lib/ttfunk/table/cff/path.rb +66 -0
  53. data/lib/ttfunk/table/cff/private_dict.rb +84 -0
  54. data/lib/ttfunk/table/cff/subr_index.rb +19 -0
  55. data/lib/ttfunk/table/cff/top_dict.rb +230 -0
  56. data/lib/ttfunk/table/cff/top_index.rb +16 -0
  57. data/lib/ttfunk/table/cmap.rb +4 -4
  58. data/lib/ttfunk/table/cmap/format00.rb +1 -2
  59. data/lib/ttfunk/table/cmap/format04.rb +11 -3
  60. data/lib/ttfunk/table/cmap/format06.rb +2 -0
  61. data/lib/ttfunk/table/cmap/format10.rb +2 -0
  62. data/lib/ttfunk/table/cmap/format12.rb +2 -0
  63. data/lib/ttfunk/table/cmap/subtable.rb +12 -8
  64. data/lib/ttfunk/table/dsig.rb +50 -0
  65. data/lib/ttfunk/table/glyf.rb +11 -9
  66. data/lib/ttfunk/table/glyf/compound.rb +14 -7
  67. data/lib/ttfunk/table/glyf/path_based.rb +47 -0
  68. data/lib/ttfunk/table/glyf/simple.rb +21 -15
  69. data/lib/ttfunk/table/head.rb +43 -5
  70. data/lib/ttfunk/table/hhea.rb +47 -4
  71. data/lib/ttfunk/table/hmtx.rb +11 -4
  72. data/lib/ttfunk/table/kern.rb +3 -0
  73. data/lib/ttfunk/table/kern/format0.rb +3 -0
  74. data/lib/ttfunk/table/loca.rb +2 -0
  75. data/lib/ttfunk/table/maxp.rb +144 -10
  76. data/lib/ttfunk/table/name.rb +75 -37
  77. data/lib/ttfunk/table/os2.rb +327 -4
  78. data/lib/ttfunk/table/post.rb +8 -1
  79. data/lib/ttfunk/table/post/format10.rb +2 -0
  80. data/lib/ttfunk/table/post/format20.rb +5 -1
  81. data/lib/ttfunk/table/post/format30.rb +2 -0
  82. data/lib/ttfunk/table/post/format40.rb +2 -0
  83. data/lib/ttfunk/table/sbix.rb +2 -0
  84. data/lib/ttfunk/table/simple.rb +2 -0
  85. data/lib/ttfunk/table/vorg.rb +54 -0
  86. data/lib/ttfunk/ttf_encoder.rb +220 -0
  87. metadata +88 -20
  88. metadata.gz.sig +0 -0
  89. data/lib/ttfunk/encoding/mac_roman.rb +0 -100
  90. data/lib/ttfunk/encoding/windows_1252.rb +0 -76
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TTFunk
4
+ class Table
5
+ class Cff < TTFunk::Table
6
+ module Charsets
7
+ autoload :EXPERT, 'ttfunk/table/cff/charsets/expert'
8
+ autoload :EXPERT_SUBSET, 'ttfunk/table/cff/charsets/expert_subset'
9
+ autoload :ISO_ADOBE, 'ttfunk/table/cff/charsets/iso_adobe'
10
+ autoload :STANDARD_STRINGS, 'ttfunk/table/cff/charsets/standard_strings'
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,189 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TTFunk
4
+ class Table
5
+ class Cff < TTFunk::Table
6
+ module Charsets
7
+ EXPERT = OneBasedArray.new(
8
+ [
9
+ 'space',
10
+ *[nil] * 11,
11
+ 'comma',
12
+ 'hyphen',
13
+ 'period',
14
+ *[nil] * 11,
15
+ 'colon',
16
+ 'semicolon',
17
+ *[nil] * 70,
18
+ 'fraction',
19
+ *[nil] * 9,
20
+ 'fi',
21
+ 'fl',
22
+ *[nil] * 39,
23
+ 'onesuperior',
24
+ *[nil] * 4,
25
+ 'onehalf',
26
+ nil,
27
+ nil,
28
+ 'onequarter',
29
+ *[nil] * 4,
30
+ 'threequarters',
31
+ 'twosuperior',
32
+ *[nil] * 4,
33
+ 'threesuperior',
34
+ *[nil] * 59,
35
+ 'exclamsmall',
36
+ 'Hungarumlautsmall',
37
+ 'dollaroldstyle',
38
+ 'dollarsuperior',
39
+ 'ampersandsmall',
40
+ 'Acutesmall',
41
+ 'parenleftsuperior',
42
+ 'parenrightsuperior',
43
+ 'twodotenleader',
44
+ 'onedotenleader',
45
+ 'zerooldstyle',
46
+ 'oneoldstyle',
47
+ 'twooldstyle',
48
+ 'threeoldstyle',
49
+ 'fouroldstyle',
50
+ 'fiveoldstyle',
51
+ 'sixoldstyle',
52
+ 'sevenoldstyle',
53
+ 'eightoldstyle',
54
+ 'nineoldstyle',
55
+ 'commasuperior',
56
+ 'threequartersemdash',
57
+ 'periodsuperior',
58
+ 'questionsmall',
59
+ 'asuperior',
60
+ 'bsuperior',
61
+ 'centsuperior',
62
+ 'dsuperior',
63
+ 'esuperior',
64
+ 'isuperior',
65
+ 'lsuperior',
66
+ 'msuperior',
67
+ 'nsuperior',
68
+ 'osuperior',
69
+ 'rsuperior',
70
+ 'ssuperior',
71
+ 'tsuperior',
72
+ 'ff',
73
+ 'ffi',
74
+ 'ffl',
75
+ 'parenleftinferior',
76
+ 'parenrightinferior',
77
+ 'Circumflexsmall',
78
+ 'hyphensuperior',
79
+ 'Gravesmall',
80
+ 'Asmall',
81
+ 'Bsmall',
82
+ 'Csmall',
83
+ 'Dsmall',
84
+ 'Esmall',
85
+ 'Fsmall',
86
+ 'Gsmall',
87
+ 'Hsmall',
88
+ 'Ismall',
89
+ 'Jsmall',
90
+ 'Ksmall',
91
+ 'Lsmall',
92
+ 'Msmall',
93
+ 'Nsmall',
94
+ 'Osmall',
95
+ 'Psmall',
96
+ 'Qsmall',
97
+ 'Rsmall',
98
+ 'Ssmall',
99
+ 'Tsmall',
100
+ 'Usmall',
101
+ 'Vsmall',
102
+ 'Wsmall',
103
+ 'Xsmall',
104
+ 'Ysmall',
105
+ 'Zsmall',
106
+ 'colonmonetary',
107
+ 'onefitted',
108
+ 'rupiah',
109
+ 'Tildesmall',
110
+ 'exclamdownsmall',
111
+ 'centoldstyle',
112
+ 'Lslashsmall',
113
+ 'Scaronsmall',
114
+ 'Zcaronsmall',
115
+ 'Dieresissmall',
116
+ 'Brevesmall',
117
+ 'Caronsmall',
118
+ 'Dotaccentsmall',
119
+ 'Macronsmall',
120
+ 'figuredash',
121
+ 'hypheninferior',
122
+ 'Ogoneksmall',
123
+ 'Ringsmall',
124
+ 'Cedillasmall',
125
+ 'questiondownsmall',
126
+ 'oneeighth',
127
+ 'threeeighths',
128
+ 'fiveeighths',
129
+ 'seveneighths',
130
+ 'onethird',
131
+ 'twothirds',
132
+ 'zerosuperior',
133
+ 'foursuperior',
134
+ 'fivesuperior',
135
+ 'sixsuperior',
136
+ 'sevensuperior',
137
+ 'eightsuperior',
138
+ 'ninesuperior',
139
+ 'zeroinferior',
140
+ 'oneinferior',
141
+ 'twoinferior',
142
+ 'threeinferior',
143
+ 'fourinferior',
144
+ 'fiveinferior',
145
+ 'sixinferior',
146
+ 'seveninferior',
147
+ 'eightinferior',
148
+ 'nineinferior',
149
+ 'centinferior',
150
+ 'dollarinferior',
151
+ 'periodinferior',
152
+ 'commainferior',
153
+ 'Agravesmall',
154
+ 'Aacutesmall',
155
+ 'Acircumflexsmall',
156
+ 'Atildesmall',
157
+ 'Adieresissmall',
158
+ 'Aringsmall',
159
+ 'AEsmall',
160
+ 'Ccedillasmall',
161
+ 'Egravesmall',
162
+ 'Eacutesmall',
163
+ 'Ecircumflexsmall',
164
+ 'Edieresissmall',
165
+ 'Igravesmall',
166
+ 'Iacutesmall',
167
+ 'Icircumflexsmall',
168
+ 'Idieresissmall',
169
+ 'Ethsmall',
170
+ 'Ntildesmall',
171
+ 'Ogravesmall',
172
+ 'Oacutesmall',
173
+ 'Ocircumflexsmall',
174
+ 'Otildesmall',
175
+ 'Odieresissmall',
176
+ 'OEsmall',
177
+ 'Oslashsmall',
178
+ 'Ugravesmall',
179
+ 'Uacutesmall',
180
+ 'Ucircumflexsmall',
181
+ 'Udieresissmall',
182
+ 'Yacutesmall',
183
+ 'Thornsmall'
184
+ ]
185
+ ).freeze
186
+ end
187
+ end
188
+ end
189
+ end
@@ -0,0 +1,119 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TTFunk
4
+ class Table
5
+ class Cff < TTFunk::Table
6
+ module Charsets
7
+ EXPERT_SUBSET = OneBasedArray.new(
8
+ [
9
+ 'space',
10
+ *[nil] * 11,
11
+ 'comma',
12
+ 'hyphen',
13
+ 'period',
14
+ *[nil] * 11,
15
+ 'colon',
16
+ 'semicolon',
17
+ *[nil] * 70,
18
+ 'fraction',
19
+ *[nil] * 9,
20
+ 'fi',
21
+ 'fl',
22
+ *[nil] * 39,
23
+ 'onesuperior',
24
+ *[nil] * 4,
25
+ 'onehalf',
26
+ nil,
27
+ nil,
28
+ 'onequarter',
29
+ *[nil] * 4,
30
+ 'threequarters',
31
+ 'twosuperior',
32
+ *[nil] * 4,
33
+ 'threesuperior',
34
+ *[nil] * 61,
35
+ 'dollaroldstyle',
36
+ 'dollarsuperior',
37
+ nil,
38
+ nil,
39
+ 'parenleftsuperior',
40
+ 'parenrightsuperior',
41
+ 'twodotenleader',
42
+ 'onedotenleader',
43
+ 'zerooldstyle',
44
+ 'oneoldstyle',
45
+ 'twooldstyle',
46
+ 'threeoldstyle',
47
+ 'fouroldstyle',
48
+ 'fiveoldstyle',
49
+ 'sixoldstyle',
50
+ 'sevenoldstyle',
51
+ 'eightoldstyle',
52
+ 'nineoldstyle',
53
+ 'commasuperior',
54
+ 'threequartersemdash',
55
+ 'periodsuperior',
56
+ nil,
57
+ 'asuperior',
58
+ 'bsuperior',
59
+ 'centsuperior',
60
+ 'dsuperior',
61
+ 'esuperior',
62
+ 'isuperior',
63
+ 'lsuperior',
64
+ 'msuperior',
65
+ 'nsuperior',
66
+ 'osuperior',
67
+ 'rsuperior',
68
+ 'ssuperior',
69
+ 'tsuperior',
70
+ 'ff',
71
+ 'ffi',
72
+ 'ffl',
73
+ 'parenleftinferior',
74
+ 'parenrightinferior',
75
+ nil,
76
+ 'hyphensuperior',
77
+ *[nil] * 27,
78
+ 'colonmonetary',
79
+ 'onefitted',
80
+ 'rupiah',
81
+ nil,
82
+ nil,
83
+ 'centoldstyle',
84
+ *[nil] * 8,
85
+ 'figuredash',
86
+ 'hypheninferior',
87
+ *[nil] * 4,
88
+ 'oneeighth',
89
+ 'threeeighths',
90
+ 'fiveeighths',
91
+ 'seveneighths',
92
+ 'onethird',
93
+ 'twothirds',
94
+ 'zerosuperior',
95
+ 'foursuperior',
96
+ 'fivesuperior',
97
+ 'sixsuperior',
98
+ 'sevensuperior',
99
+ 'eightsuperior',
100
+ 'ninesuperior',
101
+ 'zeroinferior',
102
+ 'oneinferior',
103
+ 'twoinferior',
104
+ 'threeinferior',
105
+ 'fourinferior',
106
+ 'fiveinferior',
107
+ 'sixinferior',
108
+ 'seveninferior',
109
+ 'eightinferior',
110
+ 'nineinferior',
111
+ 'centinferior',
112
+ 'dollarinferior',
113
+ 'periodinferior'
114
+ ]
115
+ ).freeze
116
+ end
117
+ end
118
+ end
119
+ end
@@ -0,0 +1,241 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TTFunk
4
+ class Table
5
+ class Cff < TTFunk::Table
6
+ module Charsets
7
+ ISO_ADOBE = OneBasedArray.new(
8
+ [
9
+ 'space',
10
+ 'exclam',
11
+ 'quotedbl',
12
+ 'numbersign',
13
+ 'dollar',
14
+ 'percent',
15
+ 'ampersand',
16
+ 'quoteright',
17
+ 'parenleft',
18
+ 'parenright',
19
+ 'asterisk',
20
+ 'plus',
21
+ 'comma',
22
+ 'hyphen',
23
+ 'period',
24
+ 'slash',
25
+ 'zero',
26
+ 'one',
27
+ 'two',
28
+ 'three',
29
+ 'four',
30
+ 'five',
31
+ 'six',
32
+ 'seven',
33
+ 'eight',
34
+ 'nine',
35
+ 'colon',
36
+ 'semicolon',
37
+ 'less',
38
+ 'equal',
39
+ 'greater',
40
+ 'question',
41
+ 'at',
42
+ 'A',
43
+ 'B',
44
+ 'C',
45
+ 'D',
46
+ 'E',
47
+ 'F',
48
+ 'G',
49
+ 'H',
50
+ 'I',
51
+ 'J',
52
+ 'K',
53
+ 'L',
54
+ 'M',
55
+ 'N',
56
+ 'O',
57
+ 'P',
58
+ 'Q',
59
+ 'R',
60
+ 'S',
61
+ 'T',
62
+ 'U',
63
+ 'V',
64
+ 'W',
65
+ 'X',
66
+ 'Y',
67
+ 'Z',
68
+ 'bracketleft',
69
+ 'backslash',
70
+ 'bracketright',
71
+ 'asciicircum',
72
+ 'underscore',
73
+ 'quoteleft',
74
+ 'a',
75
+ 'b',
76
+ 'c',
77
+ 'd',
78
+ 'e',
79
+ 'f',
80
+ 'g',
81
+ 'h',
82
+ 'i',
83
+ 'j',
84
+ 'k',
85
+ 'l',
86
+ 'm',
87
+ 'n',
88
+ 'o',
89
+ 'p',
90
+ 'q',
91
+ 'r',
92
+ 's',
93
+ 't',
94
+ 'u',
95
+ 'v',
96
+ 'w',
97
+ 'x',
98
+ 'y',
99
+ 'z',
100
+ 'braceleft',
101
+ 'bar',
102
+ 'braceright',
103
+ 'asciitilde',
104
+ 'exclamdown 97 cent',
105
+ 'sterling',
106
+ 'fraction',
107
+ 'yen',
108
+ 'florin',
109
+ 'section',
110
+ 'currency',
111
+ 'quotesingle',
112
+ 'quotedblleft',
113
+ 'guillemotleft',
114
+ 'guilsinglleft',
115
+ 'guilsinglright',
116
+ 'fi',
117
+ 'fl',
118
+ 'endash',
119
+ 'dagger',
120
+ 'daggerdbl',
121
+ 'periodcentered',
122
+ 'paragraph',
123
+ 'bullet',
124
+ 'quotesinglbase',
125
+ 'quotedblbase',
126
+ 'quotedblright',
127
+ 'guillemotright',
128
+ 'ellipsis',
129
+ 'perthousand',
130
+ 'questiondown',
131
+ 'grave',
132
+ 'acute',
133
+ 'circumflex',
134
+ 'tilde',
135
+ 'macron',
136
+ 'breve',
137
+ 'dotaccent',
138
+ 'dieresis',
139
+ 'ring',
140
+ 'cedilla',
141
+ 'hungarumlaut',
142
+ 'ogonek',
143
+ 'caron',
144
+ 'emdash',
145
+ 'AE',
146
+ 'ordfeminine',
147
+ 'Lslash',
148
+ 'Oslash',
149
+ 'OE',
150
+ 'ordmasculine',
151
+ 'ae',
152
+ 'dotlessi',
153
+ 'lslash',
154
+ 'oslash',
155
+ 'oe',
156
+ 'germandbls',
157
+ 'onesuperior',
158
+ 'logicalnot',
159
+ 'mu',
160
+ 'trademark',
161
+ 'Eth',
162
+ 'onehalf',
163
+ 'plusminus',
164
+ 'Thorn',
165
+ 'onequarter',
166
+ 'divide',
167
+ 'brokenbar',
168
+ 'degree',
169
+ 'thorn',
170
+ 'threequarters',
171
+ 'twosuperior',
172
+ 'registered',
173
+ 'minus',
174
+ 'eth',
175
+ 'multiply',
176
+ 'threesuperior',
177
+ 'copyright',
178
+ 'Aacute',
179
+ 'Acircumflex',
180
+ 'Adieresis',
181
+ 'Agrave',
182
+ 'Aring',
183
+ 'Atilde',
184
+ 'Ccedilla',
185
+ 'Eacute',
186
+ 'Ecircumflex',
187
+ 'Edieresis',
188
+ 'Egrave',
189
+ 'Iacute',
190
+ 'Icircumflex',
191
+ 'Idieresis',
192
+ 'Igrave',
193
+ 'Ntilde',
194
+ 'Oacute',
195
+ 'Ocircumflex',
196
+ 'Odieresis',
197
+ 'Ograve',
198
+ 'Otilde',
199
+ 'Scaron',
200
+ 'Uacute',
201
+ 'Ucircumflex',
202
+ 'Udieresis',
203
+ 'Ugrave',
204
+ 'Yacute',
205
+ 'Ydieresis',
206
+ 'Zcaron',
207
+ 'aacute',
208
+ 'acircumflex',
209
+ 'adieresis',
210
+ 'agrave',
211
+ 'aring',
212
+ 'atilde',
213
+ 'ccedilla',
214
+ 'eacute',
215
+ 'ecircumflex',
216
+ 'edieresis',
217
+ 'egrave',
218
+ 'iacute',
219
+ 'icircumflex',
220
+ 'idieresis',
221
+ 'igrave',
222
+ 'ntilde',
223
+ 'oacute',
224
+ 'ocircumflex',
225
+ 'odieresis',
226
+ 'ograve',
227
+ 'otilde',
228
+ 'scaron',
229
+ 'uacute',
230
+ 'ucircumflex',
231
+ 'udieresis',
232
+ 'ugrave',
233
+ 'yacute',
234
+ 'ydieresis',
235
+ 'zcaron'
236
+ ]
237
+ ).freeze
238
+ end
239
+ end
240
+ end
241
+ end