Fallback font used to render swaths supported text when only one combining mark is missing from the font
Reported by
mateusz....@guardian.co.uk,
Aug 23 2017
|
||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.59 Safari/537.36 Example URL: https://www.theguardian.com/science/grrlscientist/2012/aug/07/3 Steps to reproduce the problem: Hello, Other browsers tested: Firefox 56.0b6: OK Edge 40.15063.0.0: OK IE 11: OK Chrome (multiple, Mac/Win: FAIL 1. Go to https://www.theguardian.com/science/grrlscientist/2012/aug/07/3, scroll to the line below “A possible Chromium issue with some fonts:” line 2. Observe wrong rendering Alternative: 1a. Go to https://fonts.google.com/ 2a. Inspect a frame showing a font supporting U+00E2, but not supporting U+0309, e.g. Roboto. 3a. Click Edit HTML. 4a. Paste “ẩ” (LATIN SMALL LETTER A WITH CIRCUMFLEX (U+00E2) COMBINING HOOK ABOVE (U+0309)) at the end of the example text. What is the expected behavior? 1. For fonts supporting U+00E2, but not U+0309, U+00E2 should be rendered in correct font even when U+0309 (rendered using a fallback) is added to it. 2. Fallback is applied only to the glyphs not available in the font, not to the unknown amount of preceding text. What went wrong? 1. When unsupported U+0309 is added to a supported and perfectly rendered U+00E2, U+00E2 gets rendered in a fallback font. 2. More preceding text is rendered in a fallback font. Does it occur on multiple sites: Yes Is it a problem with a plugin? No Did this work before? No Does this work in other browsers? Yes Chrome version: 61.0.3163.59 Channel: beta OS Version: 10.0 Flash Version: Strangely, problem 2 does not occur for some fonts. Also, it occurs for some, but not all combining marks. I couldn’t find the offending bit(s) in the fonts themselves, though. To test, replace "Guardian Text Egyptian Web" with "Guardian Egyptian Web" in pt. 1. Problem 1 still occurs irregardless. Possibly related to: https://bugs.chromium.org/p/chromium/issues/detail?id=591346 I would love to know at least how to modify the font, so that problem 2 doesn’t occur (as would fontbakery, probably :). Thank you! Regards m.
,
Aug 24 2017
Over to drott for clarification as he's tweaked the behavior here quite a bit lately.
,
Aug 28 2017
,
Aug 29 2017
Thanks for the report, Mateusz. I can reproduce the first set of reproduction steps for the https://www.theguardian.com/science/grrlscientist/2012/aug/07/3 url and on Windows, I see the result as in your "Guardian font Chromium bug.PNG" screenshot, however, pasting into Google fonts shows a different result for me (showing â + .notdef mark, keeping all words rendered in Roboto). Do you know more about the sequence of font loading on the guardian grrlscientist page? Does this roughly follow the font loading strategy in https://github.com/guardian/frontend/blob/master/common/app/templates/inlineJS/blocking/loadFonts.scala.js ? I suspect Chrome may fail to invalidate the word cache for the page and keep words in it that have been rendered with the fallback font, Times New Roman, for the sentence in question. When I try to create a static reproduction, I do not succeed, probably because there is a timing/sequence of events aspect to this problem.
,
Aug 29 2017
Hello! Thank you very much for looking into it and I’m sorry I wasn’t clear. Revised steps to repro problems 1 & 2: 1b. Go to https://fonts.google.com/ 2b. Right click and Inspect a frame showing a font supporting U+00E2, but not supporting U+0309, e.g. Roboto. 3b. Right click on an Element containing the frame’s code in the DevTools and click Edit HTML. 4b. At the end a string of text, paste “â” (LATIN SMALL LETTER A WITH CIRCUMFLEX (as â)). 3b. Right click on an Element containing the frame’s code in the DevTools and click Edit HTML. 5b. Immediately after “â”, paste COMBINING HOOK ABOVE (as ̉). [see attached GIF] I’m code-dumb, so can rely specific questions about font loading to my colleagues, but I know that the default font loading mechanism uses base64 json strings kept in local storage. However, you can reproduce the problem also using an emergency, completely separate font loading mechanism that loads the fonts directly – by accessing https://www.theguardian.com/science/grrlscientist/2012/aug/07/3 when Chrome is set to NOT Allow sites to save and read cookie data (chrome://settings/content/cookies). Both problems manifest themselves on Windows, OSX and Android. In Opera as well. Let me know if I can help any more! Thank you. Regards Mateusz
,
Aug 29 2017
Right, thanks, I missed the initial step 3a, of pasting into "Edit HTML" in DevTools, and instead I pasted into the contenteditable Google Fonts sample box directly. Now I can reproduce the Google Fonts repro steps as well. I'll investigate and see if I can further reduce the issue.
,
Aug 29 2017
Simulating what the Guardian's font loader [1] does, I have a reproduction now (see guardianfonts.html). If I read the code right, the loader is inline executed and for newly arriving fonts inserting @font-face rules to style elements using '$0.innerHTML = <cssFromXHRFetch>'. The font or URL does not seem to matter, as long as it is a url() network resource. For @font-face rules that are injected in this way, something goes wrong in the interaction between shaping/FontFallbackIterator and font loading. If I had to speculate, perhaps their load status is not marked correctly? [1] https://github.com/guardian/frontend/blob/master/common/app/templates/inlineJS/blocking/loadFonts.scala.js
,
Aug 29 2017
Correction, even when loading the Roboto latin face through adding a new style element, loading it through the FontFace API, or simply loading it via an inline @font-face, this can be reproduced.
,
Aug 30 2017
This reproduces even when @font-face { src: local(Roboto); ... } is used, where the font face is resolved immediately. I think this is not a font loading issue.
,
Sep 8 2017
,
Sep 8 2017
Candidate fix work-in-progress in https://chromium-review.googlesource.com/c/chromium/src/+/657977
,
Sep 26 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/83821ae6fdc08f0ed0dbca13ad20d90fca7f3050 commit 83821ae6fdc08f0ed0dbca13ad20d90fca7f3050 Author: Dominik Röttsches <drott@chromium.org> Date: Tue Sep 26 09:48:43 2017 Fix incorrect font used in prefix of run ending in fallback grapheme When a run ended in a grapheme cluster consisting of a least two characters, and this grapheme resulted in not being shaped with the current font and needed fallback, then the full run from the beginning was incorrectly rendered in the fallback font. This is because one state transition between shaped and not shaped was not recognized, as the last_change_position had been advanced too far. To fix this, I clarified the shaping loop and moved the logic for commiting glyphs and queueing characters for reshaping into separate functions. When reaching the end of the glyph run, transitions between shaped or unshaped are detected for the last grapheme cluster and added to the ShapeResult or the reshaping queue accordingly. inspector-protocol/layout-fonts/prefix-fallback-multi-character-grapheme.js svg/text/combining-character-queries-expected.svg Bug: 758380 Tests: EmojiZWJSequence in HarfBuzzShaperTest.cpp, Change-Id: I95d536c488ac602cb4bdfd4e1ac4a729f92b1462 Reviewed-on: https://chromium-review.googlesource.com/657977 Commit-Queue: Dominik Röttsches <drott@chromium.org> Reviewed-by: Emil A Eklund <eae@chromium.org> Cr-Commit-Position: refs/heads/master@{#504327} [add] https://crrev.com/83821ae6fdc08f0ed0dbca13ad20d90fca7f3050/third_party/WebKit/LayoutTests/flag-specific/run-layout-test/platform/linux/inspector-protocol/layout-fonts/prefix-fallback-multi-character-grapheme-expected.txt [add] https://crrev.com/83821ae6fdc08f0ed0dbca13ad20d90fca7f3050/third_party/WebKit/LayoutTests/inspector-protocol/layout-fonts/prefix-fallback-multi-character-grapheme.js [modify] https://crrev.com/83821ae6fdc08f0ed0dbca13ad20d90fca7f3050/third_party/WebKit/LayoutTests/platform/linux/fast/text/international/complex-joining-using-gpos-expected.png [modify] https://crrev.com/83821ae6fdc08f0ed0dbca13ad20d90fca7f3050/third_party/WebKit/LayoutTests/platform/linux/svg/text/combining-character-queries-expected.png [modify] https://crrev.com/83821ae6fdc08f0ed0dbca13ad20d90fca7f3050/third_party/WebKit/LayoutTests/platform/linux/svg/text/combining-character-queries-expected.txt [add] https://crrev.com/83821ae6fdc08f0ed0dbca13ad20d90fca7f3050/third_party/WebKit/LayoutTests/platform/mac/inspector-protocol/layout-fonts/prefix-fallback-multi-character-grapheme-expected.txt [add] https://crrev.com/83821ae6fdc08f0ed0dbca13ad20d90fca7f3050/third_party/WebKit/LayoutTests/platform/win/inspector-protocol/layout-fonts/prefix-fallback-multi-character-grapheme-expected.txt [modify] https://crrev.com/83821ae6fdc08f0ed0dbca13ad20d90fca7f3050/third_party/WebKit/LayoutTests/platform/win/svg/text/combining-character-queries-expected.png [modify] https://crrev.com/83821ae6fdc08f0ed0dbca13ad20d90fca7f3050/third_party/WebKit/LayoutTests/platform/win/svg/text/combining-character-queries-expected.txt [modify] https://crrev.com/83821ae6fdc08f0ed0dbca13ad20d90fca7f3050/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp [modify] https://crrev.com/83821ae6fdc08f0ed0dbca13ad20d90fca7f3050/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h [modify] https://crrev.com/83821ae6fdc08f0ed0dbca13ad20d90fca7f3050/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaperTest.cpp
,
Sep 26 2017
Mateusz, thanks for the report, this has been very helpful.
,
Sep 26 2017
Dominik, thank you so much for fixing this! |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by pbomm...@chromium.org
, Aug 24 2017Components: -Blink Blink>Fonts
Labels: M-61