andymeneely / squib

A Ruby DSL for prototyping card games.
http://squib.rocks
MIT License
917 stars 67 forks source link

Can't get emojis working on macOS #352

Open vtbassmatt opened 2 years ago

vtbassmatt commented 2 years ago

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

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:

vtbassmatt commented 2 years ago

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.