text2svg 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/text2svg/typography.rb +13 -3
- data/lib/text2svg/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb9097869e548d0d521b284bab36a7575faef22c
|
4
|
+
data.tar.gz: 086e5ca78767e593bd6e29616cb1e705732c171f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d79aa7e101a7679cfed6afb3096bc5c62304ab07a6ee1491d55d3495bfd5a8f376e078c784e09d8d9c40394ed3dc1ee056678413e1d626f7ce48c6c2c12ffd04
|
7
|
+
data.tar.gz: 5c4972e885cf91c5a139c301a7e606b7f4f0d067d947f50f6a6ca1f83fa8e1571c416eb8685054ec7a659ce4f9b3b1e4f7660ea8b2b8b9b41b097cd5d4c6ec68
|
data/lib/text2svg/typography.rb
CHANGED
@@ -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
|
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
|
data/lib/text2svg/version.rb
CHANGED
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.
|
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-
|
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.
|
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
|