lib/prawn/emoji/text.rb in prawn-emoji-3.3.0 vs lib/prawn/emoji/text.rb in prawn-emoji-4.0.0.beta.1

- old
+ new

@@ -1,17 +1,18 @@ # frozen_string_literal: true -require_relative 'unicode' +require_relative 'char' module Prawn module Emoji class Text attr_reader :left, :emoji, :remaining - def initialize(text) + def initialize(text, font_size) + @text = text @left, emoji_char, @remaining = partition_by_emoji(text) - @emoji = Emoji::Unicode.new(emoji_char) unless emoji_char.empty? + @emoji = Emoji::Char.new(emoji_char, font_size) unless emoji_char.empty? end def contains_emoji? !emoji.nil? end @@ -19,10 +20,10 @@ def left_with_emoji left + emoji.to_s end def to_s - left_with_emoji + remaining + @text end private def partition_by_emoji(text)