Class: Prawn::Emoji::Drawer
- Inherits:
-
Object
- Object
- Prawn::Emoji::Drawer
- Defined in:
- lib/prawn/emoji/drawer.rb
Class Method Summary collapse
Instance Method Summary collapse
- #draw(text, text_options) ⇒ Object
-
#initialize(document) ⇒ Drawer
constructor
A new instance of Drawer.
Constructor Details
Class Method Details
Instance Method Details
#draw(text, text_options) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/prawn/emoji/drawer.rb', line 19 def draw(text, ) cursor_x, cursor_y = [:at] emoji_text = Emoji::Text.new(text, document.font_size) while emoji_text.contains_emoji? do if emoji_index.include?(emoji_text.emoji_char.codepoint) cursor_x += draw_text(emoji_text.left, at: [cursor_x, cursor_y], text_options: ) cursor_x += draw_emoji(emoji_text.emoji_char, at: [cursor_x, cursor_y]) else cursor_x += draw_text(emoji_text.left_with_emoji, at: [cursor_x, cursor_y], text_options: ) end emoji_text = Emoji::Text.new(emoji_text.remaining, document.font_size) end draw_text!(emoji_text.to_s, at: [cursor_x, cursor_y], text_options: ) end |