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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 39979ba9c4c9e523e0b5352d5e925e6e4cde104e
4
- data.tar.gz: 0974fb70be866aa90bbc23b7a6eea4554dbc6f6f
3
+ metadata.gz: 76e9ae548aa0e72a21afcd611def78a1c9b55000
4
+ data.tar.gz: 34f55782b5ff78a653bb66b9e93dde1e040ce72b
5
5
  SHA512:
6
- metadata.gz: 31a9e426f33bb9e180febe74b3de0ff2eb86c83827b86db2f3eafe67650da4112492ee3f0895372bc806baf2240c5c31165d47b17ceea4d0d1d27c79132ed4ab
7
- data.tar.gz: c38d2d1fdcd2ba77fa9137177237118ef494a449a769429aecbee7a7cb52938a18a3b9102c9b3e2cb552978aa7bc36d16eafd71dd5b6f68497f433b8249b7ae0
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
@@ -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[first_hori_bearing_x.length - 1] = glyph.metrics[:horiBearingX]
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
@@ -1,3 +1,3 @@
1
1
  module Text2svg
2
- VERSION = '0.3.2'
2
+ VERSION = '0.3.3'
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.3.2
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-02-25 00:00:00.000000000 Z
11
+ date: 2016-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: freetype