haikuwebkit/LayoutTests/fast/text/zero-width-shaping-font-mis...

15 lines
263 B
HTML
Raw Permalink Normal View History

Shaping can be performed on glyphIDs from the wrong font https://bugs.webkit.org/show_bug.cgi?id=215333 Reviewed by Darin Adler. Source/WebCore: The problem is this line: if (font != lastFontData && width) This means we will only trigger shaping code if width is non-zero. However, even if width is non-zero, we will still happily add glyphs to the glyph buffer, and when we do eventually get around to shaping, we shape all yet-unshaped glyphs, regardless of which font they came from. Test: fast/text/zero-width-shaping-font-mismatch.html * platform/graphics/WidthIterator.cpp: (WebCore::WidthIterator::commitCurrentFontRange): (WebCore::WidthIterator::advanceInternal): * platform/graphics/WidthIterator.h: LayoutTests: * fast/text/resources/Ahem-zero-width-shaping-font-mismatch.ttf: Added. This is a font where U+2C95 COPTIC SMALL LETTER KAPA (which Times doesn't support) is mapped to glyph 73. Also, the font has fewer than 192 glyphs. * fast/text/zero-width-shaping-font-mismatch-expected-mismatch.html: Added. Times has a ligature where the glyph sequence 73,76 gets replaced with glyph 192. The test has characters U+2C95 COPTIC SMALL LETTER KAPA (which Times doesn't support but the webfont does, so we map this to glyph 73 inside the web font) followed by U+0069 LATIN SMALL LETTER I, (which Times does support, so we map this to glyph 76 inside Times). Then, because of this bug, we'll try to shape glyphs 73,76 using Times, which replaces them with glyph 192, but then try to render glyph 192 with the web font, which doesn't support it, so we get a white screen. * fast/text/zero-width-shaping-font-mismatch.html: Added. Canonical link: https://commits.webkit.org/228126@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@265455 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-08-10 21:51:58 +00:00
<!DOCTYPE html>
<html>
<head>
<style>
@font-face {
font-family: WebFont;
src: url("resources/Ahem-zero-width-shaping-font-mismatch.ttf") format("truetype");
}
</style>
</head>
<body>
<div style="font: 192px Times, WebFont">&#x2C95;i</div>
</body>
</html>