Bug 496661 - Exporting markdown to PDF loses emojis
Summary: Exporting markdown to PDF loses emojis
Status: REPORTED
Alias: None
Product: okular
Classification: Applications
Component: PDF backend (show other bugs)
Version: 24.08.3
Platform: Arch Linux Linux
: NOR minor
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-25 09:09 UTC by Iizuki
Modified: 2024-12-09 17:31 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
An exmaple markdown file with an emoji (54 bytes, text/markdown)
2024-12-01 10:07 UTC, Iizuki
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Iizuki 2024-11-25 09:09:32 UTC
SUMMARY

Emojis are displayed correctly when viewing a markdown file with Okular, but if you export the file to PDF, emojis will be lost.

STEPS TO REPRODUCE
1. Open a markdown file with some emojis in it.
2. Export it to PDF: File > Export As > PDF

OBSERVED RESULT

PDF has no emojis at all. Not even the "missing boxes".


EXPECTED RESULT

PDF should have emojis, just as the rendered markdown file.


SOFTWARE/OS VERSIONS
KDE Plasma Version: 6.2.3
KDE Frameworks Version: 
Qt Version: 6.8.0

ADDITIONAL INFORMATION
Comment 1 Albert Astals Cid 2024-11-28 15:16:47 UTC
Please attach such a markdown file.
Comment 2 Iizuki 2024-12-01 10:07:42 UTC
Created attachment 176258 [details]
An exmaple markdown file with an emoji
Comment 3 Albert Astals Cid 2024-12-01 22:20:29 UTC
Works for me.

Which doesn't make much sense since i'm also using archlinux packages for this test.
Comment 4 Iizuki 2024-12-09 17:31:43 UTC
That is weird yeah, but it gave me a debugging idea.

I have the following configuration in `/home/iizuki/.config/fontconfig/fonts.conf`:

```xml
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
 <alias>
   <family>sans-serif</family>
   <prefer>
     <family>Noto Sans</family>
     <family>Noto Color Emoji</family>
     <family>Noto Emoji</family>
   </prefer> 
 </alias>

 <alias>
   <family>serif</family>
   <prefer>
     <family>Noto Serif</family>
     <family>Noto Color Emoji</family>
     <family>Noto Emoji</family>
   </prefer>
 </alias>

 <alias>
  <family>monospace</family>
  <prefer>
    <family>Noto Mono</family>
    <family>Noto Color Emoji</family>
    <family>Noto Emoji</family>
   </prefer>
 </alias>
</fontconfig>
```

The point is just to use color emojis where-ever possible.

Disabling that conf makes the export work, only with a black and white teapot emoji before and after. The files exported with the conf enabled still don't show anything. There's just no (selectable) character in the PDF.