Commit 4c384e7f authored by Dominik Röttsches's avatar Dominik Röttsches Committed by Commit Bot

Follow style information when using Skia font fallback

Retrieving fallback font information on Windows 8.1 and up using Skia's
matchFamilyStyleCharacter() did only pick the family name, but not
instantiate the fallback font from the additional SkFontStyle font style
information that Skia provides as well. This bug was fixed similarly
before for the Windows 8.0 and before fallback code path in issue
1008901.

This fixes an issue in which fallback for U+2758 LIGHT VERTICAL BAR
produces Segoe UI Semilight as fallback font, but the renderer was
unable to instantiate that font correctly and displayed a .notdef glyph
for this character.

Bug: 1018375
Change-Id: I18a37f8f432ff1c392dedbc868b8f882254b12d8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1883515Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Commit-Queue: Dominik Röttsches <drott@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710252}
parent 29b91f26
......@@ -388,9 +388,12 @@ scoped_refptr<SimpleFontData> FontCache::GetDWriteFallbackFamily(
SkString skia_family;
typeface->getFamilyName(&skia_family);
FontDescription fallback_updated_font_description(font_description);
fallback_updated_font_description.UpdateFromSkiaFontStyle(
typeface->fontStyle());
FontFaceCreationParams create_by_family(ToAtomicString(skia_family));
FontPlatformData* data =
GetFontPlatformData(font_description, create_by_family);
FontPlatformData* data = GetFontPlatformData(
fallback_updated_font_description, create_by_family);
if (!data || !data->FontContainsCharacter(codepoint))
return nullptr;
return FontDataFromFontPlatformData(data, kDoNotRetain);
......
......@@ -141,6 +141,11 @@ crbug.com/1012590 [ Linux ] fast/overflow/rtl-scrollbar-drag-origin.html [ WontF
# Linux layout tests do not have a Myanmar fallback font.
[ Linux ] inspector-protocol/layout-fonts/fallback-myanmar.js [ WontFix ]
# Windows 10 specific font fallback test.
crbug.com/1018375 [ Linux ] inspector-protocol/layout-fonts/fallback-dingbats.js [ WontFix ]
crbug.com/1018375 [ Mac ] inspector-protocol/layout-fonts/fallback-dingbats.js [ WontFix ]
crbug.com/1018375 [ Win7 ] inspector-protocol/layout-fonts/fallback-dingbats.js [ WontFix ]
# Mac only test for case-insensitive font-matching.
[ Linux ] inspector-protocol/layout-fonts/mac-case-insensitive-matching.js [ WontFix ]
[ Win ] inspector-protocol/layout-fonts/mac-case-insensitive-matching.js [ WontFix ]
......
(async function(testRunner) {
var page = await testRunner.createPage();
await page.loadHTML(`
<html>
<meta charset="UTF-8">
<body>
<div class="test">
<div lang="en" id="dingbats_segoe_ui_semilight">❘</div>
<div lang="en" id="dingbats_unicode_block">✀✁✂✃✄✅✆✇✈✉✊✋✌✍✎✏✐✑✒✓✔✕✖✗✘✙✚✛✜✝✞✟✠✡✢✣✤✥✦✧✨✩✪✫✬✭✮✯✰✱✲✳✴✵✶✷✸✹✺✻✼✽✾✿❀❁❂❃❄❅❆❇❈❉❊❋❌❍❎❏❐❑❒❓❔❕❖❗❘❙❚❛❜❝❞❟❠❡❢❣❤❥❦❧❨❩❪❫❬❭❮❯❰❱❲❳❴❵❶❷❸❹❺❻❼❽❾❿➀➁➂➃➄➅➆➇➈➉➊➋➌➍➎➏➐➑➒➓➔➕➖➗➘➙➚➛➜➝➞➟➠➡➢➣➤➥➦➧➨➩➪➫➬➭➮➯➰➱➲➳➴➵➶➷➸➹➺➻➼➽➾➿</div>
</div>
</body>
</html>
`);
var session = await page.createSession();
testRunner.log(`Test passes if the #dingbats_segoe_ui_semilight block uses the Segoe UI Semilight font instead of the Arial font to display a .notdef tofu block.`);
var helper = await testRunner.loadScript('./resources/layout-font-test.js');
var results = await helper(testRunner, session);
var segoe_ui_semilight = results.find(x => x.selector === '#dingbats_segoe_ui_semilight').usedFonts;
var all_dingbats = results.find(x => x.selector === '#dingbats_unicode_block').usedFonts;
var passed = (segoe_ui_semilight.length === 1 && segoe_ui_semilight[0].familyName.includes('Segoe UI Semilight'));
passed = passed && (all_dingbats.length === 2
&& all_dingbats[0].familyName.includes('Segoe UI Symbol')
&& all_dingbats[1].familyName.includes('Segoe UI Emoji'));
testRunner.log(passed ? 'PASS' : 'FAIL');
testRunner.completeTest();
})
Test passes if the #dingbats_segoe_ui_semilight block uses the Segoe UI Semilight font instead of the Arial font to display a .notdef tofu block.
#dingbats_segoe_ui_semilight:
"Segoe UI Semilight" : 1
✀✁✂✃✄✅✆✇✈✉✊✋✌✍✎✏✐✑✒✓✔✕✖✗✘✙✚✛✜✝✞✟✠✡✢✣✤✥✦✧✨✩✪✫✬✭✮✯✰✱✲✳✴✵✶✷✸✹✺✻✼✽✾✿❀❁❂❃❄❅❆❇❈❉❊❋❌❍❎❏❐❑❒❓❔❕❖❗❘❙❚❛❜❝❞❟❠❡❢❣❤❥❦❧❨❩❪❫❬❭❮❯❰❱❲❳❴❵❶❷❸❹❺❻❼❽❾❿➀➁➂➃➄➅➆➇➈➉➊➋➌➍➎➏➐➑➒➓➔➕➖➗➘➙➚➛➜➝➞➟➠➡➢➣➤➥➦➧➨➩➪➫➬➭➮➯➰➱➲➳➴➵➶➷➸➹➺➻➼➽➾➿
#dingbats_unicode_block:
"Segoe UI Symbol" : 175,
"Segoe UI Emoji" : 17
PASS
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment