GithubHelp home page GithubHelp logo

roeln / chromacheck Goto Github PK

View Code? Open in Web Editor NEW
79.0 79.0 9.0 148 KB

Feature test for color font support in browsers

Home Page: https://pixelambacht.nl/chromacheck

License: MIT License

Shell 7.00% HTML 19.09% JavaScript 73.90%

chromacheck's People

Contributors

drott avatar jolg42 avatar roeln avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

chromacheck's Issues

Win10 Edge passes ChromaCheck but actual visual check shows it is really buggy

TTF CBDT font fails (tested using NotoColorEmoji.ttf).
Converted to woff, it shows up: https://rawgit.com/yincrash/43341c4848949b0e6534277cfe70d950/raw/07e192c9f2e646413a099b41181b6cc43e772c53/cbdt-test.html

However, loading that one CBDT font meant CBDT fonts following it failed to render. On that test page, I also included your ChromaCheck CBDT font.

Additionally, CBDT font prevented a COLR font following it to not render:
https://rawgit.com/yincrash/43341c4848949b0e6534277cfe70d950/raw/07e192c9f2e646413a099b41181b6cc43e772c53/cbdt-test-no-emoji.html

This also means any regular windows 10 emoji fallback to a b&w version as seen here: https://rawgit.com/yincrash/43341c4848949b0e6534277cfe70d950/raw/07e192c9f2e646413a099b41181b6cc43e772c53/cbdt-test-only-cbdt.html

And just to make sure COLR fonts load properly, a control using the ChromaCheck COLR font:
https://rawgit.com/yincrash/43341c4848949b0e6534277cfe70d950/raw/07e192c9f2e646413a099b41181b6cc43e772c53/cbdt-test-only-colr.html

Maybe it would be worthwhile to implement a visual inspection on the ChromaCheck page in addition to the automated SVG check? Yet the https://pixelambacht.nl/chromacheck/old/ works fine! So maybe I'm just going crazy.

Safari puts extra space between glyphs

The glyphs in the test font should snuggle up to each other, but Safari sticks about 4 pixels of space between them. There are no spaces in the text string.

Example:

chromatest_by_pixelambacht

Make sure test font has been loaded

Font is base64 inlined, but is still loaded async. So it might not have finished loading when we draw the image, resulting in false negatives. (Only seems to happen in Safari/OSX?)

Options: Fontfaceobserver? Simple finite loop?

Work around tained canvas error in Internet Explorer

IE (not Edge) will throw a SCRIPT5022: SecurityError when running ChromaCheck. This is because writing an SVG to the canvas taints the canvas, disallowing ChromaCheck to look at the drawn pixels:

Once a canvas has been tainted, you can no longer pull data back out of the canvas. For example, you can no longer use the canvas toBlob(), toDataURL(), or getImageData() methods; doing so will throw a security error.

See also this StackOverflow issue.

We draw an SVG to the canvas to work around an older Firefox issue. Maybe drop the SVG workaround? Or skip the SVG method for IE/non-Fx?

Firefox supports all four formats, shows as supporting only two

Hi, I don't know a lot of the technical details here, but on my Linux machine I have copied Apple Color Emoji (which definitely worked) and I believe Segoe UI Emoji (not sure if I'm misremembering, have to try again). Firefox supported SVG in Opentype first, and will support the Google/Noto format without any major issues in Firefox 44 or 45.

So basically as I said in the title, Firefox can show all four formats, in full color and everything.

I feel like Firefox's wide emoji support isn't widely known. If you need me to test this more, or help make this more reproducible/debuggable, I'm interested in contributing some time toward that. It'd be nice to have a definitive resource such as this to test emoji support. Just needs to be updated a bit, I think!

message from qt6 webengine "Multiple readback operations using getImageData are faster...."

visiting the web page with a qt6 webengine browser results in this message in stderr:

js: Canvas2D: Multiple readback operations using getImageData are faster with the willReadFrequently attribute set to true. See: https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-will-read-frequently

This seems to come from /usr/lib64/libQt6WebEngineCore.so.6 .

README.md: Is the Firefox bug fixed yet?

Hi.

In README.md it says this:

Firefox (on OSX?) has a bug that prevents color glyphs from being used on canvas with fillText(). This has been fixed for locally installed fonts but still needs more fixin' for fonts loaded through @font-face. ChromaTest works around this by sticking the font in an SVG image, and then drawing that image on canvas.

It says the status is Resolved:Fixed over at [bugzilla.mozilla.org](bug 1237640), but it says it needs fixing in your README.md.

I am pretty sure ChromaCheck is 100% accurate, but every time I see that in the README I feel like I missed something and can't be sure anymore. Some clarity would be helpful. ChromaCheck working 100% has some impact on whether I put in the effort to maintain my own testing setup for color font support.

P.S. Incidentally: a minor typo in that sentence:

ChromaTest works around this by . . .

Create separate font for each format to avoid clashes

First and foremost ChromaCheck should see if individual color formats work. To avoid confusing render engines when there's more than one format in the font, we need to separate all four fonts, like was done for CDBT/CBLC.
Also see:
#8
#21

Fix the SVG glyph

Current implementation uses the transform attribute on the test glyph's SVG element, which is not officially supported. The reason for this transformation is to convert SVG's axis system (top of letter is at y=-500) to OpenType axis (top of letter is at y=500).

Against spec, Firefox does do the transform, resulting in okay looking glyphs. But stricter implementations might not, causing the glyph to be shown outside its bounding box, resulting in a false negative on the test.

Confirm that CBDT/CBLC glyph actually works

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 a glyf table makes OTS reject them. In current FreeType implementations (Chrome on Android), these glyfless 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.

Move CBDT/CBLC glyph to separate font

CBDT/CBLC glyph will show on Chrome on Linux, Android and ChromeOS, but only when there's no glyf table present in the font. There might also be a priority issue with the sbix table as mentioned here.

The only solution is to make a separate font. (Maybe make a separate font for the other formats as well?)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.