text2svg 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 50a6d18c07bd996b35d694f9316685611ae3680f
4
- data.tar.gz: 11ad00087eb6292b4805610df01b4c8e165fc23f
3
+ metadata.gz: fb9097869e548d0d521b284bab36a7575faef22c
4
+ data.tar.gz: 086e5ca78767e593bd6e29616cb1e705732c171f
5
5
  SHA512:
6
- metadata.gz: 999e7ce52316d2550e98b1b611b35c52c5c3868b4a3fd6f91dd3c9116723576437c4f678070a4566e9b2549658be53af4113b3e842d1eabc128e30381a99eae5
7
- data.tar.gz: 11e8ec2c883b133aa8e66bfabc6243b3b557e00c3a796fcc7297c4e8a86a29a06342adde92d5d85df59d7dbb50c5528fb1e5297a13d52789c4d542e2ccb47fc2
6
+ metadata.gz: d79aa7e101a7679cfed6afb3096bc5c62304ab07a6ee1491d55d3495bfd5a8f376e078c784e09d8d9c40394ed3dc1ee056678413e1d626f7ce48c6c2c12ffd04
7
+ data.tar.gz: 5c4972e885cf91c5a139c301a7e606b7f4f0d067d947f50f6a6ca1f83fa8e1571c416eb8685054ec7a659ce4f9b3b1e4f7660ea8b2b8b9b41b097cd5d4c6ec68
@@ -161,10 +161,20 @@ module Text2svg
161
161
  output << %!<g transform="matrix(1,0,0,1,0,#{y.round})">\n!
162
162
 
163
163
  x -= min_hori_bearing_x_all * option.scale
164
+ sr = option.scale.rationalize
164
165
  line.each do |cs|
165
166
  x += f.kerning_unfitted(before_char, cs.char).x * option.scale
166
167
  if cs.draw?
167
- d = cs.outline2d.map { |cmd, *points| [cmd, *(points.map { |i| i * option.scale })] }
168
+ d = cs.outline2d.map do |cmd, *points|
169
+ [
170
+ cmd,
171
+ *points.map { |i|
172
+ i.rationalize * sr
173
+ }.map do |i|
174
+ i.denominator == 1 ? i.to_i : i.to_f
175
+ end,
176
+ ]
177
+ end
168
178
  output << %! <path transform="matrix(1,0,0,1,#{x.round},0)" d="#{d.join(' '.freeze)}"/>\n!
169
179
  end
170
180
  x += cs.metrics[:horiAdvance] * option.scale
@@ -192,9 +202,9 @@ module Text2svg
192
202
  return 0 if line.empty?
193
203
  point = 0
194
204
  bearings = line.map do |cs|
195
- (cs.metrics[:horiBearingX] + point).tap {
205
+ (cs.metrics[:horiBearingX] + point).tap do
196
206
  point += cs.metrics[:horiAdvance]
197
- }
207
+ end
198
208
  end
199
209
  bearings.min
200
210
  end
@@ -1,3 +1,3 @@
1
1
  module Text2svg
2
- VERSION = '0.5.0'
2
+ VERSION = '0.5.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: text2svg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ksss
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-26 00:00:00.000000000 Z
11
+ date: 2016-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: freetype
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  version: '0'
115
115
  requirements: []
116
116
  rubyforge_project:
117
- rubygems_version: 2.5.1
117
+ rubygems_version: 2.6.4
118
118
  signing_key:
119
119
  specification_version: 4
120
120
  summary: Build svg path data from font file