Coder Social home page Coder Social logo

prawn-emoji's Introduction

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

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 EmojiOne http://emojione.com
  • 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 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.

How to update emoji/index.yml

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

Credit

Emoji One

Emoji provided free by Emoji One (Version 2).

IPA Font

IPA Font License Agreement v1.0

License

ยฉ 2015 Katsuya HIDAKA. See MIT-LICENSE for further details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.