prawn-emoji 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +9 -2
- data/CHANGELOG.md +7 -1
- data/Gemfile +5 -0
- data/README.md +1 -1
- data/lib/prawn/emoji.rb +4 -2
- data/lib/prawn/emoji/drawer.rb +12 -15
- data/lib/prawn/emoji/image.rb +22 -0
- data/lib/prawn/emoji/version.rb +1 -1
- data/prawn-emoji.gemspec +1 -7
- metadata +4 -74
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e24fc7c2a1d3c44a3ecf18bfa8b5124e574c1f60b9f9b7223acb82f2e37268f6
|
4
|
+
data.tar.gz: '0338e7946dca1bd17ab896df82b73d7d129ee7282543f71fe0c730911ebecddd'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 716f0cbc65b97d8889c50ba2a46c15bed474ca5c110640b925b427cf9e05193acc5e0b57687ae5ce87018417e4984a4d43c3c669dbb4e7045e06f335beff3799
|
7
|
+
data.tar.gz: 3b9a3ba4e9640ceab0b0b1251731933946d02eb2ab6f9270f5cf1c8000b1a0281237d1ea07196687cea2b7efd662d5bc8bae2d42f3bdbd96de3d93b0af5c8af4
|
data/.github/workflows/test.yml
CHANGED
@@ -4,7 +4,7 @@ on: [push, pull_request]
|
|
4
4
|
|
5
5
|
jobs:
|
6
6
|
test:
|
7
|
-
name: Test on ruby ${{ matrix.ruby_version }}
|
7
|
+
name: Test on ruby ${{ matrix.ruby_version }} and prawn ${{ matrix.prawn_version }}
|
8
8
|
runs-on: ubuntu-latest
|
9
9
|
strategy:
|
10
10
|
matrix:
|
@@ -12,8 +12,13 @@ jobs:
|
|
12
12
|
- 2.5.x
|
13
13
|
- 2.6.x
|
14
14
|
- 2.7.x
|
15
|
+
prawn_version:
|
16
|
+
- 2.2
|
17
|
+
- 2.3
|
18
|
+
|
15
19
|
steps:
|
16
20
|
- uses: actions/checkout@v1
|
21
|
+
|
17
22
|
- name: Set up diff-pdf
|
18
23
|
run: |
|
19
24
|
sudo apt-get update
|
@@ -21,12 +26,14 @@ jobs:
|
|
21
26
|
git clone https://github.com/vslavik/diff-pdf.git -b v0.4.1 --depth 1 /tmp/diff-pdf-src
|
22
27
|
cd /tmp/diff-pdf-src
|
23
28
|
./bootstrap && ./configure && make && sudo make install
|
29
|
+
|
24
30
|
- name: Set up Ruby ${{ matrix.ruby_version }}
|
25
31
|
uses: actions/setup-ruby@v1
|
26
32
|
with:
|
27
33
|
ruby-version: ${{ matrix.ruby_version }}
|
34
|
+
|
28
35
|
- name: Build and test with Rake
|
29
36
|
run: |
|
30
37
|
gem install bundler
|
31
|
-
bundle install --jobs 4 --retry 3
|
38
|
+
bundle install --gemfile test/gemfiles/prawn-${{ matrix.prawn_version }} --jobs 4 --retry 3
|
32
39
|
bundle exec rake test
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
## Master (Unreleased)
|
2
2
|
|
3
|
+
## 4.1.0
|
4
|
+
|
5
|
+
### Minor Enhancements
|
6
|
+
|
7
|
+
* Add prawn 2.3.0 support #35
|
8
|
+
|
3
9
|
## 4.0.0
|
4
10
|
|
5
11
|
### Enhancements
|
@@ -9,7 +15,7 @@
|
|
9
15
|
### Breaking Changes
|
10
16
|
|
11
17
|
* Drop ruby 2.4 support
|
12
|
-
* The drawing results of emoji will be
|
18
|
+
* The drawing results of emoji will be changed slightly due to the new emoji drawing process
|
13
19
|
|
14
20
|
### Bug Fixes
|
15
21
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
data/lib/prawn/emoji.rb
CHANGED
@@ -11,10 +11,12 @@ module Prawn
|
|
11
11
|
#
|
12
12
|
# The following values are available (Default is `Unicode::Emoji::REGEX_VALID`):
|
13
13
|
# https://github.com/janlelis/unicode-emoji#regex.
|
14
|
-
:regex
|
14
|
+
:regex,
|
15
|
+
|
16
|
+
keyword_init: true
|
15
17
|
)
|
16
18
|
def self.config
|
17
|
-
@config ||= Config.new(::Unicode::Emoji::REGEX_VALID)
|
19
|
+
@config ||= Config.new(regex: ::Unicode::Emoji::REGEX_VALID)
|
18
20
|
end
|
19
21
|
|
20
22
|
def self.regex
|
data/lib/prawn/emoji/drawer.rb
CHANGED
@@ -44,26 +44,23 @@ module Prawn
|
|
44
44
|
|
45
45
|
def draw_text(text, at:, text_options:)
|
46
46
|
draw_text!(text, at: at, text_options: text_options)
|
47
|
-
|
47
|
+
|
48
|
+
width = document.width_of(text, text_options)
|
49
|
+
|
50
|
+
if Prawn::VERSION >= '2.3.0'
|
51
|
+
# In prawn v2.3.0, the character spacing at the end of the text is not included in the calculated text width.
|
52
|
+
# https://github.com/prawnpdf/prawn/pull/1117
|
53
|
+
width > 0 ? width + document.character_spacing : width
|
54
|
+
else
|
55
|
+
width
|
56
|
+
end
|
48
57
|
end
|
49
58
|
|
50
59
|
def draw_emoji(emoji_char, at:)
|
51
60
|
emoji_image = Emoji::Image.new(emoji_char)
|
61
|
+
emoji_image.render(document, at: at)
|
52
62
|
|
53
|
-
|
54
|
-
|
55
|
-
# Prawn 2.2 does not close the image file when Pathname is passed to Document#image method.
|
56
|
-
#
|
57
|
-
# FIXME: This issue has been fixed by https://github.com/prawnpdf/prawn/pull/1090 but not released.
|
58
|
-
# Fix as follows after the PR released.
|
59
|
-
#
|
60
|
-
# @document.image(image_file.path, at: [x, y], width: image.width)
|
61
|
-
#
|
62
|
-
File.open(emoji_image.path, 'rb') do |image_file|
|
63
|
-
@document.image(image_file, at: [x, y + emoji_char.height], width: emoji_char.width)
|
64
|
-
end
|
65
|
-
|
66
|
-
emoji_char.width + document.character_spacing
|
63
|
+
emoji_image.width + document.character_spacing
|
67
64
|
end
|
68
65
|
end
|
69
66
|
end
|
data/lib/prawn/emoji/image.rb
CHANGED
@@ -1,14 +1,36 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'forwardable'
|
4
|
+
|
3
5
|
module Prawn
|
4
6
|
module Emoji
|
5
7
|
class Image
|
8
|
+
extend Forwardable
|
9
|
+
|
6
10
|
STORE = Emoji.root.join 'emoji', 'images'
|
7
11
|
|
12
|
+
def_delegators :emoji_char, :width, :height
|
13
|
+
|
8
14
|
def initialize(emoji_char)
|
9
15
|
@emoji_char = emoji_char
|
10
16
|
end
|
11
17
|
|
18
|
+
def render(document, at:)
|
19
|
+
x, y = at
|
20
|
+
|
21
|
+
position = [x, y + height]
|
22
|
+
|
23
|
+
if Prawn::VERSION >= '2.3.0'
|
24
|
+
document.image(path, at: position, width: width)
|
25
|
+
else
|
26
|
+
# Prawn 2.2 does not close the image file when Pathname is passed to Document#image method.
|
27
|
+
# https://github.com/prawnpdf/prawn/pull/1090
|
28
|
+
File.open(path, 'rb') do |image_file|
|
29
|
+
document.image(image_file, at: position, width: width)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
12
34
|
def path
|
13
35
|
STORE.join("#{emoji_char.codepoint}.png").to_s
|
14
36
|
end
|
data/lib/prawn/emoji/version.rb
CHANGED
data/prawn-emoji.gemspec
CHANGED
@@ -18,12 +18,6 @@ Gem::Specification.new do |spec|
|
|
18
18
|
end
|
19
19
|
spec.require_path = 'lib'
|
20
20
|
|
21
|
-
spec.add_runtime_dependency 'prawn', '~> 2.2
|
21
|
+
spec.add_runtime_dependency 'prawn', '~> 2.2'
|
22
22
|
spec.add_runtime_dependency 'unicode-emoji', '~> 2.5.0'
|
23
|
-
|
24
|
-
spec.add_development_dependency 'bundler', '>= 1.0.0'
|
25
|
-
spec.add_development_dependency 'rake', '>= 0'
|
26
|
-
spec.add_development_dependency 'minitest', '>= 5.12.2'
|
27
|
-
spec.add_development_dependency 'rr', '>= 0'
|
28
|
-
spec.add_development_dependency 'rubyzip', '>= 1.0.0'
|
29
23
|
end
|
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: 4.
|
4
|
+
version: 4.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: 2020-
|
11
|
+
date: 2020-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: prawn
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.2
|
19
|
+
version: '2.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.2
|
26
|
+
version: '2.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: unicode-emoji
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,76 +38,6 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 2.5.0
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: bundler
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 1.0.0
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 1.0.0
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rake
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: minitest
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 5.12.2
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 5.12.2
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rr
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rubyzip
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: 1.0.0
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: 1.0.0
|
111
41
|
description: Prawn::Emoji is an extention that adds Emoji support to Prawn
|
112
42
|
email: hidakatsuya@gmail.com
|
113
43
|
executables: []
|