ttfunk 1.6.1 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +2 -2
- data/CHANGELOG.md +10 -1
- data/lib/ttfunk.rb +8 -0
- data/lib/ttfunk/subset/base.rb +2 -0
- data/lib/ttfunk/table/maxp.rb +10 -142
- data/lib/ttfunk/ttf_encoder.rb +1 -1
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8f54a2c12dc7df68bb4421928d4014a298405ad92615d3a027431482271753f
|
4
|
+
data.tar.gz: 1d02f5e9e9b0445e65745c564a4e4471efa1aea85732cd6c3fcea8a3cc67dd00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4107c17811bb4b60c0651110907849d2628a0492b2cf34022212be46aaa674754123f7e2402c0ed8c0d568a01034df096498ceb6b6b85c49ef69dac45ba2e079
|
7
|
+
data.tar.gz: 69b946c0f10a76fe5f3a3a00dc901c54996b507a00687b0d5ce7e0e6b88e2a92963e83efc99a828b0d6be6b5346a897363afbe036b617170c01b3761182be94e
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
m�x��������7���_?���n`:�F�Q:��
|
2
|
+
� -��,�P����64�^��~P!��G$+��g��:h�.Оx�t�dݻ*S�<W�#���ݗ��X(�خ�A�zü��9,���Y[�n28�p� 3V���Lh��}���`�ķAW�Y�3. F5|#@~Ax��W�%Yu������Fϵ�(�owW~�ʚ~�Xu��!??x�"Q���_�O;,�83Sǖ�.�D���ȀY1=n[[W�9034wz���zѶ�
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [1.6.2]
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
|
14
|
+
* Reverted to pre 1.6 maxp table serialization.
|
15
|
+
|
16
|
+
Cameron Dutro
|
17
|
+
|
10
18
|
## [1.6.1]
|
11
19
|
|
12
20
|
### Fixed
|
@@ -181,7 +189,8 @@ Initial release as a standalone gem
|
|
181
189
|
|
182
190
|
|
183
191
|
|
184
|
-
[Unreleased]: https://github.com/prawnpdf/ttfunk/compare/1.6.
|
192
|
+
[Unreleased]: https://github.com/prawnpdf/ttfunk/compare/1.6.2...HEAD
|
193
|
+
[1.6.2]: https://github.com/prawnpdf/ttfunk/compare/1.6.1...1.6.2
|
185
194
|
[1.6.1]: https://github.com/prawnpdf/ttfunk/compare/1.6.0...1.6.1
|
186
195
|
[1.6.0]: https://github.com/prawnpdf/ttfunk/compare/1.5.1...1.6.0
|
187
196
|
[1.5.1]: https://github.com/prawnpdf/ttfunk/compare/1.5.0...1.5.1
|
data/lib/ttfunk.rb
CHANGED
data/lib/ttfunk/subset/base.rb
CHANGED
data/lib/ttfunk/table/maxp.rb
CHANGED
@@ -5,9 +5,6 @@ require_relative '../table'
|
|
5
5
|
module TTFunk
|
6
6
|
class Table
|
7
7
|
class Maxp < Table
|
8
|
-
DEFAULT_MAX_COMPONENT_DEPTH = 1
|
9
|
-
MAX_V1_TABLE_LENGTH = 34
|
10
|
-
|
11
8
|
attr_reader :version
|
12
9
|
attr_reader :num_glyphs
|
13
10
|
attr_reader :max_points
|
@@ -24,150 +21,21 @@ module TTFunk
|
|
24
21
|
attr_reader :max_component_elements
|
25
22
|
attr_reader :max_component_depth
|
26
23
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
if maxp.version == 0x10000
|
34
|
-
stats = stats_for(
|
35
|
-
maxp, glyphs_from_ids(maxp, new2old_glyph.values)
|
36
|
-
)
|
37
|
-
|
38
|
-
table << [
|
39
|
-
stats[:max_points],
|
40
|
-
stats[:max_contours],
|
41
|
-
stats[:max_component_points],
|
42
|
-
stats[:max_component_contours],
|
43
|
-
# these all come from the fpgm and cvt tables, which
|
44
|
-
# we don't support at the moment
|
45
|
-
maxp.max_zones,
|
46
|
-
maxp.max_twilight_points,
|
47
|
-
maxp.max_storage,
|
48
|
-
maxp.max_function_defs,
|
49
|
-
maxp.max_instruction_defs,
|
50
|
-
maxp.max_stack_elements,
|
51
|
-
stats[:max_size_of_instructions],
|
52
|
-
stats[:max_component_elements],
|
53
|
-
stats[:max_component_depth]
|
54
|
-
].pack('Nn*')
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
private
|
60
|
-
|
61
|
-
def glyphs_from_ids(maxp, glyph_ids)
|
62
|
-
glyph_ids.each_with_object([]) do |glyph_id, ret|
|
63
|
-
if (glyph = maxp.file.glyph_outlines.for(glyph_id))
|
64
|
-
ret << glyph
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
def stats_for(maxp, glyphs)
|
70
|
-
stats_for_simple(maxp, glyphs)
|
71
|
-
.merge(stats_for_compound(maxp, glyphs))
|
72
|
-
.each_with_object({}) do |(name, agg), ret|
|
73
|
-
ret[name] = agg.value_or(0)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
def stats_for_simple(_maxp, glyphs)
|
78
|
-
max_component_elements = Max.new
|
79
|
-
max_points = Max.new
|
80
|
-
max_contours = Max.new
|
81
|
-
max_size_of_instructions = Max.new
|
82
|
-
|
83
|
-
glyphs.each do |glyph|
|
84
|
-
if glyph.compound?
|
85
|
-
max_component_elements << glyph.glyph_ids.size
|
86
|
-
else
|
87
|
-
max_points << glyph.end_point_of_last_contour
|
88
|
-
max_contours << glyph.number_of_contours
|
89
|
-
max_size_of_instructions << glyph.instruction_length
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
{
|
94
|
-
max_component_elements: max_component_elements,
|
95
|
-
max_points: max_points,
|
96
|
-
max_contours: max_contours,
|
97
|
-
max_size_of_instructions: max_size_of_instructions
|
98
|
-
}
|
99
|
-
end
|
100
|
-
|
101
|
-
def stats_for_compound(maxp, glyphs)
|
102
|
-
max_component_points = Max.new
|
103
|
-
max_component_depth = Max.new
|
104
|
-
max_component_contours = Max.new
|
105
|
-
|
106
|
-
glyphs.each do |glyph|
|
107
|
-
next unless glyph.compound?
|
108
|
-
|
109
|
-
stats = totals_for_compound(maxp, [glyph], 0)
|
110
|
-
max_component_points << stats[:total_points]
|
111
|
-
max_component_depth << stats[:max_depth]
|
112
|
-
max_component_contours << stats[:total_contours]
|
113
|
-
end
|
114
|
-
|
115
|
-
{
|
116
|
-
max_component_points: max_component_points,
|
117
|
-
max_component_depth: max_component_depth,
|
118
|
-
max_component_contours: max_component_contours
|
119
|
-
}
|
120
|
-
end
|
121
|
-
|
122
|
-
def totals_for_compound(maxp, glyphs, depth)
|
123
|
-
total_points = Sum.new
|
124
|
-
total_contours = Sum.new
|
125
|
-
max_depth = Max.new(depth)
|
126
|
-
|
127
|
-
glyphs.each do |glyph|
|
128
|
-
if glyph.compound?
|
129
|
-
stats = totals_for_compound(
|
130
|
-
maxp, glyphs_from_ids(maxp, glyph.glyph_ids), depth + 1
|
131
|
-
)
|
132
|
-
|
133
|
-
total_points << stats[:total_points]
|
134
|
-
total_contours << stats[:total_contours]
|
135
|
-
max_depth << stats[:max_depth]
|
136
|
-
else
|
137
|
-
stats = stats_for_simple(maxp, [glyph])
|
138
|
-
total_points << stats[:max_points]
|
139
|
-
total_contours << stats[:max_contours]
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
{
|
144
|
-
total_points: total_points,
|
145
|
-
total_contours: total_contours,
|
146
|
-
max_depth: max_depth
|
147
|
-
}
|
148
|
-
end
|
24
|
+
def self.encode(maxp, mapping)
|
25
|
+
num_glyphs = mapping.length
|
26
|
+
raw = maxp.raw
|
27
|
+
raw[4, 2] = [num_glyphs].pack('n')
|
28
|
+
raw
|
149
29
|
end
|
150
30
|
|
151
31
|
private
|
152
32
|
|
153
33
|
def parse!
|
154
|
-
@version, @num_glyphs
|
155
|
-
|
156
|
-
|
157
|
-
@
|
158
|
-
|
159
|
-
@max_storage, @max_function_defs, @max_instruction_defs,
|
160
|
-
@max_stack_elements, @max_size_of_instructions,
|
161
|
-
@max_component_elements = read(26, 'Nn*')
|
162
|
-
|
163
|
-
# a number of fonts omit these last two bytes for some reason,
|
164
|
-
# so we have to supply a default here to prevent nils
|
165
|
-
@max_component_depth = if length == MAX_V1_TABLE_LENGTH
|
166
|
-
read(2, 'n').first
|
167
|
-
else
|
168
|
-
DEFAULT_MAX_COMPONENT_DEPTH
|
169
|
-
end
|
170
|
-
end
|
34
|
+
@version, @num_glyphs, @max_points, @max_contours,
|
35
|
+
@max_component_points, @max_component_contours, @max_zones,
|
36
|
+
@max_twilight_points, @max_storage, @max_function_defs,
|
37
|
+
@max_instruction_defs, @max_stack_elements, @max_size_of_instructions,
|
38
|
+
@max_component_elements, @max_component_depth = read(length, 'Nn*')
|
171
39
|
end
|
172
40
|
end
|
173
41
|
end
|
data/lib/ttfunk/ttf_encoder.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ttfunk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregory Brown
|
@@ -34,7 +34,7 @@ cert_chain:
|
|
34
34
|
NAnYg0X9IoxXQRCJn85h0SOQBU63TUfKDrERXDy0NLZT6sErDnpx84+ygqpxVAD+
|
35
35
|
4qo2amfe
|
36
36
|
-----END CERTIFICATE-----
|
37
|
-
date: 2020-
|
37
|
+
date: 2020-02-14 00:00:00.000000000 Z
|
38
38
|
dependencies:
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
40
|
name: rake
|
metadata.gz.sig
CHANGED
Binary file
|