text2svg 0.3.1 → 0.3.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 11492d4c01bc7b5f3666b2dc0b4bd4e5169c802b
4
- data.tar.gz: 71f7d560f7de8a0780db471d7785da77d03448fb
3
+ metadata.gz: 39979ba9c4c9e523e0b5352d5e925e6e4cde104e
4
+ data.tar.gz: 0974fb70be866aa90bbc23b7a6eea4554dbc6f6f
5
5
  SHA512:
6
- metadata.gz: b8bd0e32fe33cb34c98e07140cf124afbcd8acb9bce119d55a3c75593298daea83a7314e3cd8981ebaa1435558f9ae8a82f7470c6d7147021c9b964f7de2d761
7
- data.tar.gz: 46de4a1e9ab9d27dc20b3e0561a07f9eb50793377b916af7b0fe80750af6f6331495ddd032f0a57196f852cf4e132459f74bd1fed5dc702408a22c38fbd27d45
6
+ metadata.gz: 31a9e426f33bb9e180febe74b3de0ff2eb86c83827b86db2f3eafe67650da4112492ee3f0895372bc806baf2240c5c31165d47b17ceea4d0d1d27c79132ed4ab
7
+ data.tar.gz: c38d2d1fdcd2ba77fa9137177237118ef494a449a769429aecbee7a7cb52938a18a3b9102c9b3e2cb552978aa7bc36d16eafd71dd5b6f68497f433b8249b7ae0
@@ -46,12 +46,13 @@ module Text2svg
46
46
  lines = []
47
47
  line = []
48
48
  lines << line
49
- first_hori_bearing_x = []
49
+ first_hori_bearing_x = [0]
50
50
 
51
51
  space_width = f.glyph(' '.freeze).char_width
52
52
  text.each_char.with_index do |char, index|
53
53
  if NEW_LINE.match char
54
54
  line = []
55
+ first_hori_bearing_x << 0
55
56
  lines << line
56
57
  next
57
58
  end
@@ -78,7 +79,7 @@ module Text2svg
78
79
  [space_width, space_width, false]
79
80
  else
80
81
  if line.empty?
81
- first_hori_bearing_x << glyph.metrics[:horiBearingX]
82
+ first_hori_bearing_x[first_hori_bearing_x.length - 1] = glyph.metrics[:horiBearingX]
82
83
  end
83
84
  [glyph.metrics[:horiAdvance], glyph.metrics[:width], true]
84
85
  end
@@ -28,19 +28,21 @@ module Text2svgTypographyTest
28
28
  opt.bold = bold
29
29
  [false, true].each do |italic|
30
30
  opt.italic = italic
31
- begin
32
- c = Text2svg::Typography.build('A', opt)
33
- rescue
34
- t.log(opt)
35
- raise
36
- end
31
+ ['ABC', "\n", "\n\nA", "", "A\nB\n\n", "A\n\n\nC"].each do |text|
32
+ begin
33
+ c = Text2svg::Typography.build(text, opt)
34
+ rescue => e
35
+ t.log("raise error #{e.class}: #{e.message} with text=\"#{text}\",opt=#{opt}")
36
+ raise
37
+ end
37
38
 
38
- unless Text2svg::Content === c
39
- t.error('return value was break')
40
- end
39
+ unless Text2svg::Content === c
40
+ t.error('return value was break')
41
+ end
41
42
 
42
- unless c.data.encoding == Encoding::UTF_8
43
- t.error('encoding was changed')
43
+ unless c.data.encoding == Encoding::UTF_8
44
+ t.error('encoding was changed')
45
+ end
44
46
  end
45
47
  end
46
48
  end
@@ -1,3 +1,3 @@
1
1
  module Text2svg
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
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.1
4
+ version: 0.3.2
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-23 00:00:00.000000000 Z
11
+ date: 2016-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: freetype