-
Notifications
You must be signed in to change notification settings - Fork 9
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
Confirm that CBDT/CBLC glyph actually works #8
Comments
CBDT/CBLC still will only be rendered when the font is installed on the OS, not when loaded through |
I haven't tried ChromaCheck, but I have a related issue. When I tested https://pixelambacht.nl/demo/color-font-test.html, I was very surprised to find that none of Chrome-Linux, Chrome/Chromium OS and Chrome-Android works for CBDT/CBLC font (served as a web font). Why? Because I know that a color font with CBDT/CBLC works in those browser-platform combinations [1]. If it does not work any more, it's a regression. Alarmed, I filed a bug against Chromium at http://crbug.com/605334. Then, I checked your CBDT/CBLC font in Chrome's DOM inspector. It has a color glyph (green circle with light green check mark inside) for "X" (capital). OTOH, your test page has 'x' (lowercase). When I changed 'x' to 'X', I got a color glyph. See the screenshot below (taken on Chrome OS). BTW, I made a 2-line patch to make sbix font (as a web font) work for Blink (that will make sbix work in Chrome on Mac, Linux, Android, Chrome/chromium OS). For that patch to be committed, I need a Thank you for your test page and sorry for going tangential in the bug. [1] On Linux-Chrome, you need recent versions of FreeType ( 2.5.x or later) and fontconfig. /cc @behdad |
Thanks Jungshik! Yes, would be great if you can release all your four test fonts, and the test page, as Open Source, on github. |
Thanks for reporting (and going tangential on) this! Yikes, it looks like you're right. Somehow the CBDT/CBLC is mapped to the capital X. So this has been giving false negatives for a while then :( I have been planning to deprecate that page and replace it by ChromaCheck. The test font used in ChromaCheck is a lot cleaner and combines all the formats in one font. The TTX file can be found in this repo. Would this font, or ChromaCheck, would suffice for the layout test? Could you see how ChromaCheck reports CBDT/CBLC support? https://pixelambacht.nl/chromacheck/ |
It looks like ChromaCheck fails on CBDT/CBLC. I'll look into that this weekend! In the mean time, I've updated https://pixelambacht.nl/demo/color-font-test.html to use the capital x, so at least the green checkmark will be shown on Android/Chrome. |
FreeType chooses between using either sbix or CBDT/CBLC if both are available in the same font. I don't think combining all is a good idea for a test font. |
@behdad Does it do that per character, or for the entire font? Each test glyph in ChromaCheck's font is mapped to a different Unicode PUA value. So if a browser checks per character, this should work. Firefox seems to do this — it shows both the SVG ( How does FreeType choose between CBDT/CBLC and sbix? |
It appears I have to create separate fonts anyway: the spec defines there shouldn't be a glyf table present, and the ChromaCheck font has one. Leave it out and the CBDT/CBLC color glyph renders properly, but the rest won't. |
Closing this and moving the solution to #21 |
@behdad @jungshik ChromaCheck now works for CBDT/CBLC, as well as the three others. The public test page has been updated: https://pixelambacht.nl/chromacheck/ |
@RoelN Thanks. Curiously, Chrome 51.0.2704.7 dev on Linux works well with both your new test (chromacheck/) and the original one (with 4 check in a circle) for CBDT/CBLC. My trunk build of Chrome on Linux (that also passes through sbix table) show sthat both CBDT/CBLC and sbix fonts are supported at https://pixelambacht.nl/demo/color-font-test.html. However, your new test at https://pixelambacht.nl/chromacheck/ does not work for either of them. |
@jungshik Thanks for testing and sharing your results. Much appreciated! Perhaps sbix fails in ChromaCheck in the trunk build because sbix is still mixed in with SVG and COLR/CPAL. Since I had to split off CBDT/CBLC to a separate font, I best do that for the other formats as well, like @behdad suggested. Hopefully that'll fix the sbix issue. Why CDBT/CBLC fails in the trunk build, I don't know. It shoud work, as the only difference with Chrome 51.0.2704.7 dev is that support for sbix has been added, right? The only major difference seems to be WOFF in ChromaCheck, TTF in the old test — could that be the cause? Internally there are some minor differences in the fonts (e.g. having a achVendID of "GOOG" as opposed to " ") but none that look like a red flag to me. If you want to look at the old fonts, please see https://github.com/RoelN/color-font-test that I've temporarily set up, until ChromaCheck works 100%. |
@jungshik I now believe this might be caused by the OpenType Sanitizer. It rejects fonts without a A commit to OTS that allowed empty tables was recently reverted: khaledhosny/ots@56b9be8 And there is still an issue open about it: khaledhosny/ots#52 This might explain why CDBT/CBLC fails, but not sbix as the font currently still has a valid EDIT: Seems you guys are already very much on top of this issue, sorry I missed that: khaledhosny/ots#108 |
@roein, thank you for the pointer to khaledhosny/ots#52 (I've seen it before, but forgot). Anyway, that's different from what I have a trouble with my hacked sbix fonts (with and without glyf table ) in Chrome-Mac. Chrome-Linux (and Android by extension) is happy with either way (as long as I use a modified version of OTS to pass through a sbix font without glyf. A sbix font with glyf table just works without an OTS change), but Chrome-Mac is not happy. (Safari is half-way between). OTOH, your sbix font works fine. So, there's something wrong with my sbix font.
Thank you for the comment above. I'll see if the above helps. |
@jungshik I'd be happy to a look at your sbix fonts to try and help figure out what's going wrong, if they're public! (roel-at-pixelambacht-dot-nl) |
@RoelN Thanks ! My '2-char-only FruityGirl' with sbix (instead of CBDT/CBLC) was uploaded to khaledhosny/ots#108. "-b flag on ttx" (in #23 (comment)) might help, but haven't tried it yet. |
@jungshik The only thing that's a bit off is the metrics, see screenshot. The glyph is shown outside its bounding box. The metrics on the original |
Thank you for taking a look ! @RoelN
Perhaps. That value is based on the actual ink in the contour I put in for U+002A in glyf table. Let me try to tweak with it. |
Update and note-to-self: currently using a CBDT font with ChromaCheck still fails (tested in Chrome on Android 8). The old color font test does work there, but is rejected in Chrome on OSX because the |
We need to fix FreeType to ignore glyf table for CBDT fonts. We already do that for sbix. @lemzwerg |
That'd be fantastic. With the |
@behdad I updated the first post to reflect the current situation, I hope my understanding is correct! |
Hi, Just wanted to mention that, while Firefox is not super all-in committed to CBDT/CBLC on all platforms just yet, they're dipping their toes into supporting CBDT/CBLC. ChromaCheck doesn't detect Firefox's support though. Firefox Nightly (and Beta?) for Linux (and Android?) is able to display fonts with
This does work for, say, loading Noto Color Emoji in However, even with this pref set, ChromaCheck doesn't say my browser supports In summary: Firefox has pre-release, opt-in support for CBDT/CBLC on Android and Linux, ChromaCheck doesn't detect this support. P.S. https://pixelambacht.nl/demo/color-font-test.html does detect CBLC/CBDT support in Firefox. |
I think Firefox uses OTS, so it's essentially an upstream issue at OTS, which was already mentioned in this Issue. Sorry for the "duplicate report." |
No worries, thanks for reporting! I'll keep an eye on Firefox regarding CBDT support. |
I am working on this for web fonts at the moment, compare crbug.com/605334 and crbug.com/758209. In my testing (bypassing ots) it only works with a font without
Any pointers where that code is, @behdad? Maybe I can do my first FreeType patch :) |
Is it 778a7e6a36912? |
FWIW, I'm planning to add a check for "legacy CBDT" to ChromaCheck, so it'll check with both a font with, and without the glyf table. |
Filed FreeType bug 53154 with proposed patch. |
Nice. Will check. Thanks. |
Another thing is, we built our fonts setting table version to 2. MS spec'ed it as having version 3... Watch out for which works where.... |
For both Chrome 65.0.3325.162 and Chromium 64.0.3282.167 (not the very latest) I have (Linux, 64bit), https://pixelambacht.nl/chromacheck/ reports no font type supported, although I can see the green Google type icon on https://pixelambacht.nl/demo/color-font-test.html |
@JanisE The old |
I don't know how common my case is for a user of ChromaCheck, but in such cases ChromaCheck just plain does not work. If it is common, I think that support for the legacy format is substantial. |
Edit: current situation in a nutshell:
CBDT spec proposal stated no
glyf
table should be present in CBDT/CBLC fonts. Current spec doesn't say anything about this. Fonts built on the proposal specs will fail in browsers with OTS, as the absence of aglyf
table makes OTS reject them. In current FreeType implementations (Chrome on Android), theseglyf
less fonts work, and the color glyphs are shown.For CBDT/CBLC fonts with a
glyf
table the glyph in the CBDT/CBLC table will be ignored, effectively always rendering the normal glyph, making it impossible to get the color glyph.The text was updated successfully, but these errors were encountered: