Prawn::Emoji

Gem Version Build Status Maintainability

Prawn::Emoji is an extention for Prawn, provides feature for drawing Emoji.

Installation

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

Usage

In order to run the following code, you need to place DejaVuSans.ttf in the same directory as the script file.

require 'prawn/emoji'

Prawn::Document.generate 'sushi.pdf' do
  font 'DejaVuSans.ttf'
  text '🐟 / 🔪 + 🍚 / 🍾 = 🍣'
end

IMPORTANT

In order to draw emoji, you must use a TTF - True Type Font. I recommend you use a Japanese font.

Feature

  • Emoji is provided by Twemoji https://github.com/twitter/twemoji
  • Multi-character emoji support
  • RTL support
  • Character spacing support
  • Rotation support
  • Alignment support
  • Font size support

Known Issues

See prawn-emoji/issues

Supported versions

See also https://travis-ci.org/hidakatsuya/prawn-emoji.

Ruby

2.4, 2.5, 2.6

Prawn

2.2+

NOTICE

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/hidakatsuya/prawn-emoji.

How to test

Run all tests:

$ 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.

How to update emoji/index.yml

$ bundle exec rake emoji:update

This task works the following:

  1. Download emoji images from https://github.com/twitter/twemoji/
  2. Save the emoji images in the emoji/images/
  3. Write image list in emoji/images/ to emoji/index.yml

Credit

Twemoji 12.04

Twemoji Graphics licensed under CC-BY4.0

IPA Font

IPA Font License Agreement v1.0

License

© 2015 Katsuya HIDAKA. See MIT-LICENSE for further details.