Render emoji with a Chrome-PDF-compatible Twemoji build
The previous attempt (8171669, reverted in 8abef81) installed upstream
Twemoji's own release, which uses the SVGinOT color-font format. Chrome
renders SVGinOT in color on screen, but its print-to-PDF path doesn't
support it and silently falls back to the font's monochrome outline
glyphs -- confirmed via `pdffonts` showing the embedded glyphs as a
plain (non-color) font subset in a real CI-built poster.
Fedora's twitter-twemoji-fonts package instead ships Twemoji as
CBDT/CBLC (bitmap glyphs), the same technology Noto Color Emoji uses,
which Chrome does support for PDF export (verified locally: embeds as
a color Type 3 font, and renders correctly in the printed poster).
Extract just the .ttf from Fedora's RPM via rpm2cpio/cpio rather than
adding a whole extra package repository.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Change-Id: Ic6168efa44af3b0a84ecdb643e483d107aaac547
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d47a714..2599805 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -169,8 +169,14 @@
- start_section install_fonts "Installing Fira, Twemoji and emoji fonts"
- curl -Ls https://github.com/mozilla/Fira/archive/refs/tags/4.202.tar.gz | tar -C /usr/share/fonts -zx --wildcards "*.otf"
- - curl -Ls https://github.com/13rac1/twemoji-color-font/releases/download/v15.1.0/TwitterColorEmoji-SVGinOT-Linux-15.1.0.tar.gz | tar -C /usr/share/fonts -zx --wildcards "*.ttf"
- - apt-get install --no-install-recommends -o dir::cache::archives="$APT_CACHE_DIR" -y fonts-noto-color-emoji fonts-symbola
+ - apt-get install --no-install-recommends -o dir::cache::archives="$APT_CACHE_DIR" -y rpm2cpio cpio fonts-noto-color-emoji fonts-symbola
+ # Fedora's twitter-twemoji-fonts package ships a CBDT/CBLC (bitmap) build
+ # of Twemoji. Use that rather than upstream's own SVGinOT release: Chrome
+ # renders SVGinOT in color on screen, but its print-to-PDF path silently
+ # falls back to the font's monochrome outline glyphs for that format --
+ # CBDT/CBLC (like Noto Color Emoji) embeds correctly as a color PDF font.
+ - curl -sLo /tmp/twemoji.rpm https://dl.fedoraproject.org/pub/fedora/linux/releases/44/Everything/x86_64/os/Packages/t/twitter-twemoji-fonts-14.0.2-10.fc44.noarch.rpm
+ - (cd / && rpm2cpio /tmp/twemoji.rpm | cpio -idm ./usr/share/fonts/twemoji/Twemoji.ttf)
- fc-cache
- end_section install_fonts
diff --git a/inst/rmarkdown/templates/posterdown_ids/resources/template.html b/inst/rmarkdown/templates/posterdown_ids/resources/template.html
index 45cdf20..255d382 100644
--- a/inst/rmarkdown/templates/posterdown_ids/resources/template.html
+++ b/inst/rmarkdown/templates/posterdown_ids/resources/template.html
@@ -60,7 +60,7 @@
padding: 0;
padding-bottom: 2.54cm;
text-align: justify;
-font-family: $if(font_family)$$font_family$$else$Fira Sans$endif$, "Twitter Color Emoji", Twemoji, "Noto Color Emoji", "Segoe UI Emoji";
+font-family: $if(font_family)$$font_family$$else$Fira Sans$endif$, Twemoji, "Noto Color Emoji", "Segoe UI Emoji";
hyphens: auto;
background: white;
}