typst: Fontname of a Type 3 font looks wrong
Description
For all other fonts, we get the expected font names of the embedded font, but for a Type 3 font, the prefix hash is included.
I tested this with SumatraPDF and Adobe Reader and both show the same name.
Maybe the reason is that this Font object is the only one having the Name key set: /Name /YXDKRS+SegoeUIEmoji.
Here comes the emoji đ, which is from a different font and embedded as Type 3 font.
With older versions, emojis where embedded as a normal non-colored font and thus there was no need for Type 3 fonts.
Related: https://github.com/typst/typst/pull/5070
Reproduction URL
No response
Operating system
Windows
Typst version
- I am using the latest version of Typst
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 18 (4 by maintainers)
I donât think anyone knows what is âcorrectâ here either. We have PDF readers (both from Adobe and from others) that donât strip the subset tag from
/Font/Namebut strip it from/FontDescriptor/FontName, and then we have the validation tool in #5067 that expects/Font/Nameand/FontDescriptor/FontNameto be identical (including the subset tag, I just checked it with LibreOffice-generated PDF and it complained about the mismatch).Either the PDF readers are wrong or the validation are wrong, though if you ask anyone who worked with PDF they will tell you whatever Adobe tools does is the actual standard, not whatever is written in the spec (and the spec is not saying much here, even).
IIRC, I did this intentionally because I found out (like you did here) that the subset ID is not expected here, or at least apps I tested didnât string it from /Font/Name, Unlike FontDescriptor/FontName.
I wrote the initial code in luaotfload that handles colors fonts when using HarfBuzz and it doesnât use Type 3 fonts. I think they were probably planning to switch it to use Type 3 fonts, but does not look like this ever happened, the PDF generated by LuaTeX today still uses images directly and it has no Type 3 fonts.
I think this is the relevant difference:
Typst prefixes the Type 3 font name with the subset id, but LibreOffice does not.
LuaTeX converts bitmap color glyphs into graphics and inserts them this way instead of font glyphs.
LibreOffice uses Type 3 fonts, which I think the same as Typst.
I donât remember the exact details, but when I wrote the LibreOffice code I had issues with Type 3 font names and I had to jump through some hoops to make it work (some libraries, like Poppler, wouldnât even show Type 3 font names at all). May be you can diff the two PDFs to see what is the difference.
You can try LibreOffice, it uses Type 3 for color fonts.