Skip to content

Commit

Permalink
The size-adjust descriptor should not scale system fallback fonts.
Browse files Browse the repository at this point in the history
When creating a system fallback font for a character on Mac, Blink
refers to the font platform data of the primary font. However, the
created system fallback font could be unintentionally scaled where
the size-adjust descriptor scales the primary font. To fix it, we use
the effective size of the font description instead.

Test: external/wpt/css/css-fonts/size-adjust-unicode-range-system-fallback.html

Bug: 1441723
Change-Id: I35c744f0ddcc0af82645bb4ff87dcdfa1b44860a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4861389
Reviewed-by: Dominik Röttsches <drott@chromium.org>
Commit-Queue: ChangSeok Oh <changseok.oh@bytedance.com>
Cr-Commit-Position: refs/heads/main@{#1198009}
  • Loading branch information
shivamidow authored and chromium-wpt-export-bot committed Sep 18, 2023
1 parent ac2aa5a commit 305d25f
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
21 changes: 21 additions & 0 deletions css/css-fonts/size-adjust-unicode-range-system-fallback-ref.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE HTML>
<meta charset="utf-8">
<link rel="author" href="mailto:changseok@webkit.org">
<title>Tests that the size-adjust descriptor does not affect system fallback font size.</title>
<style>
@font-face {
font-family: large-font;
src: local(Ahem), url(/fonts/ahem.ttf);
size-adjust: 1000%;
unicode-range: U+0020;
}

.space {
font-family: large-font;
}

.ref {
font-family: sans-serif;
}
</style>
<span class="space"> </span><span class="ref"></span>
20 changes: 20 additions & 0 deletions css/css-fonts/size-adjust-unicode-range-system-fallback.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE HTML>
<meta charset="utf-8">
<link rel="author" title="ChangSeok Oh" href="mailto:changseok@webkit.org">
<link rel="help" href="https://crbug.com/1441723">
<link rel="match" href="size-adjust-unicode-range-system-fallback-ref.html">
<link rel="assert" title="Tests that the size-adjust descriptor does not affect system fallback font size.">
<title>Tests that the size-adjust descriptor does not affect system fallback font size.</title>
<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"></span>
1 change: 1 addition & 0 deletions lint.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,7 @@ AHEM SYSTEM FONT: css/css-fonts/font-size-adjust-metrics-override.html
AHEM SYSTEM FONT: css/css-fonts/font-size-adjust-metrics-override-ref.html
AHEM SYSTEM FONT: css/css-fonts/line-gap-override.html
AHEM SYSTEM FONT: css/css-fonts/parsing/font-size-adjust-computed.html
AHEM SYSTEM FONT: css/css-fonts/size-adjust-unicode-range-system-fallback.html
AHEM SYSTEM FONT: html/dom/render-blocking/remove-attr-unblocks-rendering.optional.html
AHEM SYSTEM FONT: html/dom/render-blocking/remove-element-unblocks-rendering.optional.html

Expand Down

0 comments on commit 305d25f

Please sign in to comment.