prawn-emoji 1.0.0 โ 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -4
- data/lib/prawn/emoji/drawable.rb +1 -1
- data/lib/prawn/emoji/drawer.rb +3 -0
- data/lib/prawn/emoji/version.rb +1 -1
- data/prawn-emoji.gemspec +1 -1
- data/test/prawn/emoji/drawable_spec.rb +1 -1
- data/test/prawn/emoji/drawer_spec.rb +22 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae9aeb81129d389d4e6d20d78f17108f67929714
|
4
|
+
data.tar.gz: 62ee20930c26282d2f5b88b1a9bb5e0d93264e04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4a13f9f5b3f29493b70191865ea01c7fe66301a3126d75013650d71bee6aff95871bbbcc0bcda136f0f0d6e7a5a1945ab8b9a2915d3e37d43a6f00861c6344b
|
7
|
+
data.tar.gz: 1e15f873809b41c6dc67fdf96ab9508fa20e8fae353bebae5285b5a0919be2f281b4e5aca42b44d2a403e7172a86665ba3a7a60f535b075b736791e0540bb7e2
|
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# Prawn::Emoji
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/prawn-emoji.svg)](https://badge.fury.io/rb/prawn-emoji)
|
3
4
|
[![Build Status](https://travis-ci.org/hidakatsuya/prawn-emoji.svg)](https://travis-ci.org/hidakatsuya/prawn-emoji)
|
4
5
|
|
5
6
|
Prawn::Emoji is an extention for [Prawn](https://github.com/prawnpdf/prawn), provides feature for drawing Emoji.
|
@@ -22,13 +23,15 @@ Or install it yourself as:
|
|
22
23
|
|
23
24
|
## Usage
|
24
25
|
|
26
|
+
In order to run the following code, you need to place both [DejaVuSans.ttf](http://sourceforge.net/projects/dejavu/) and [ipag.ttf](http://ipafont.ipa.go.jp/old/ipafont/download.html) in the same directory as the script file.
|
27
|
+
|
25
28
|
```ruby
|
26
29
|
require 'prawn'
|
27
30
|
require 'prawn/emoji'
|
28
31
|
|
29
|
-
Prawn::
|
32
|
+
Prawn::Document.generate 'foo.pdf' do
|
30
33
|
font 'DejaVuSans.ttf'
|
31
|
-
text '
|
34
|
+
text '๐ + ๐ช = ๐ฃ'
|
32
35
|
|
33
36
|
font 'ipag.ttf'
|
34
37
|
text_box '๐ฃใ้ฃในใใ', at: [100, 100], width: 300
|
@@ -37,9 +40,10 @@ Prawn::Docment.generate 'foo.pdf' do
|
|
37
40
|
end
|
38
41
|
```
|
39
42
|
|
40
|
-
### CAUTION
|
41
43
|
|
42
|
-
|
44
|
+
### IMPORTANT
|
45
|
+
|
46
|
+
In order to draw emoji, you must use a TTF - True Type Font. I recommend you use a Japanese font.
|
43
47
|
|
44
48
|
## Feature
|
45
49
|
|
data/lib/prawn/emoji/drawable.rb
CHANGED
data/lib/prawn/emoji/drawer.rb
CHANGED
data/lib/prawn/emoji/version.rb
CHANGED
data/prawn-emoji.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.homepage = 'https://github.com/hidakatsuya/prawn-emoji'
|
15
15
|
spec.license = 'MIT'
|
16
16
|
spec.platform = Gem::Platform::RUBY
|
17
|
-
spec.required_ruby_version = '>= 2.
|
17
|
+
spec.required_ruby_version = '>= 2.1'
|
18
18
|
|
19
19
|
spec.files = `git ls-files`.split("\n")
|
20
20
|
spec.test_files = `git ls-files -- {test}/*`.split("\n")
|
@@ -10,7 +10,7 @@ describe Prawn::Emoji::Drawable do
|
|
10
10
|
describe '#draw_text!' do
|
11
11
|
it 'calls Emoji::Drawer#draw before processing self' do
|
12
12
|
any_instance_of(Prawn::Emoji::Drawer) do |drawer|
|
13
|
-
|
13
|
+
mock(drawer).draw('text', { option: 'value' }).once
|
14
14
|
end
|
15
15
|
document_test.draw_text!('text', option: 'value')
|
16
16
|
end
|
@@ -11,6 +11,28 @@ describe Prawn::Emoji::Drawer do
|
|
11
11
|
document.font Prawn::Emoji.root.join 'test', 'fonts', 'DejaVuSans.ttf'
|
12
12
|
end
|
13
13
|
|
14
|
+
describe '#draw' do
|
15
|
+
subject { drawer.draw(text, {}) }
|
16
|
+
|
17
|
+
describe 'when text encoding is not utf-8' do
|
18
|
+
let(:text) { "\xe8\x8a\xb1".force_encoding('ascii-8bit') }
|
19
|
+
|
20
|
+
it 'skip' do
|
21
|
+
mock(drawer).draw_emoji(text, {}).never
|
22
|
+
subject
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe 'when text encoding is utf-8' do
|
27
|
+
let(:text) { "\xe8\x8a\xb1" }
|
28
|
+
|
29
|
+
it 'performs' do
|
30
|
+
mock(drawer).draw_emoji(text, {}).once
|
31
|
+
subject
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
14
36
|
describe '#draw_emoji' do
|
15
37
|
subject { drawer.send :draw_emoji, text, text_options }
|
16
38
|
let(:text_options) { { at: [100, 100], font_size: 12 } }
|
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: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katsuya HIDAKA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: prawn
|
@@ -1156,7 +1156,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
1156
1156
|
requirements:
|
1157
1157
|
- - ">="
|
1158
1158
|
- !ruby/object:Gem::Version
|
1159
|
-
version: '2.
|
1159
|
+
version: '2.1'
|
1160
1160
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1161
1161
|
requirements:
|
1162
1162
|
- - ">="
|
@@ -1164,8 +1164,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1164
1164
|
version: '0'
|
1165
1165
|
requirements: []
|
1166
1166
|
rubyforge_project:
|
1167
|
-
rubygems_version: 2.
|
1167
|
+
rubygems_version: 2.5.1
|
1168
1168
|
signing_key:
|
1169
1169
|
specification_version: 4
|
1170
1170
|
summary: Provides support for Emoji in Prawn
|
1171
1171
|
test_files: []
|
1172
|
+
has_rdoc:
|