prawn-emoji 3.0.0 β 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/CHANGELOG.md +12 -4
- data/Dockerfile +18 -0
- data/README.md +68 -44
- data/Rakefile +24 -8
- data/emoji/LICENSE +1 -0
- data/emoji/images/1f3f3-200d-26a7.png +0 -0
- data/emoji/images/1f3f5.png +0 -0
- data/emoji/images/1f5f3.png +0 -0
- data/emoji/images/1f93e-1f3fb-200d-2640.png +0 -0
- data/emoji/images/1f93e-1f3fb-200d-2642.png +0 -0
- data/emoji/images/1f93e-1f3fb.png +0 -0
- data/emoji/images/1f93e-1f3fc-200d-2640.png +0 -0
- data/emoji/images/1f93e-1f3fc-200d-2642.png +0 -0
- data/emoji/images/1f93e-1f3fc.png +0 -0
- data/emoji/images/1f93e-1f3fd-200d-2640.png +0 -0
- data/emoji/images/1f93e-1f3fd-200d-2642.png +0 -0
- data/emoji/images/1f93e-1f3fd.png +0 -0
- data/emoji/images/1f93e-1f3fe-200d-2640.png +0 -0
- data/emoji/images/1f93e-1f3fe-200d-2642.png +0 -0
- data/emoji/images/1f93e-1f3fe.png +0 -0
- data/emoji/images/1f93e-1f3ff-200d-2640.png +0 -0
- data/emoji/images/1f93e-1f3ff-200d-2642.png +0 -0
- data/emoji/images/1f93e-1f3ff.png +0 -0
- data/emoji/images/1f93e-200d-2640.png +0 -0
- data/emoji/images/1f93e-200d-2642.png +0 -0
- data/emoji/images/1f93e.png +0 -0
- data/emoji/images/1f9e9.png +0 -0
- data/emoji/images/26a7.png +0 -0
- data/emoji/index.yml +2 -0
- data/lib/prawn/emoji/version.rb +1 -1
- data/prawn-emoji.gemspec +4 -4
- data/test/units/prawn/emoji/drawable_test.rb +1 -1
- data/test/units/prawn/emoji/drawer_test.rb +8 -8
- data/test/units/prawn/emoji/image_test.rb +3 -3
- data/test/units/prawn/emoji/index_test.rb +4 -4
- data/test/units/prawn/emoji/substitution_test.rb +6 -6
- data/test/units/prawn/emoji/text_test.rb +17 -17
- data/test/units/prawn/emoji/unicode_test.rb +10 -10
- data/test/units/prawn/emoji_test.rb +2 -2
- metadata +12 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: daf771f97cb509327b1887c2f0776a9c6ea25defe006274890c78ab7cb68e53e
|
4
|
+
data.tar.gz: 9d080701c9efa0fc90cdc3c1580345212dca0ae6f1d532ed9edd9040e9205a4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38a841a56569f78bccdd3527d508cab7707bf249eee141de98b8d97435c0c5ffbdd9d9465d23dfed8e6b9e949ecafd00a5f0084e0396fe482e53832282177f9d
|
7
|
+
data.tar.gz: d2ec11134a18df62585ee5c1606ebacb22d65715471dc87b8ddfa83c3bce843bc12bc1402950c023a5a6fb6e9b454abf952b6167d11147f8ff34a09a57aabb40
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,20 +1,28 @@
|
|
1
|
+
## 3.1.0
|
2
|
+
|
3
|
+
### Minor Enhancements
|
4
|
+
|
5
|
+
* Update to Twemoji 12.1.3
|
6
|
+
* This version includes some new emoji support and emoji CHANGES. See [commit](https://github.com/hidakatsuya/prawn-emoji/commit/96cb731d337721bf89be9463d270cc46962380d9) for details
|
7
|
+
* Support Emoji 12.1
|
8
|
+
|
1
9
|
## 3.0.0
|
2
10
|
|
3
|
-
Big Changes
|
11
|
+
### Big Changes
|
4
12
|
|
5
13
|
* Switch emoji to [Twemoji](https://github.com/twitter/twemoji) v12.04 from EmojiOne v2.0
|
6
14
|
* See [#23 Switch to Twemoji](https://github.com/hidakatsuya/prawn-emoji/issues/23) for further details
|
7
15
|
* Support joined emojis like π¨βπ¨βπ¦ or 1οΈβ£
|
8
16
|
* See [#24 Joined emojis like π¨βπ¨βπ¦ or 1οΈβ£ are not drawn](https://github.com/hidakatsuya/prawn-emoji/issues/24) for further details
|
9
17
|
|
10
|
-
Breaking Changes
|
18
|
+
### Breaking Changes
|
11
19
|
|
12
20
|
* Drop support ruby2.1 and 2.2, 2.3
|
13
21
|
* prawn-emoji requires Prawn 2.2 (Drop support Prawn 2.1)
|
14
22
|
|
15
23
|
## 2.1.1
|
16
24
|
|
17
|
-
### Bug Fixes
|
25
|
+
### Bug Fixes
|
18
26
|
|
19
27
|
* Fixed: A text including multiple emojis are broken #19
|
20
28
|
|
@@ -28,7 +36,7 @@ Breaking Changes:
|
|
28
36
|
|
29
37
|
## 2.0.1
|
30
38
|
|
31
|
-
### Bug Fixes
|
39
|
+
### Bug Fixes
|
32
40
|
|
33
41
|
* Fixed: part of ASCII chars and symbols is unexpectedly replaced with emojis #17 [@juanfal]
|
34
42
|
|
data/Dockerfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
FROM ruby:2.6.3
|
2
|
+
|
3
|
+
RUN apt-get update -qq && apt-get install -y build-essential xvfb
|
4
|
+
|
5
|
+
# Install diff-pdf
|
6
|
+
WORKDIR /tmp
|
7
|
+
RUN apt-get install -y libpoppler-glib-dev poppler-utils libwxgtk3.0-dev && curl -L https://github.com/vslavik/diff-pdf/archive/master.tar.gz -o diff-pdf-master.tar.gz && tar zxf diff-pdf-master.tar.gz && cd diff-pdf-master && ./bootstrap && ./configure && make && make install
|
8
|
+
|
9
|
+
RUN mkdir /prawn-emoji
|
10
|
+
|
11
|
+
ADD . /prawn-emoji
|
12
|
+
|
13
|
+
WORKDIR /prawn-emoji
|
14
|
+
|
15
|
+
RUN bundle install
|
16
|
+
|
17
|
+
ENTRYPOINT [ "bundle", "exec", "rake" ]
|
18
|
+
CMD [ "test:pdf" ]
|
data/README.md
CHANGED
@@ -4,27 +4,7 @@
|
|
4
4
|
[![Build Status](https://travis-ci.org/hidakatsuya/prawn-emoji.svg)](https://travis-ci.org/hidakatsuya/prawn-emoji)
|
5
5
|
[![Maintainability](https://api.codeclimate.com/v1/badges/edcd23ef38c2e393513b/maintainability)](https://codeclimate.com/github/hidakatsuya/prawn-emoji/maintainability)
|
6
6
|
|
7
|
-
Prawn::Emoji is an extention
|
8
|
-
|
9
|
-
## Installation
|
10
|
-
|
11
|
-
Add this line to your application's Gemfile:
|
12
|
-
|
13
|
-
```ruby
|
14
|
-
gem 'prawn-emoji', require: false
|
15
|
-
```
|
16
|
-
|
17
|
-
And then execute:
|
18
|
-
|
19
|
-
$ bundle
|
20
|
-
|
21
|
-
Or install it yourself as:
|
22
|
-
|
23
|
-
$ gem install prawn-emoji
|
24
|
-
|
25
|
-
## Usage
|
26
|
-
|
27
|
-
In order to run the following code, you need to place [DejaVuSans.ttf](http://sourceforge.net/projects/dejavu/) in the same directory as the script file.
|
7
|
+
Prawn::Emoji is an extention that adds Emoji support to [Prawn](https://github.com/prawnpdf/prawn).
|
28
8
|
|
29
9
|
```ruby
|
30
10
|
require 'prawn/emoji'
|
@@ -35,28 +15,59 @@ Prawn::Document.generate 'sushi.pdf' do
|
|
35
15
|
end
|
36
16
|
```
|
37
17
|
|
18
|
+
For execute this code, you need [DejaVuSans.ttf](http://sourceforge.net/projects/dejavu/) font.
|
19
|
+
|
20
|
+
## Features
|
21
|
+
|
22
|
+
### Emoji
|
38
23
|
|
39
|
-
|
24
|
+
* Emoji is provided by [Twemoji](https://github.com/twitter/twemoji)
|
25
|
+
* Support Singleton/Combining/Modifier/Flag/ZWJ Sequence Emoji
|
40
26
|
|
41
|
-
|
27
|
+
See [test/pdf/emoji_rendering/expect.pdf](https://github.com/hidakatsuya/prawn-emoji/blob/master/test/pdf/emoji_rendering/expect.pdf) for details.
|
42
28
|
|
43
|
-
|
29
|
+
### Prawn Integration
|
44
30
|
|
45
|
-
* Emoji is provided by Twemoji https://github.com/twitter/twemoji
|
46
|
-
* Multi-character emoji support
|
47
31
|
* RTL support
|
48
32
|
* Character spacing support
|
49
33
|
* Rotation support
|
50
34
|
* Alignment support
|
51
35
|
* Font size support
|
52
36
|
|
37
|
+
See [test/pdf/prawn_integration/expect.pdf](https://github.com/hidakatsuya/prawn-emoji/blob/master/test/pdf/prawn_integration/expect.pdf) for details.
|
38
|
+
|
53
39
|
### Known Issues
|
54
40
|
|
55
|
-
|
41
|
+
[prawn-emoji/issues](https://github.com/hidakatsuya/prawn-emoji/labels/known%20issue)
|
42
|
+
|
43
|
+
|
44
|
+
## Installation
|
45
|
+
|
46
|
+
Add this line to your application's Gemfile:
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
gem 'prawn-emoji', require: false
|
50
|
+
```
|
51
|
+
|
52
|
+
And then execute:
|
53
|
+
|
54
|
+
$ bundle
|
55
|
+
|
56
|
+
Or install it yourself as:
|
57
|
+
|
58
|
+
$ gem install prawn-emoji
|
59
|
+
|
60
|
+
## Setup
|
56
61
|
|
57
|
-
|
62
|
+
```ruby
|
63
|
+
require 'prawn/emoji'
|
64
|
+
```
|
65
|
+
|
66
|
+
### True Type Font Required
|
58
67
|
|
59
|
-
|
68
|
+
In order to draw Emoji, you must use a True Type Font. I recommend you use a Japanese font.
|
69
|
+
|
70
|
+
## Supported Versions
|
60
71
|
|
61
72
|
### Ruby
|
62
73
|
|
@@ -66,15 +77,12 @@ See also https://travis-ci.org/hidakatsuya/prawn-emoji.
|
|
66
77
|
|
67
78
|
2.2+
|
68
79
|
|
69
|
-
### NOTICE
|
70
|
-
|
71
|
-
* prawn-emoji 2.x supports Prawn 2.1
|
72
|
-
* prawn-emoji 1.x supports Prawn 1.3 and 2.0. See [README in 1.0-stable branch](https://github.com/hidakatsuya/prawn-emoji/blob/1.0-stable/README.md)
|
73
|
-
|
74
80
|
## Contributing
|
75
81
|
|
76
82
|
Bug reports and pull requests are welcome on GitHub at https://github.com/hidakatsuya/prawn-emoji.
|
77
83
|
|
84
|
+
## Development
|
85
|
+
|
78
86
|
### How to test
|
79
87
|
|
80
88
|
Run all tests:
|
@@ -95,12 +103,29 @@ Run pdf tests:
|
|
95
103
|
$ bundle exec rake test:pdf
|
96
104
|
```
|
97
105
|
|
98
|
-
|
106
|
+
In order to run `test:pdf`, you need to install [diff-pdf](https://github.com/vslavik/diff-pdf) in your environment, or you can run test in the docker container as below.
|
99
107
|
|
100
|
-
###
|
108
|
+
### Run test using the Docker container
|
109
|
+
|
110
|
+
The `diff-pdf` is already installed on the Docker container, so there is no need to install it in your environment.
|
111
|
+
|
112
|
+
```
|
113
|
+
$ docker build -t prawn-emoji-test .
|
114
|
+
|
115
|
+
# Run test:pdf by default
|
116
|
+
$ docker run --rm prawn-emoji-test
|
117
|
+
|
118
|
+
# Run test:units
|
119
|
+
$ docker run --rm prawn-emoji-test test:units
|
120
|
+
|
121
|
+
# Run all test
|
122
|
+
$ docker run --rm prawn-emoji-test test
|
123
|
+
```
|
124
|
+
|
125
|
+
### How to update bundled emojis
|
101
126
|
|
102
127
|
```
|
103
|
-
$ bundle exec rake emoji:update
|
128
|
+
$ bundle exec rake emoji:update VERSION=<Twemoji version>
|
104
129
|
```
|
105
130
|
|
106
131
|
This task works the following:
|
@@ -108,17 +133,16 @@ This task works the following:
|
|
108
133
|
1. Download emoji images from https://github.com/twitter/twemoji/
|
109
134
|
2. Save the emoji images in the `emoji/images/`
|
110
135
|
3. Write image list in `emoji/images/` to `emoji/index.yml`
|
136
|
+
4. Update version in `emoji/LICENSE`
|
111
137
|
|
112
|
-
##
|
138
|
+
## License
|
139
|
+
|
140
|
+
Β© 2015 Katsuya HIDAKA. See MIT-LICENSE for further details.
|
113
141
|
|
114
|
-
### Twemoji
|
142
|
+
### Twemoji
|
115
143
|
|
116
|
-
[Twemoji](https://github.com/twitter/twemoji) Graphics licensed under [CC-BY4.0](https://creativecommons.org/licenses/by/4.0/)
|
144
|
+
[Twemoji](https://github.com/twitter/twemoji) Graphics licensed under [CC-BY4.0](https://creativecommons.org/licenses/by/4.0/). See `emoji/LICENSE` for futher details.
|
117
145
|
|
118
146
|
### IPA Font
|
119
147
|
|
120
148
|
[IPA Font License Agreement v1.0](http://ipafont.ipa.go.jp/ipa_font_license_v1.html)
|
121
|
-
|
122
|
-
## License
|
123
|
-
|
124
|
-
Β© 2015 Katsuya HIDAKA. See MIT-LICENSE for further details.
|
data/Rakefile
CHANGED
@@ -21,8 +21,13 @@ desc 'Run all unit and pdf tests'
|
|
21
21
|
task test: %i( test:units test:pdf )
|
22
22
|
|
23
23
|
namespace :emoji do
|
24
|
-
desc 'Update emoji'
|
25
|
-
task update: %i(
|
24
|
+
desc 'Update emoji > rake emoji:update VERSION=0.0.0'
|
25
|
+
task update: %i(
|
26
|
+
clean_all
|
27
|
+
twemoji:load
|
28
|
+
update_index
|
29
|
+
twemoji:update_version
|
30
|
+
)
|
26
31
|
|
27
32
|
desc 'Update emoji/index.yml from emoji/images'
|
28
33
|
task :update_index do
|
@@ -49,27 +54,28 @@ namespace :emoji do
|
|
49
54
|
end
|
50
55
|
|
51
56
|
namespace :twemoji do
|
52
|
-
desc 'Load and put github.com/twitter/twemoji/
|
57
|
+
desc 'Load and put github.com/twitter/twemoji/assets/72x72/*.png to the emoji/images/'
|
53
58
|
task :load do
|
54
59
|
require 'prawn/emoji'
|
55
60
|
require 'open-uri'
|
56
61
|
require 'zip'
|
57
62
|
require 'tempfile'
|
58
63
|
|
64
|
+
target_version = ENV['VERSION']
|
59
65
|
image_dir = Prawn::Emoji.root.join('emoji', 'images')
|
60
66
|
|
61
|
-
puts
|
67
|
+
puts "Loading source of v#{target_version} from github.com/twitter/twemoji ..."
|
62
68
|
|
63
|
-
|
69
|
+
source_zip = Tempfile.open do |t|
|
64
70
|
t.binmode
|
65
|
-
t.write open(
|
71
|
+
t.write open("https://github.com/twitter/twemoji/archive/v#{target_version}.zip").read
|
66
72
|
t
|
67
73
|
end
|
68
74
|
|
69
75
|
puts 'Loaded'
|
70
76
|
|
71
|
-
Zip::File.open(
|
72
|
-
emojis =
|
77
|
+
Zip::File.open(source_zip.path) do |source|
|
78
|
+
emojis = source.glob("twemoji-#{target_version}/assets/72x72/*.png")
|
73
79
|
|
74
80
|
puts "Saving #{emojis.size} emoji files..."
|
75
81
|
emojis.each do |image|
|
@@ -79,6 +85,16 @@ namespace :emoji do
|
|
79
85
|
end
|
80
86
|
end
|
81
87
|
|
88
|
+
desc 'Update version in LICENSE file'
|
89
|
+
task :update_version do
|
90
|
+
require 'prawn/emoji'
|
91
|
+
|
92
|
+
license_file = Prawn::Emoji.root.join('emoji', 'LICENSE')
|
93
|
+
license_file.write("Twemoji #{ENV['VERSION']} Graphics licensed under CC-BY4.0.")
|
94
|
+
|
95
|
+
puts 'Updated LICENSE'
|
96
|
+
end
|
97
|
+
|
82
98
|
class EmojiName
|
83
99
|
attr_reader :original_name
|
84
100
|
|
data/emoji/LICENSE
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Twemoji 12.1.3 Graphics licensed under CC-BY4.0.
|
Binary file
|
data/emoji/images/1f3f5.png
CHANGED
Binary file
|
data/emoji/images/1f5f3.png
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/emoji/images/1f93e.png
CHANGED
Binary file
|
data/emoji/images/1f9e9.png
CHANGED
Binary file
|
Binary file
|
data/emoji/index.yml
CHANGED
@@ -665,6 +665,7 @@
|
|
665
665
|
- 1f3f0
|
666
666
|
- 1f3f3
|
667
667
|
- 1f3f3-200d-1f308
|
668
|
+
- 1f3f3-200d-26a7
|
668
669
|
- 1f3f4
|
669
670
|
- 1f3f4-200d-2620
|
670
671
|
- 1f3f4-e0067-e0062-e0065-e006e-e0067-e007f
|
@@ -2958,6 +2959,7 @@
|
|
2958
2959
|
- 269c
|
2959
2960
|
- 26a0
|
2960
2961
|
- 26a1
|
2962
|
+
- 26a7
|
2961
2963
|
- 26aa
|
2962
2964
|
- 26ab
|
2963
2965
|
- 26b0
|
data/lib/prawn/emoji/version.rb
CHANGED
data/prawn-emoji.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.author = 'Katsuya HIDAKA'
|
9
9
|
spec.email = 'hidakatsuya@gmail.com'
|
10
10
|
|
11
|
-
spec.summary = '
|
12
|
-
spec.description = 'Prawn::Emoji is an extention
|
11
|
+
spec.summary = 'Adds Emoji support to Prawn'
|
12
|
+
spec.description = 'Prawn::Emoji is an extention that adds Emoji support to Prawn'
|
13
13
|
spec.homepage = 'https://github.com/hidakatsuya/prawn-emoji'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
@@ -20,11 +20,11 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.require_path = 'lib'
|
21
21
|
|
22
22
|
spec.add_runtime_dependency 'prawn', '~> 2.2.0'
|
23
|
-
spec.add_runtime_dependency 'unicode-emoji', '~> 2.1
|
23
|
+
spec.add_runtime_dependency 'unicode-emoji', '~> 2.3.1'
|
24
24
|
|
25
25
|
spec.add_development_dependency 'bundler', '>= 1.0.0'
|
26
26
|
spec.add_development_dependency 'rake', '>= 0'
|
27
|
-
spec.add_development_dependency 'minitest', '>=
|
27
|
+
spec.add_development_dependency 'minitest', '>= 5.12.2'
|
28
28
|
spec.add_development_dependency 'rr', '>= 0'
|
29
29
|
spec.add_development_dependency 'pdf-inspector', '>= 1.2.0'
|
30
30
|
spec.add_development_dependency 'rubyzip', '>= 1.0.0'
|
@@ -17,12 +17,12 @@ describe Prawn::Emoji::Drawer do
|
|
17
17
|
|
18
18
|
describe 'text is not utf8' do
|
19
19
|
let(:text) { 'a'.encode('ascii-8bit') }
|
20
|
-
it { subject.must_be_same_as text }
|
20
|
+
it { _(subject).must_be_same_as text }
|
21
21
|
end
|
22
22
|
|
23
23
|
describe 'text does not include emoji' do
|
24
24
|
let(:text) { 'abcdefg' }
|
25
|
-
it { subject.must_be_same_as text }
|
25
|
+
it { _(subject).must_be_same_as text }
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -53,7 +53,7 @@ describe Prawn::Emoji::Drawer do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'returns text that all emoji has substituted' do
|
56
|
-
subject.must_equal "aaa#{sub_char}bbb#{sub_char}#{sub_char}ccc"
|
56
|
+
_(subject).must_equal "aaa#{sub_char}bbb#{sub_char}#{sub_char}ccc"
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -67,7 +67,7 @@ describe Prawn::Emoji::Drawer do
|
|
67
67
|
end
|
68
68
|
|
69
69
|
it 'returns the original text' do
|
70
|
-
subject.must_equal text
|
70
|
+
_(subject).must_equal text
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
@@ -75,7 +75,7 @@ describe Prawn::Emoji::Drawer do
|
|
75
75
|
let(:text) { '' }
|
76
76
|
let(:text_options) { {} }
|
77
77
|
|
78
|
-
it { subject.must_be_same_as text }
|
78
|
+
it { _(subject).must_be_same_as text }
|
79
79
|
end
|
80
80
|
|
81
81
|
describe 'preserve the original text' do
|
@@ -90,7 +90,7 @@ describe Prawn::Emoji::Drawer do
|
|
90
90
|
let(:text) {
|
91
91
|
[emojis, ascii_33_79, emojis, ascii_80_126, emojis].join
|
92
92
|
}
|
93
|
-
it { subject.must_equal [sub_char * 2, ascii_33_79, sub_char * 2, ascii_80_126, sub_char * 2].join }
|
93
|
+
it { _(subject).must_equal [sub_char * 2, ascii_33_79, sub_char * 2, ascii_80_126, sub_char * 2].join }
|
94
94
|
end
|
95
95
|
|
96
96
|
describe 'Textual Emoji' do
|
@@ -103,7 +103,7 @@ describe Prawn::Emoji::Drawer do
|
|
103
103
|
].join
|
104
104
|
}
|
105
105
|
it do
|
106
|
-
subject.must_equal [
|
106
|
+
_(subject).must_equal [
|
107
107
|
sub_char * 2, textual_emoji, emoji_with_text_presentation,
|
108
108
|
sub_char * 2, textual_emoji, emoji_with_text_presentation, sub_char * 2
|
109
109
|
].join
|
@@ -114,7 +114,7 @@ describe Prawn::Emoji::Drawer do
|
|
114
114
|
let(:japanese) { 'γγγγγζ₯ζ¬θͺοΏ₯γγ' }
|
115
115
|
let(:text) { [emojis, japanese, emojis, japanese, emojis].join }
|
116
116
|
|
117
|
-
it { subject.must_equal [sub_char * 2, japanese, sub_char * 2, japanese, sub_char * 2].join }
|
117
|
+
it { _(subject).must_equal [sub_char * 2, japanese, sub_char * 2, japanese, sub_char * 2].join }
|
118
118
|
end
|
119
119
|
end
|
120
120
|
end
|
@@ -17,16 +17,16 @@ describe Prawn::Emoji::Image do
|
|
17
17
|
|
18
18
|
describe '#adjust_x' do
|
19
19
|
subject { Prawn::Emoji::Image.new('π£', 12).adjust_x(100) }
|
20
|
-
it { subject.must_equal 100.9 }
|
20
|
+
it { _(subject).must_equal 100.9 }
|
21
21
|
end
|
22
22
|
|
23
23
|
describe '#adjust_y' do
|
24
24
|
subject { Prawn::Emoji::Image.new('β€', 18).adjust_y(100) }
|
25
|
-
it { subject.must_equal 114.4 }
|
25
|
+
it { _(subject).must_equal 114.4 }
|
26
26
|
end
|
27
27
|
|
28
28
|
describe '#width' do
|
29
29
|
subject { Prawn::Emoji::Image.new('β€', 10).width }
|
30
|
-
it { subject.must_equal 8.5 }
|
30
|
+
it { _(subject).must_equal 8.5 }
|
31
31
|
end
|
32
32
|
end
|
@@ -11,12 +11,12 @@ describe Prawn::Emoji::Index do
|
|
11
11
|
|
12
12
|
let(:all_codes) { YAML.load_file(Prawn::Emoji.root.join('emoji', 'index.yml')) }
|
13
13
|
|
14
|
-
it { subject.must_equal all_codes }
|
14
|
+
it { _(subject).must_equal all_codes }
|
15
15
|
end
|
16
16
|
|
17
17
|
describe '#include?' do
|
18
|
-
it { index.include?('0023-20e3').must_equal true }
|
19
|
-
it { index.include?('3299').must_equal true }
|
20
|
-
it { index.include?('unknown').must_equal false }
|
18
|
+
it { _(index.include?('0023-20e3')).must_equal true }
|
19
|
+
it { _(index.include?('3299')).must_equal true }
|
20
|
+
it { _(index.include?('unknown')).must_equal false }
|
21
21
|
end
|
22
22
|
end
|
@@ -17,21 +17,21 @@ describe Prawn::Emoji::Substitution do
|
|
17
17
|
describe 'When Japanese TTF font' do
|
18
18
|
let(:font) { Prawn::Emoji.root.join('test', 'fonts', 'ipag.ttf') }
|
19
19
|
|
20
|
-
it { subject.must_equal 'γ' }
|
21
|
-
it { document.width_of(subject).must_equal font_size }
|
20
|
+
it { _(subject).must_equal 'γ' }
|
21
|
+
it { _(document.width_of(subject)).must_equal font_size }
|
22
22
|
end
|
23
23
|
|
24
24
|
describe 'When ASCII TTF font' do
|
25
25
|
let(:font) { Prawn::Emoji.root.join('test', 'fonts', 'DejaVuSans.ttf') }
|
26
26
|
|
27
|
-
it { subject.must_match
|
28
|
-
it { document.width_of(subject).must_be :>=, font_size - 1 }
|
29
|
-
it { document.width_of(subject).must_be :<=, font_size + 1 }
|
27
|
+
it { _(subject).must_match(/^#{Prawn::Text::NBSP}+$/) }
|
28
|
+
it { _(document.width_of(subject)).must_be :>=, font_size - 1 }
|
29
|
+
it { _(document.width_of(subject)).must_be :<=, font_size + 1 }
|
30
30
|
end
|
31
31
|
|
32
32
|
describe 'When built-in AFM font' do
|
33
33
|
let(:font) { nil }
|
34
34
|
|
35
|
-
it {
|
35
|
+
it { _ { subject }.must_raise Prawn::Errors::IncompatibleStringEncoding }
|
36
36
|
end
|
37
37
|
end
|
@@ -8,55 +8,55 @@ describe Prawn::Emoji::Text do
|
|
8
8
|
describe 'partition by emoji' do
|
9
9
|
let(:text) { 'leftleftπ£remaining'}
|
10
10
|
|
11
|
-
it { subject.left.must_equal 'leftleft' }
|
12
|
-
it { subject.remaining.must_equal 'remaining' }
|
13
|
-
it { subject.emoji.must_be_instance_of Prawn::Emoji::Unicode }
|
14
|
-
it { subject.emoji.to_s.must_equal 'π£' }
|
11
|
+
it { _(subject.left).must_equal 'leftleft' }
|
12
|
+
it { _(subject.remaining).must_equal 'remaining' }
|
13
|
+
it { _(subject.emoji).must_be_instance_of Prawn::Emoji::Unicode }
|
14
|
+
it { _(subject.emoji.to_s).must_equal 'π£' }
|
15
15
|
|
16
16
|
describe 'no emoji' do
|
17
17
|
let(:text) { 'abcd' }
|
18
18
|
|
19
|
-
it { subject.left.must_equal 'abcd' }
|
20
|
-
it { subject.emoji.must_be_nil }
|
21
|
-
it { subject.remaining.must_equal '' }
|
19
|
+
it { _(subject.left).must_equal 'abcd' }
|
20
|
+
it { _(subject.emoji).must_be_nil }
|
21
|
+
it { _(subject.remaining).must_equal '' }
|
22
22
|
end
|
23
23
|
|
24
24
|
describe 'emoji only' do
|
25
25
|
let(:text) { 'π' }
|
26
26
|
|
27
|
-
it { subject.left.must_equal '' }
|
28
|
-
it { subject.emoji.to_s.must_equal 'π' }
|
29
|
-
it { subject.remaining.must_equal '' }
|
27
|
+
it { _(subject.left).must_equal '' }
|
28
|
+
it { _(subject.emoji.to_s).must_equal 'π' }
|
29
|
+
it { _(subject.remaining).must_equal '' }
|
30
30
|
end
|
31
31
|
|
32
32
|
describe 'empty' do
|
33
33
|
let(:text) { '' }
|
34
34
|
|
35
|
-
it { subject.left.must_equal '' }
|
36
|
-
it { subject.emoji.must_be_nil }
|
37
|
-
it { subject.remaining.must_equal '' }
|
35
|
+
it { _(subject.left).must_equal '' }
|
36
|
+
it { _(subject.emoji).must_be_nil }
|
37
|
+
it { _(subject.remaining).must_equal '' }
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
describe '#contains_emoji?' do
|
42
42
|
describe 'includes' do
|
43
43
|
let(:text) { 'π' }
|
44
|
-
it { subject.must_be :contains_emoji? }
|
44
|
+
it { _(subject).must_be :contains_emoji? }
|
45
45
|
end
|
46
46
|
|
47
47
|
describe 'not includes' do
|
48
48
|
let(:text) { 'text only' }
|
49
|
-
it { subject.wont_be :contains_emoji? }
|
49
|
+
it { _(subject).wont_be :contains_emoji? }
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
53
|
describe '#left_with_emoji' do
|
54
54
|
let(:text) { 'aaaaaaπbbbbbb' }
|
55
|
-
it { subject.left_with_emoji.must_equal 'aaaaaaπ' }
|
55
|
+
it { _(subject.left_with_emoji).must_equal 'aaaaaaπ' }
|
56
56
|
end
|
57
57
|
|
58
58
|
describe '#to_s' do
|
59
59
|
let(:text) { 'aaaaaaπbbbbbb' }
|
60
|
-
it { subject.to_s.must_equal text }
|
60
|
+
it { _(subject.to_s).must_equal text }
|
61
61
|
end
|
62
62
|
end
|
@@ -15,36 +15,36 @@ describe Prawn::Emoji::Unicode do
|
|
15
15
|
[%w(1234 5678 9012), '1234-5678-9012'],
|
16
16
|
[%w(A B C), '000a-000b-000c']
|
17
17
|
].each do |(args, expect)|
|
18
|
-
it { Prawn::Emoji::Unicode.format_codepoint(args).must_equal expect }
|
18
|
+
it { _(Prawn::Emoji::Unicode.format_codepoint(args)).must_equal expect }
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
describe '#==' do
|
23
|
-
it { unicode('π').must_be :==, unicode('π') }
|
24
|
-
it { unicode('π').wont_be :==, unicode('π£') }
|
23
|
+
it { _(unicode('π')).must_be :==, unicode('π') }
|
24
|
+
it { _(unicode('π')).wont_be :==, unicode('π£') }
|
25
25
|
end
|
26
26
|
|
27
27
|
describe '#codepoint' do
|
28
|
-
it { unicode('π£').codepoint.must_equal '1f363' }
|
29
|
-
it { unicode('π―π΅').codepoint.must_equal '1f1ef-1f1f5' }
|
28
|
+
it { _(unicode('π£').codepoint).must_equal '1f363' }
|
29
|
+
it { _(unicode('π―π΅').codepoint).must_equal '1f1ef-1f1f5' }
|
30
30
|
end
|
31
31
|
|
32
32
|
describe '#to_s' do
|
33
|
-
it { unicode('π£').to_s.must_equal 'π£' }
|
34
|
-
it { unicode('β€οΈ').to_s.must_equal "\u2764\ufe0f" }
|
33
|
+
it { _(unicode('π£').to_s).must_equal 'π£' }
|
34
|
+
it { _(unicode('β€οΈ').to_s).must_equal "\u2764\ufe0f" }
|
35
35
|
end
|
36
36
|
|
37
37
|
describe 'delete variation selector' do
|
38
38
|
describe 'no selector' do
|
39
|
-
it { unicode("\u2600").codepoint.must_equal '2600' }
|
39
|
+
it { _(unicode("\u2600").codepoint).must_equal '2600' }
|
40
40
|
end
|
41
41
|
|
42
42
|
describe 'with text presentation selector' do
|
43
|
-
it { unicode("\u2600\ufe0e").codepoint.must_equal '2600' }
|
43
|
+
it { _(unicode("\u2600\ufe0e").codepoint).must_equal '2600' }
|
44
44
|
end
|
45
45
|
|
46
46
|
describe 'with emoji presentation selector' do
|
47
|
-
it { unicode("\u2600\ufe0f").codepoint.must_equal '2600' }
|
47
|
+
it { _(unicode("\u2600\ufe0f").codepoint).must_equal '2600' }
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
@@ -50,8 +50,8 @@ describe 'Prawn integration' do
|
|
50
50
|
def assert_properly_render_text(pdf)
|
51
51
|
pdf_strings = extract_strings(pdf.render)
|
52
52
|
|
53
|
-
pdf_strings.must_include "sushi#{nbsp * 3}teacup#{nbsp * 3}"
|
54
|
-
pdf_strings.must_include "ε―ΏεΈγγθΆγ"
|
53
|
+
_(pdf_strings).must_include "sushi#{nbsp * 3}teacup#{nbsp * 3}"
|
54
|
+
_(pdf_strings).must_include "ε―ΏεΈγγθΆγ"
|
55
55
|
end
|
56
56
|
|
57
57
|
def font_path(name)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prawn-emoji
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katsuya HIDAKA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: prawn
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.1
|
33
|
+
version: 2.3.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.1
|
40
|
+
version: 2.3.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 5.12.2
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 5.12.2
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rr
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,8 +122,7 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 1.0.0
|
125
|
-
description: Prawn::Emoji is an extention
|
126
|
-
Emoji.
|
125
|
+
description: Prawn::Emoji is an extention that adds Emoji support to Prawn
|
127
126
|
email: hidakatsuya@gmail.com
|
128
127
|
executables: []
|
129
128
|
extensions: []
|
@@ -132,10 +131,12 @@ files:
|
|
132
131
|
- ".gitignore"
|
133
132
|
- ".travis.yml"
|
134
133
|
- CHANGELOG.md
|
134
|
+
- Dockerfile
|
135
135
|
- Gemfile
|
136
136
|
- MIT-LICENSE
|
137
137
|
- README.md
|
138
138
|
- Rakefile
|
139
|
+
- emoji/LICENSE
|
139
140
|
- emoji/images/0023-20e3.png
|
140
141
|
- emoji/images/002a-20e3.png
|
141
142
|
- emoji/images/0030-20e3.png
|
@@ -801,6 +802,7 @@ files:
|
|
801
802
|
- emoji/images/1f3ef.png
|
802
803
|
- emoji/images/1f3f0.png
|
803
804
|
- emoji/images/1f3f3-200d-1f308.png
|
805
|
+
- emoji/images/1f3f3-200d-26a7.png
|
804
806
|
- emoji/images/1f3f3.png
|
805
807
|
- emoji/images/1f3f4-200d-2620.png
|
806
808
|
- emoji/images/1f3f4-e0067-e0062-e0065-e006e-e0067-e007f.png
|
@@ -3095,6 +3097,7 @@ files:
|
|
3095
3097
|
- emoji/images/269c.png
|
3096
3098
|
- emoji/images/26a0.png
|
3097
3099
|
- emoji/images/26a1.png
|
3100
|
+
- emoji/images/26a7.png
|
3098
3101
|
- emoji/images/26aa.png
|
3099
3102
|
- emoji/images/26ab.png
|
3100
3103
|
- emoji/images/26b0.png
|
@@ -3261,5 +3264,5 @@ requirements: []
|
|
3261
3264
|
rubygems_version: 3.0.3
|
3262
3265
|
signing_key:
|
3263
3266
|
specification_version: 4
|
3264
|
-
summary:
|
3267
|
+
summary: Adds Emoji support to Prawn
|
3265
3268
|
test_files: []
|