prawn-icon 2.1.0 → 3.0.0
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 +5 -5
- data/CHANGELOG.md +57 -1
- data/README.md +11 -1
- data/Rakefile +0 -1
- data/data/fonts/fa4/shims.yml +462 -0
- data/data/fonts/fab/LICENSE +1 -1
- data/data/fonts/fab/fa-brands.ttf +0 -0
- data/data/fonts/fab/fab.yml +131 -3
- data/data/fonts/far/LICENSE +1 -1
- data/data/fonts/far/fa-regular.ttf +0 -0
- data/data/fonts/far/far.yml +37 -1
- data/data/fonts/fas/LICENSE +1 -1
- data/data/fonts/fas/fa-solid.ttf +0 -0
- data/data/fonts/fas/fas.yml +503 -1
- data/examples/fontawesome.rb +3 -2
- data/examples/foundation_icons.rb +3 -2
- data/examples/paymentfont.rb +4 -3
- data/lib/prawn/icon.rb +2 -0
- data/lib/prawn/icon/base.rb +14 -2
- data/lib/prawn/icon/compatibility.rb +17 -130
- data/lib/prawn/icon/configuration.rb +40 -0
- data/lib/prawn/icon/font_data.rb +5 -3
- data/lib/prawn/icon/interface.rb +35 -8
- data/lib/prawn/icon/version.rb +1 -1
- data/spec/integration/icon_spec.rb +67 -15
- data/spec/unit/base_spec.rb +25 -6
- data/spec/unit/configuration_spec.rb +21 -0
- data/spec/unit/errors/icon_key_empty_spec.rb +1 -3
- data/spec/unit/errors/icon_not_found_spec.rb +1 -3
- data/spec/unit/font_data_spec.rb +9 -9
- data/spec/unit/icon_spec.rb +15 -15
- data/spec/unit/parser_spec.rb +6 -4
- metadata +9 -7
data/spec/unit/base_spec.rb
CHANGED
@@ -4,12 +4,31 @@
|
|
4
4
|
#
|
5
5
|
# This is free software. Please see the LICENSE and COPYING files for details.
|
6
6
|
|
7
|
-
describe Prawn::Icon
|
8
|
-
describe '
|
9
|
-
it 'returns
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
describe Prawn::Icon do
|
8
|
+
describe '#configuration' do
|
9
|
+
it 'returns an instance of Prawn::Icon::Configuration' do
|
10
|
+
expect(described_class.configuration).to be_a(Prawn::Icon::Configuration)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#configure' do
|
15
|
+
around(:each) do |example|
|
16
|
+
old = described_class.configuration.dup
|
17
|
+
described_class.configure do |config|
|
18
|
+
config.font_directory = '/tmp/fonts'
|
19
|
+
end
|
20
|
+
example.run
|
21
|
+
described_class.configuration = old
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'yields control' do
|
25
|
+
expect { |b| described_class.configure(&b) }.to yield_control
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'configures properties' do
|
29
|
+
expect(described_class.configuration.font_directory).to eq(
|
30
|
+
Pathname.new('/tmp/fonts')
|
31
|
+
)
|
13
32
|
end
|
14
33
|
end
|
15
34
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright October 2020, Jesse Doyle. All rights reserved.
|
4
|
+
#
|
5
|
+
# This is free software. Please see the LICENSE and COPYING files for details.
|
6
|
+
|
7
|
+
describe Prawn::Icon::Configuration do
|
8
|
+
describe '#font_directory' do
|
9
|
+
before(:each) do
|
10
|
+
subject.font_directory = '/tmp/fakedir'
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'returns a Pathname' do
|
14
|
+
expect(subject.font_directory).to be_a(Pathname)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'returns the configured path' do
|
18
|
+
expect(subject.font_directory.to_s).to eq('/tmp/fakedir')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -12,8 +12,6 @@ describe Prawn::Icon::Errors::IconNotFound do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'is thrown on an invalid icon key' do
|
15
|
-
|
16
|
-
|
17
|
-
expect(proc).to raise_error(described_class)
|
15
|
+
expect { pdf.icon('far-an invalid key') }.to raise_error(described_class)
|
18
16
|
end
|
19
17
|
end
|
data/spec/unit/font_data_spec.rb
CHANGED
@@ -72,15 +72,15 @@ describe Prawn::Icon::FontData do
|
|
72
72
|
end
|
73
73
|
|
74
74
|
it 'should error when key is nil' do
|
75
|
-
|
76
|
-
|
77
|
-
|
75
|
+
expect { Prawn::Icon::FontData.specifier_from_key(nil) }.to raise_error(
|
76
|
+
Prawn::Icon::Errors::IconKeyEmpty
|
77
|
+
)
|
78
78
|
end
|
79
79
|
|
80
80
|
it 'should error when key is an empty string' do
|
81
|
-
|
82
|
-
|
83
|
-
|
81
|
+
expect { Prawn::Icon::FontData.specifier_from_key('') }.to raise_error(
|
82
|
+
Prawn::Icon::Errors::IconKeyEmpty
|
83
|
+
)
|
84
84
|
end
|
85
85
|
|
86
86
|
it 'should handle strings without any dashes properly' do
|
@@ -141,9 +141,9 @@ describe Prawn::Icon::FontData do
|
|
141
141
|
end
|
142
142
|
|
143
143
|
it 'should raise an error if unable to match a key' do
|
144
|
-
|
145
|
-
|
146
|
-
|
144
|
+
expect { fontawesome.unicode('an invalid sequence') }.to raise_error(
|
145
|
+
Prawn::Icon::Errors::IconNotFound
|
146
|
+
)
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
data/spec/unit/icon_spec.rb
CHANGED
@@ -19,25 +19,25 @@ describe Prawn::Icon do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'should raise an error if icon key is not found' do
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
expect { Prawn::Icon.new('far-__INVALID__', pdf) }.to raise_error(
|
23
|
+
errors::IconNotFound
|
24
|
+
)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
context 'invalid icon specifier' do
|
29
29
|
it 'should raise an error' do
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
expect { pdf.icon('__INVALID__ some text') }.to raise_error(
|
31
|
+
Prawn::Errors::UnknownFont
|
32
|
+
)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
context 'without a pdf object' do
|
37
37
|
it 'should raise an ArgumentError' do
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
expect { Prawn::Icon.new('far-address-book') }.to raise_error(
|
39
|
+
ArgumentError
|
40
|
+
)
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
@@ -80,9 +80,9 @@ describe Prawn::Icon do
|
|
80
80
|
|
81
81
|
context 'without dashes in key' do
|
82
82
|
it 'raise an error about invalid keys' do
|
83
|
-
|
84
|
-
|
85
|
-
|
83
|
+
expect { Prawn::Icon.new('some invalid key', pdf) }.to raise_error(
|
84
|
+
Prawn::Errors::UnknownFont
|
85
|
+
)
|
86
86
|
end
|
87
87
|
end
|
88
88
|
end
|
@@ -98,9 +98,9 @@ describe Prawn::Icon do
|
|
98
98
|
|
99
99
|
context 'invalid icon key' do
|
100
100
|
it 'should raise IconNotFound' do
|
101
|
-
|
102
|
-
|
103
|
-
|
101
|
+
expect { Prawn::Icon.new('far-__INVALID__', pdf) }.to raise_error(
|
102
|
+
errors::IconNotFound
|
103
|
+
)
|
104
104
|
end
|
105
105
|
end
|
106
106
|
end
|
data/spec/unit/parser_spec.rb
CHANGED
@@ -38,16 +38,18 @@ describe Prawn::Icon::Parser do
|
|
38
38
|
|
39
39
|
it 'should raise an error when an icon key is invalid' do
|
40
40
|
string = '<icon>an invalid key</icon>'
|
41
|
-
proc = Proc.new { Prawn::Icon::Parser.format(pdf, string) }
|
42
41
|
|
43
|
-
expect(
|
42
|
+
expect { Prawn::Icon::Parser.format(pdf, string) }.to raise_error(
|
43
|
+
Prawn::Errors::UnknownFont
|
44
|
+
)
|
44
45
|
end
|
45
46
|
|
46
47
|
it 'should raise an error when an icon is not found for valid set' do
|
47
48
|
string = '<icon>far-__INVALID__</icon>'
|
48
|
-
proc = Proc.new { Prawn::Icon::Parser.format(pdf, string) }
|
49
49
|
|
50
|
-
expect(
|
50
|
+
expect { Prawn::Icon::Parser.format(pdf, string) }.to raise_error(
|
51
|
+
Prawn::Icon::Errors::IconNotFound
|
52
|
+
)
|
51
53
|
end
|
52
54
|
end
|
53
55
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prawn-icon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesse Doyle
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: prawn
|
@@ -133,6 +133,7 @@ files:
|
|
133
133
|
- README.md
|
134
134
|
- Rakefile
|
135
135
|
- data/fonts/DejaVuSans.ttf
|
136
|
+
- data/fonts/fa4/shims.yml
|
136
137
|
- data/fonts/fab/LICENSE
|
137
138
|
- data/fonts/fab/fa-brands.ttf
|
138
139
|
- data/fonts/fab/fab.yml
|
@@ -157,6 +158,7 @@ files:
|
|
157
158
|
- lib/prawn/icon.rb
|
158
159
|
- lib/prawn/icon/base.rb
|
159
160
|
- lib/prawn/icon/compatibility.rb
|
161
|
+
- lib/prawn/icon/configuration.rb
|
160
162
|
- lib/prawn/icon/errors.rb
|
161
163
|
- lib/prawn/icon/font_data.rb
|
162
164
|
- lib/prawn/icon/interface.rb
|
@@ -169,6 +171,7 @@ files:
|
|
169
171
|
- spec/support/pdf_helper.rb
|
170
172
|
- spec/unit/base_spec.rb
|
171
173
|
- spec/unit/compatibility_spec.rb
|
174
|
+
- spec/unit/configuration_spec.rb
|
172
175
|
- spec/unit/errors/icon_key_empty_spec.rb
|
173
176
|
- spec/unit/errors/icon_not_found_spec.rb
|
174
177
|
- spec/unit/font_data_spec.rb
|
@@ -180,7 +183,7 @@ licenses:
|
|
180
183
|
- GPL-2
|
181
184
|
- GPL-3
|
182
185
|
metadata: {}
|
183
|
-
post_install_message:
|
186
|
+
post_install_message:
|
184
187
|
rdoc_options: []
|
185
188
|
require_paths:
|
186
189
|
- lib
|
@@ -195,9 +198,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
195
198
|
- !ruby/object:Gem::Version
|
196
199
|
version: 1.3.6
|
197
200
|
requirements: []
|
198
|
-
|
199
|
-
|
200
|
-
signing_key:
|
201
|
+
rubygems_version: 3.1.2
|
202
|
+
signing_key:
|
201
203
|
specification_version: 4
|
202
204
|
summary: Provides icon fonts for PrawnPDF
|
203
205
|
test_files: []
|