andymeneely/squib

Can't get emojis working on macOS

vtbassmatt opened this issue · 1 comments

Describe the bug
I can't figure out the magic incantation to get emojis working on macOS.

To Reproduce

require 'squib'

# 'Apple Color Emoji' shows up in this list
#puts Squib.system_fonts

Squib::Deck.new(cards: 1) do
  background color: 'white'
  # tried this guy first
  #set font: 'Serif,Apple Color Emoji 10.5'
  text str: 'AB🤣😈CD', x: 0, y: 0, font: 'Serif,Apple Color Emoji, 10.5'
  save_png prefix: 'fonttest_'
end

Expected behavior
I should get a card with the string AB🤣😈CD on it. Instead, I get AB CD.

Screenshots
AB space space CD

Environment

  • OS: macOS 11.6.1
  • Ruby: ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-darwin20]
  • Squib: 0.18.0

Additional context
I'm certain there's a Pango font string I'm missing. https://github.com/GNOME/pango/blob/main/NEWS has several instances discussing emoji/color emoji improvements to Pango itself, and https://github.com/GNOME/pango/blob/9d389e936707ebcf84fbc64d07b8aa17cdf2ef04/pango/pangocoretext-fontmap.c#L1354 suggests that Pango should be automatically trying to fallback to Apple Color Emoji anyhow. But I'm stumped, nothing I've tried has worked.

Check the following:

  • I have updated Squib to the latest version.
  • I have checked the Squib issues backlog for something similar
  • I have attempted to make a minimal script demonstrating my problem
  • I have reviewed the Squib Docs and there's still a problem

Maybe the binding is to an older Cairo? 1.15.8 is supposed to support them.

Edit: nope, the changelog says Squib uses a new enough version of Cairo.