text2svg 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/text2svg/cli.rb +1 -1
- data/lib/text2svg/typography.rb +3 -2
- data/lib/text2svg/typography_test.rb +1 -1
- data/lib/text2svg/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76e9ae548aa0e72a21afcd611def78a1c9b55000
|
4
|
+
data.tar.gz: 34f55782b5ff78a653bb66b9e93dde1e040ce72b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32eb3e5afefe56cb945639c293b63a8c304ce3446f5b3f59ca658f9cc06f26108e25d9eae46192db7031e5ab663b036f9da8efe607b274091e0af2d65e22163b
|
7
|
+
data.tar.gz: 35d48ca7a0aa0c151734fdd91c9555fefabaf9a4222e461fcb5f799d438089731635dfd67a635e74360420954a8e967f0b0492677499fa8790deeb2876f5e45e
|
data/lib/text2svg/cli.rb
CHANGED
@@ -37,7 +37,7 @@ module Text2svg
|
|
37
37
|
raise ArgumentError, 'require `--font` cli option. see --help'
|
38
38
|
end
|
39
39
|
text = ARGV[0] || $stdin.read
|
40
|
-
puts Text2svg::Typography.build(text, o).to_s
|
40
|
+
puts Text2svg::Typography.build(text.dup, o).to_s
|
41
41
|
end
|
42
42
|
module_function :start
|
43
43
|
end
|
data/lib/text2svg/typography.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'cgi'
|
1
2
|
require 'freetype'
|
2
3
|
require 'text2svg/option'
|
3
4
|
|
@@ -19,7 +20,7 @@ module Text2svg
|
|
19
20
|
end
|
20
21
|
content = path(text, option)
|
21
22
|
svg = %(<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 #{content.width} #{content.height}">\n)
|
22
|
-
svg << "<title>#{text}</title>\n"
|
23
|
+
svg << "<title>#{CGI.escapeHTML(text.to_s)}</title>\n"
|
23
24
|
svg << content.data
|
24
25
|
svg << "</svg>\n"
|
25
26
|
Content.new(svg, content.width, content.height, content.notdef_indexes)
|
@@ -79,7 +80,7 @@ module Text2svg
|
|
79
80
|
[space_width, space_width, false]
|
80
81
|
else
|
81
82
|
if line.empty?
|
82
|
-
first_hori_bearing_x[
|
83
|
+
first_hori_bearing_x[-1] = glyph.metrics[:horiBearingX]
|
83
84
|
end
|
84
85
|
[glyph.metrics[:horiAdvance], glyph.metrics[:width], true]
|
85
86
|
end
|
@@ -28,7 +28,7 @@ module Text2svgTypographyTest
|
|
28
28
|
opt.bold = bold
|
29
29
|
[false, true].each do |italic|
|
30
30
|
opt.italic = italic
|
31
|
-
['ABC', "\n", "\n\nA", "", "A\nB\n\n", "A\n\n\nC"].each do |text|
|
31
|
+
['ABC', "\n", "\n\nA", "", "A\nB\n\n", "A\n\n\nC", "<", ">", "&", "=", "@", "%", "#", "("].each do |text|
|
32
32
|
begin
|
33
33
|
c = Text2svg::Typography.build(text, opt)
|
34
34
|
rescue => e
|
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.3.
|
4
|
+
version: 0.3.3
|
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-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: freetype
|