ttfunk 1.6.2.1 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +2 -1
  3. data.tar.gz.sig +0 -0
  4. data/CHANGELOG.md +15 -1
  5. data/lib/ttfunk.rb +3 -2
  6. data/lib/ttfunk/bit_field.rb +1 -1
  7. data/lib/ttfunk/collection.rb +8 -2
  8. data/lib/ttfunk/encoded_string.rb +3 -3
  9. data/lib/ttfunk/max.rb +1 -0
  10. data/lib/ttfunk/min.rb +1 -0
  11. data/lib/ttfunk/one_based_array.rb +1 -1
  12. data/lib/ttfunk/otf_encoder.rb +1 -1
  13. data/lib/ttfunk/reader.rb +3 -3
  14. data/lib/ttfunk/sci_form.rb +1 -1
  15. data/lib/ttfunk/subset.rb +3 -3
  16. data/lib/ttfunk/subset/base.rb +24 -21
  17. data/lib/ttfunk/subset/code_page.rb +16 -19
  18. data/lib/ttfunk/subset/unicode.rb +8 -6
  19. data/lib/ttfunk/subset/unicode_8bit.rb +14 -12
  20. data/lib/ttfunk/sum.rb +1 -0
  21. data/lib/ttfunk/table/cff.rb +17 -17
  22. data/lib/ttfunk/table/cff/charset.rb +31 -30
  23. data/lib/ttfunk/table/cff/charsets.rb +3 -3
  24. data/lib/ttfunk/table/cff/charstring.rb +54 -55
  25. data/lib/ttfunk/table/cff/dict.rb +6 -4
  26. data/lib/ttfunk/table/cff/encoding.rb +20 -21
  27. data/lib/ttfunk/table/cff/encodings.rb +1 -1
  28. data/lib/ttfunk/table/cff/fd_selector.rb +14 -11
  29. data/lib/ttfunk/table/cff/font_index.rb +7 -6
  30. data/lib/ttfunk/table/cff/index.rb +6 -5
  31. data/lib/ttfunk/table/cff/one_based_index.rb +7 -3
  32. data/lib/ttfunk/table/cff/path.rb +5 -3
  33. data/lib/ttfunk/table/cff/top_dict.rb +7 -6
  34. data/lib/ttfunk/table/cff/top_index.rb +5 -4
  35. data/lib/ttfunk/table/cmap.rb +8 -6
  36. data/lib/ttfunk/table/cmap/format00.rb +7 -6
  37. data/lib/ttfunk/table/cmap/format04.rb +16 -15
  38. data/lib/ttfunk/table/cmap/format06.rb +6 -5
  39. data/lib/ttfunk/table/cmap/format10.rb +6 -5
  40. data/lib/ttfunk/table/cmap/format12.rb +13 -12
  41. data/lib/ttfunk/table/cmap/subtable.rb +4 -4
  42. data/lib/ttfunk/table/dsig.rb +11 -9
  43. data/lib/ttfunk/table/glyf.rb +3 -3
  44. data/lib/ttfunk/table/glyf/compound.rb +8 -8
  45. data/lib/ttfunk/table/hmtx.rb +6 -5
  46. data/lib/ttfunk/table/kern.rb +4 -4
  47. data/lib/ttfunk/table/kern/format0.rb +1 -1
  48. data/lib/ttfunk/table/loca.rb +7 -6
  49. data/lib/ttfunk/table/name.rb +6 -5
  50. data/lib/ttfunk/table/os2.rb +261 -151
  51. data/lib/ttfunk/table/post.rb +1 -1
  52. data/lib/ttfunk/table/sbix.rb +15 -13
  53. data/lib/ttfunk/table/vorg.rb +1 -1
  54. data/lib/ttfunk/ttf_encoder.rb +4 -4
  55. metadata +29 -99
  56. metadata.gz.sig +0 -0
@@ -18,7 +18,7 @@ module TTFunk
18
18
  attr_reader :subtable
19
19
 
20
20
  def self.encode(post, mapping)
21
- return nil unless post.exists?
21
+ return unless post.exists?
22
22
 
23
23
  post.recode(mapping)
24
24
  end
@@ -21,7 +21,7 @@ module TTFunk
21
21
 
22
22
  if glyph_offset && next_glyph_offset
23
23
  bytes = next_glyph_offset - glyph_offset
24
- if bytes > 0
24
+ if bytes.positive?
25
25
  parse_from(offset + strike[:offset] + glyph_offset) do
26
26
  x, y, type = read(8, 's2A4')
27
27
  data = StringIO.new(io.read(bytes - 8))
@@ -45,20 +45,22 @@ module TTFunk
45
45
  @version, @flags, @num_strikes = read(8, 'n2N')
46
46
  strike_offsets = Array.new(num_strikes) { read(4, 'N').first }
47
47
 
48
- @strikes = strike_offsets.map do |strike_offset|
49
- parse_from(offset + strike_offset) do
50
- ppem, resolution = read(4, 'n2')
51
- data_offsets = Array.new(file.maximum_profile.num_glyphs + 1) do
52
- read(4, 'N').first
48
+ @strikes =
49
+ strike_offsets.map do |strike_offset|
50
+ parse_from(offset + strike_offset) do
51
+ ppem, resolution = read(4, 'n2')
52
+ data_offsets =
53
+ Array.new(file.maximum_profile.num_glyphs + 1) do
54
+ read(4, 'N').first
55
+ end
56
+ {
57
+ ppem: ppem,
58
+ resolution: resolution,
59
+ offset: strike_offset,
60
+ glyph_data_offset: data_offsets
61
+ }
53
62
  end
54
- {
55
- ppem: ppem,
56
- resolution: resolution,
57
- offset: strike_offset,
58
- glyph_data_offset: data_offsets
59
- }
60
63
  end
61
- end
62
64
  end
63
65
  end
64
66
  end
@@ -11,7 +11,7 @@ module TTFunk
11
11
  attr_reader :default_vert_origin_y, :count
12
12
 
13
13
  def self.encode(vorg)
14
- return nil unless vorg
14
+ return unless vorg
15
15
 
16
16
  ''.b.tap do |table|
17
17
  table << [
@@ -21,7 +21,7 @@ module TTFunk
21
21
  search_range = 2**Math.log2(tables.length).floor * 16
22
22
  entry_selector = Math.log2(2**Math.log2(tables.length).floor).to_i
23
23
  range_shift = tables.length * 16 - search_range
24
- range_shift = 0 if range_shift < 0
24
+ range_shift = 0 if range_shift.negative?
25
25
 
26
26
  newfont = EncodedString.new
27
27
 
@@ -186,7 +186,7 @@ module TTFunk
186
186
  'VORG' => vorg_table,
187
187
  'DSIG' => dsig_table,
188
188
  'gasp' => gasp_table
189
- }.reject { |_tag, table| table.nil? }
189
+ }.compact
190
190
  end
191
191
 
192
192
  def glyphs
@@ -202,7 +202,7 @@ module TTFunk
202
202
  end
203
203
 
204
204
  def checksum(data)
205
- align(raw(data), 4).unpack('N*').reduce(0, :+) & 0xFFFF_FFFF
205
+ align(raw(data), 4).unpack('N*').sum & 0xFFFF_FFFF
206
206
  end
207
207
 
208
208
  def raw(data)
@@ -210,7 +210,7 @@ module TTFunk
210
210
  end
211
211
 
212
212
  def align(data, width)
213
- if data.length % width > 0
213
+ if (data.length % width).positive?
214
214
  data + "\0" * (width - data.length % width)
215
215
  else
216
216
  data
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.2.1
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregory Brown
@@ -10,116 +10,46 @@ authors:
10
10
  - Jonathan Greenberg
11
11
  - James Healy
12
12
  - Cameron Dutro
13
- autorequire:
13
+ autorequire:
14
14
  bindir: bin
15
15
  cert_chain:
16
16
  - |
17
17
  -----BEGIN CERTIFICATE-----
18
- MIIDMjCCAhqgAwIBAgIBAjANBgkqhkiG9w0BAQsFADA/MQ0wCwYDVQQDDARhbGV4
19
- MRkwFwYKCZImiZPyLGQBGRYJcG9pbnRsZXNzMRMwEQYKCZImiZPyLGQBGRYDb25l
20
- MB4XDTE5MTIwMjEwMjAzNVoXDTIwMTIwMTEwMjAzNVowPzENMAsGA1UEAwwEYWxl
21
- eDEZMBcGCgmSJomT8ixkARkWCXBvaW50bGVzczETMBEGCgmSJomT8ixkARkWA29u
22
- ZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM85Us8YQr55o/rMl+J+
23
- ula89ODiqjdc0kk+ibzRLCpfaFUJWxEMrhFiApRCopFDMeGXHXjBkfBYsRMFVs0M
24
- Zfe6rIKdNZQlQqHfJ2JlKFek0ehX81buGERi82wNwECNhOZu9c6G5gKjRPP/Q3Y6
25
- K6f/TAggK0+/K1j1NjT+WSVaMBuyomM067ejwhiQkEA3+tT3oT/paEXCOfEtxOdX
26
- 1F8VFd2MbmMK6CGgHbFLApfyDBtDx+ydplGZ3IMZg2nPqwYXTPJx+IuRO21ssDad
27
- gBMIAvL3wIeezJk2xONvhYg0K5jbIQOPB6zD1/9E6Q0LrwSBDkz5oyOn4PRZxgZ/
28
- OiMCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQ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EwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBRPgIwSVbeonua/
28
+ Ny/8576oxdUbrjAdBgNVHREEFjAUgRJhbGV4QHBvaW50bGVzcy5vbmUwHQYDVR0S
29
+ BBYwFIESYWxleEBwb2ludGxlc3Mub25lMA0GCSqGSIb3DQEBCwUAA4IBAQAzhGxF
30
+ M0bXJ9GWD9vdVHOyzBQBJcJAvnsz2yV3+r4eJBsQynFIscsea8lHFL/d1eHYP0mN
31
+ k0fhK+WDcPlrj0Sn/Ezhk2qogTIekwDOK6pZkGRQzD45leJqQMnYd+/TXK3ri485
32
+ Gi4oJ6NitnnUT59SQnjD5JcENfc0EcRzclmVRFE8W4O+ORgo4Dypq1rwYUzxeyUk
33
+ mP5jNBWtH+hGUph28GQb0Hph6YnQb8zEFB88Xq80PK1SzkIPHpbTBk9mwPf6ypeX
34
+ Un1TJEahAlgENVml6CyDXSwk0H8N1V3gm1mb9Fe1T2Z/kAzvjo0qTDEtMVLU7Bxh
35
+ uqMUrdETjTnRYCVq
36
36
  -----END CERTIFICATE-----
37
- date: 2020-02-14 00:00:00.000000000 Z
37
+ date: 2020-12-29 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
- name: rake
40
+ name: prawn-dev
41
41
  requirement: !ruby/object:Gem::Requirement
42
42
  requirements:
43
43
  - - "~>"
44
44
  - !ruby/object:Gem::Version
45
- version: '12'
45
+ version: 0.1.0
46
46
  type: :development
47
47
  prerelease: false
48
48
  version_requirements: !ruby/object:Gem::Requirement
49
49
  requirements:
50
50
  - - "~>"
51
51
  - !ruby/object:Gem::Version
52
- version: '12'
53
- - !ruby/object:Gem::Dependency
54
- name: rspec
55
- requirement: !ruby/object:Gem::Requirement
56
- requirements:
57
- - - "~>"
58
- - !ruby/object:Gem::Version
59
- version: '3.5'
60
- type: :development
61
- prerelease: false
62
- version_requirements: !ruby/object:Gem::Requirement
63
- requirements:
64
- - - "~>"
65
- - !ruby/object:Gem::Version
66
- version: '3.5'
67
- - !ruby/object:Gem::Dependency
68
- name: rubocop
69
- requirement: !ruby/object:Gem::Requirement
70
- requirements:
71
- - - "~>"
72
- - !ruby/object:Gem::Version
73
- version: '0.68'
74
- type: :development
75
- prerelease: false
76
- version_requirements: !ruby/object:Gem::Requirement
77
- requirements:
78
- - - "~>"
79
- - !ruby/object:Gem::Version
80
- version: '0.68'
81
- - !ruby/object:Gem::Dependency
82
- name: rubocop-performance
83
- requirement: !ruby/object:Gem::Requirement
84
- requirements:
85
- - - "~>"
86
- - !ruby/object:Gem::Version
87
- version: '1.1'
88
- type: :development
89
- prerelease: false
90
- version_requirements: !ruby/object:Gem::Requirement
91
- requirements:
92
- - - "~>"
93
- - !ruby/object:Gem::Version
94
- version: '1.1'
95
- - !ruby/object:Gem::Dependency
96
- name: rubocop-rspec
97
- requirement: !ruby/object:Gem::Requirement
98
- requirements:
99
- - - "~>"
100
- - !ruby/object:Gem::Version
101
- version: '1.32'
102
- type: :development
103
- prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- requirements:
106
- - - "~>"
107
- - !ruby/object:Gem::Version
108
- version: '1.32'
109
- - !ruby/object:Gem::Dependency
110
- name: yard
111
- requirement: !ruby/object:Gem::Requirement
112
- requirements:
113
- - - "~>"
114
- - !ruby/object:Gem::Version
115
- version: '0.9'
116
- type: :development
117
- prerelease: false
118
- version_requirements: !ruby/object:Gem::Requirement
119
- requirements:
120
- - - "~>"
121
- - !ruby/object:Gem::Version
122
- version: '0.9'
52
+ version: 0.1.0
123
53
  description: Font Metrics Parser for the Prawn PDF generator
124
54
  email:
125
55
  - gregory.t.brown@gmail.com
@@ -225,23 +155,23 @@ licenses:
225
155
  - GPL-2.0
226
156
  - GPL-3.0
227
157
  metadata: {}
228
- post_install_message:
158
+ post_install_message:
229
159
  rdoc_options: []
230
160
  require_paths:
231
161
  - lib
232
162
  required_ruby_version: !ruby/object:Gem::Requirement
233
163
  requirements:
234
- - - "~>"
164
+ - - ">="
235
165
  - !ruby/object:Gem::Version
236
- version: '2.4'
166
+ version: '2.5'
237
167
  required_rubygems_version: !ruby/object:Gem::Requirement
238
168
  requirements:
239
169
  - - ">="
240
170
  - !ruby/object:Gem::Version
241
171
  version: '0'
242
172
  requirements: []
243
- rubygems_version: 3.0.3
244
- signing_key:
173
+ rubygems_version: 3.2.3
174
+ signing_key:
245
175
  specification_version: 4
246
176
  summary: TrueType Font Metrics Parser
247
177
  test_files: []
metadata.gz.sig CHANGED
Binary file