Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CBDT/CBLC color font support (e.g. Noto Color Emoji) #1261

Open
McSinyx opened this issue Oct 8, 2021 · 10 comments
Open

CBDT/CBLC color font support (e.g. Noto Color Emoji) #1261

McSinyx opened this issue Oct 8, 2021 · 10 comments
Labels
enhancement Software improvement or feature request

Comments

@McSinyx
Copy link

McSinyx commented Oct 8, 2021

I am having trouble with Noto Color Emoji, for example,

\begin{document}
\font[family = Noto Color Emoji]😄
\end{document}

would give me

$ sile emoji.sil 
SILE v0.12.0 (Lua 5.2)
<emoji.sil>
[1] 
libtexpdf:fatal: sfnt: table not found...

I am on NixOS unstable at the moment. Other emoji fonts seem to work, including Noto Emoji (which is still the old blob one for some reason).

@alerque
Copy link
Member

alerque commented Oct 8, 2021

Confirmed I see the same thing using this font file.

@alerque
Copy link
Member

alerque commented Oct 8, 2021

This smells to me like the problem is actually the font missing something it should have, but @simoncozens or @ctrlcctrlv can probably make a more educated guess at what is happening here. It's also possible we fumbles something, perhaps related to #1142/#1144.

@simoncozens
Copy link
Member

simoncozens commented Oct 8, 2021

Yes, that font doesn't have a glyf or CFF table, only color tables. It's arguable that that isn't a spec-compliant font. See googlefonts/noto-emoji#43

Note that in there, this is a build with a glyf table, but this won't help you, because it's empty. And while we have a color-fonts package, that only implements fonts with COLR/CPAL tables, as opposed to the two other color font formats (SVG/CPAL, CBLC/CBDT). Noto Color Emoji is a CBLC/CBDT format font, so we can't do anything sensible with it.

Color fonts are a horrible mess. COLR/CPAL has won the de facto standardisation war, so we can put it down to this particular font being a problem.

@alerque alerque added Not My Bug 3rd party issue outside of SILE's scope and removed bug Software bug issue labels Oct 8, 2021
@alerque
Copy link
Member

alerque commented Oct 8, 2021

Thanks, that's roughly what I was guessing but couldn't articulate.

I'd be happy to accept contributions for dealing with non-standard fonts, but since (as I understand it) we don't have any real intention of "fixing" this and the real issue is the font, I'm going to go ahead and close this issue.

@McSinyx I hope than answers your question and sorry we don't support CBLC/CBDT. Do feel free to jump in with feedback if you think we're missing something on this issue or you have any others!

@alerque alerque closed this as completed Oct 8, 2021
@khaledhosny
Copy link
Contributor

In luaotfload (for LuaTeX) I handle fonts like this by embedding the PNG returned by HarfBuzz directly in the PDF. Another option is to create a Type 3 font from the bitmaps (though I haven't tried this one myself).

@khaledhosny
Copy link
Contributor

khaledhosny commented Dec 30, 2021

Note this is not a nonstandard font, the CBDT/CBLC is part of the OpenType spec. Another bitmap table with the same issue is sbix used by Apple emoji font.

@alerque
Copy link
Member

alerque commented Dec 30, 2021

I suppose if anybody out there chimes in again (@McSinyx?) to say this is something they would actually find useful we can re-open this issue to track adding CBDT/CBLC support. Personally I don't have the time or interest to code up support, but if somebody does come along that wants it enough to make it happen I'd be happy to review and facilitate a contribution.

@McSinyx
Copy link
Author

McSinyx commented Dec 30, 2021

I would find it useful, but it's not a high priority to me since I've switched back to the old (blob) Noto Emoji. IMHO it'd be nice if this issue is reopened so maybe someone will be able to fix it in the future. To quote Drew DeVault:

Let me offer you a different way of thinking about issues: a place for motivated users to collaborate on narrowing down the problem and planning a potential fix. A space for the community to work, rather than an action item for you to deal with personally. It gives people a place to record additional information, and, ultimately, put together a pull request for you to review. It does not matter if this process takes days or weeks or years to complete. Over time, the issue will accumulate details and workarounds to help users identify and diagnose the problem, and to provide information for the person that might eventually write a patch/pull request.

@ctrlcctrlv
Copy link
Member

I agree with @khaledhosny, @alerque. This should be reopened and renamed to "CBDT/CBLC support". I also don't have the time or interest, but that's the right way to track it.

@alerque alerque reopened this Dec 30, 2021
@alerque alerque changed the title libtexpdf error with Noto Color Emoji CBDT/CBLC color font support (e.g. Noto Color Emoji) Dec 30, 2021
@alerque alerque added enhancement Software improvement or feature request and removed Not My Bug 3rd party issue outside of SILE's scope labels Dec 30, 2021
@ctrlcctrlv
Copy link
Member

I just discovered that CBDT–CBLC and sbix can be made to share the same bitmap data in principle. I haven't made a Proof of Concept font yet but if this is the case, it means that if SILE supports one or the other it should be not so difficult to make cross-platform CBDT/sbix fonts out of any font that is only CBDT or only sbix. See https://twitter.com/fr_brennan/status/1478240370412638211 for the proposed method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Software improvement or feature request
Projects
None yet
Development

No branches or pull requests

5 participants