prawn-svg 0.38.0 → 0.38.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d9d63836ebf08ec1ebd6320b61a8f4b93c5df29e91e6e1397b53c65d548e8afe
4
- data.tar.gz: 25ad6658329c42589d086e592589908a1c556a631503578219c308ab095fa513
3
+ metadata.gz: 48e3c463c4c8684671c20e26e701c51d07fd58322f2a7557d03b1ccccd1621c3
4
+ data.tar.gz: 12e77f6409d625d9e2682f1efdd9519f983a8dc24e8dcc7371ff79febe2a43ea
5
5
  SHA512:
6
- metadata.gz: d73e5adc3fa832d2ed9159cf02cea3b47cf3923ff0e145af4de426effeb6157d4d133d600bf708ccd963a736d517fccb8a7c8d410ee479025288193659d34859
7
- data.tar.gz: 20d5d9f28438c3ca4c23454541f763b1766f3df9719ced30a3451abc08e21913cf4276d2c148d9af695bab9e4670b01dcc1985fe5d9a9ebd94cfc08cee755818
6
+ metadata.gz: 9f212b78477d9211a1ca009f7667d05f27f0138e467939d19d1c252a017a416e2a0267e613426142c50b77e83a613cc12e2e65af8d38e3e7c71bcf0816cc062a
7
+ data.tar.gz: fb5f095597da89d3d6127429b51f4fe8cc125ef14c01f3046bd0a7fced4379abb9ad2bf89a35ec2f38c96e4d06775a2c8dd7edec85bca947e385c90e00b6435a
data/Gemfile.lock CHANGED
@@ -1,11 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- prawn-svg (0.38.0)
4
+ prawn-svg (0.38.1)
5
5
  css_parser (~> 1.6)
6
6
  matrix (~> 0.4.2)
7
7
  prawn (>= 0.11.1, < 3)
8
- rexml (>= 3.3.9, < 4)
8
+ rexml (>= 3.4.2, < 4)
9
9
 
10
10
  GEM
11
11
  remote: http://rubygems.org/
@@ -34,7 +34,7 @@ GEM
34
34
  rainbow (3.1.1)
35
35
  rake (13.2.1)
36
36
  regexp_parser (2.9.2)
37
- rexml (3.4.0)
37
+ rexml (3.4.4)
38
38
  rspec (3.13.0)
39
39
  rspec-core (~> 3.13.0)
40
40
  rspec-expectations (~> 3.13.0)
@@ -119,7 +119,7 @@ module Prawn::SVG::CSS
119
119
  when '^='
120
120
  result << "[starts-with(@#{key}, #{xpath_quote value})]"
121
121
  when '$='
122
- result << "[substring(@#{key}, string-length(@#{key}) - #{value.length - 1}) = #{xpath_quote value})]"
122
+ result << "[substring(@#{key}, string-length(@#{key}) - #{value.length - 1}) = #{xpath_quote value}]"
123
123
  when '*='
124
124
  result << "[contains(@#{key}, #{xpath_quote value})]"
125
125
  when '~='
@@ -6,10 +6,12 @@ module Prawn::SVG
6
6
  @root_component = Elements::TextComponent.new(document, source, [], state.dup)
7
7
  @root_component.process
8
8
 
9
- reintroduce_trailing_and_leading_whitespace
9
+ reintroduce_trailing_and_leading_whitespace if @root_component.children
10
10
  end
11
11
 
12
12
  def render(prawn, renderer)
13
+ return unless @root_component.children
14
+
13
15
  @root_component.lay_out(prawn)
14
16
 
15
17
  translate_x =
@@ -58,7 +58,8 @@ module Prawn::SVG
58
58
 
59
59
  def find_suitable_font(name, weight, style)
60
60
  name = correctly_cased_font_name(name) || name
61
- name = GENERIC_CSS_FONT_MAPPING[name] if GENERIC_CSS_FONT_MAPPING.key?(name)
61
+
62
+ name = GENERIC_CSS_FONT_MAPPING[name] if GENERIC_CSS_FONT_MAPPING.key?(name) && !installed_fonts.key?(name)
62
63
 
63
64
  return unless (subfamilies = installed_fonts[name])
64
65
  return if subfamilies.empty?
@@ -104,7 +104,13 @@ module Prawn
104
104
  if skip
105
105
  # the call has been overridden
106
106
  elsif children.empty? && call != 'transparent' # some prawn calls complain if they aren't supplied a block
107
- prawn.send(call, *arguments, **kwarguments)
107
+ if kwarguments.empty?
108
+ prawn.send(call, *arguments)
109
+ else
110
+ prawn.send(call, *arguments, **kwarguments)
111
+ end
112
+ elsif kwarguments.empty?
113
+ prawn.send(call, *arguments, &proc_creator(prawn, children))
108
114
  else
109
115
  prawn.send(call, *arguments, **kwarguments, &proc_creator(prawn, children))
110
116
  end
@@ -1,5 +1,5 @@
1
1
  module Prawn
2
2
  module SVG
3
- VERSION = '0.38.0'.freeze
3
+ VERSION = '0.38.1'.freeze
4
4
  end
5
5
  end
data/prawn-svg.gemspec CHANGED
@@ -22,5 +22,5 @@ Gem::Specification.new do |gem|
22
22
  gem.add_dependency 'css_parser', '~> 1.6'
23
23
  gem.add_dependency 'matrix', '~> 0.4.2'
24
24
  gem.add_dependency 'prawn', '>= 0.11.1', '< 3'
25
- gem.add_dependency 'rexml', '>= 3.3.9', '< 4'
25
+ gem.add_dependency 'rexml', '>= 3.4.2', '< 4'
26
26
  end
@@ -73,7 +73,7 @@ RSpec.describe Prawn::SVG::CSS::Stylesheets do
73
73
  ]
74
74
 
75
75
  expected << [5,
76
- [['fill', '#ff0000', false], ['fill', '#330000', false], ['fill', '#330000', false], ['fill', '#440000', false],
76
+ [['fill', '#ff0000', false], ['fill', '#330000', false], ['fill', '#440000', false],
77
77
  ['fill', '#00ff00', false]]]
78
78
 
79
79
  expected.push(
@@ -15,6 +15,15 @@ RSpec.describe Prawn::SVG::FontRegistry do
15
15
  expect(font_registry.load('blah, serif , test').name).to eq('Times-Roman')
16
16
  end
17
17
 
18
+ it 'allows generic font family to be remapped in font registry' do
19
+ pdf = Prawn::Document.new
20
+ pdf.font_families.update('serif' => { normal: 'Courier' })
21
+ registry = Prawn::SVG::FontRegistry.new(pdf.font_families)
22
+
23
+ font = registry.load('serif')
24
+ expect(font.name).to eq('serif')
25
+ end
26
+
18
27
  if Prawn::SVG::FontRegistry.new({}).installed_fonts['Verdana']
19
28
  it 'matches a font installed on the system' do
20
29
  expect(font_registry.load('verdana, sans-serif').name).to eq('Verdana')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prawn-svg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.38.0
4
+ version: 0.38.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mog Nesbitt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-08-08 00:00:00.000000000 Z
11
+ date: 2025-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: css_parser
@@ -64,7 +64,7 @@ dependencies:
64
64
  requirements:
65
65
  - - ">="
66
66
  - !ruby/object:Gem::Version
67
- version: 3.3.9
67
+ version: 3.4.2
68
68
  - - "<"
69
69
  - !ruby/object:Gem::Version
70
70
  version: '4'
@@ -74,7 +74,7 @@ dependencies:
74
74
  requirements:
75
75
  - - ">="
76
76
  - !ruby/object:Gem::Version
77
- version: 3.3.9
77
+ version: 3.4.2
78
78
  - - "<"
79
79
  - !ruby/object:Gem::Version
80
80
  version: '4'