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.
- Over 1600 emoji support provided by Emoji One
- RTL support
- Character specing support
- Rotation support
- Alignment support
- Font size support
- Ruby 2.1, 2.2, 2.3
- Prawn 1.3, 2.0.2
See https://travis-ci.org/hidakatsuya/prawn-emoji.
Bug reports and pull requests are welcome on GitHub at https://github.com/hidakatsuya/prawn-emoji.
Emoji provided free by Emoji One.
IPA Font License Agreement v1.0
© 2015 Katsuya HIDAKA. See MIT-LICENSE for further details.