Bug 264115 - An incorrect fallback font for Ahem returns where unicode-range is set.
Summary: An incorrect fallback font for Ahem returns where unicode-range is set.
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Text (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-11-02 15:08 PDT by ChangSeok Oh
Modified: 2024-01-26 11:59 PST (History)
5 users (show)

See Also:


Attachments
test case (229 bytes, text/html)
2024-01-26 11:58 PST, Alexey Proskuryakov
no flags Details
test case (230 bytes, text/html)
2024-01-26 11:59 PST, Alexey Proskuryakov
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description ChangSeok Oh 2023-11-02 15:08:11 PDT
While I was investigating the failure of size-adjust-unicode-range-system-fallback.html [1], I found Mac port behaved unexpectedly to unicode-range. Please try the following HTML snippet.

```
<style>
@font-face {
  font-family: large-font;
  src: local(Ahem), url(/fonts/Ahem.ttf);
  size-adjust: 1000%;
  unicode-range: U+0020;
}

.test {
  font-family: large-font;
}
</style>
<span class="test">X</span>
```

The expected result is a small `X`, but Mac port shows a large square from Ahem.
Aside from the different sizes, unicode-range is set with U+0020 (i.e., space) so Ahem should be limited to only spaces.

When I tracked down this issue, I encountered that CTFontCreateForCharactersWithLanguageAndOption returned Ahem as a fallback for Ahem in lookupFallbackFont() at FontCacheCoreText.cpp. However, further investigation was not possible since I could not see the definition of CTFontCreateForCharactersWithLanguageAndOption.

Maybe, Apple folks want to look into this issue. FYI, GTK/WPE ports work fine.

[1] https://wpt.fyi/results/css/css-fonts/size-adjust-unicode-range-system-fallback.html?label=experimental&label=master&aligned
Comment 1 Radar WebKit Bug Importer 2023-11-09 14:09:23 PST
<rdar://problem/118199422>
Comment 2 Alexey Proskuryakov 2024-01-26 11:58:18 PST
Created attachment 469561 [details]
test case
Comment 3 Alexey Proskuryakov 2024-01-26 11:59:00 PST
Created attachment 469562 [details]
test case
Comment 4 Alexey Proskuryakov 2024-01-26 11:59:46 PST
The WPT link no longer shows the problem, as the test got changed to work around it. Attaching the original test.