Prawn::Emoji is an extention for Prawn, provides feature for drawing Emoji.
Add this line to your application's Gemfile:
gem 'prawn-emoji', require: false
And then execute:
$ bundle
Or install it yourself as:
$ gem install prawn-emoji
In order to run the following code, you need to place both DejaVuSans.ttf and ipag.ttf in the same directory as the script file.
require 'prawn'
require 'prawn/emoji'
Prawn::Document.generate 'foo.pdf' do
font 'DejaVuSans.ttf'
text '๐ + ๐ช = ๐ฃ'
font 'ipag.ttf'
text_box '๐ฃใ้ฃในใใ', at: [100, 100], width: 300
draw_text '๐ฃ๐ฃ๐ฃ๐ฃ๐ฃ', at: [100, 200]
end
In order to draw emoji, you must use a TTF - True Type Font. I recommend you use a Japanese font.
- Emoji is provided by EmojiOne http://emojione.com
- Multi-character emoji support
- RTL support
- Character spacing support
- Rotation support
- Alignment support
- Font size support
See also https://travis-ci.org/hidakatsuya/prawn-emoji.
2.4, 2.5, 2.6
2.2+
- prawn-emoji 2.x supports Prawn 2.1
- prawn-emoji 1.x supports Prawn 1.3 and 2.0. See README in 1.0-stable branch
Bug reports and pull requests are welcome on GitHub at https://github.com/hidakatsuya/prawn-emoji.
Run tests completely:
$ bundle exec rake test
Run unit tests:
$ bundle exec rake test:units
Run pdf tests:
$ bundle exec rake test:pdf
NOTICE: In order to run test:pdf
, you need to install diff-pdf in your environment.
If you update emoji image in emoji/images
, you need to update emoji/index.yml
to run the following task:
$ bundle exec rake emoji:generate_index
Emoji provided free by Emoji One (Version 2).
IPA Font License Agreement v1.0
ยฉ 2015 Katsuya HIDAKA. See MIT-LICENSE for further details.