Fix SVG text scaling when using font-size-adjust
SVG text was not properly scaled when font-size-adjust was applied
due to two issues. First, the adjusted font size was not set before
retrieving the font. When font-size-adjust is used, the adjusted size—
not the computed size—should be referenced during font selection.
Second, the aspect ratio of the font was calculated incorrectly in some
conditions. The ratio was derived from the computed size in
FontDescription, which may not match the intrinsic size of the reference
font. This change corrects both issues to ensure proper SVG text scaling
with font-size-adjust.
This change introduces a failure in font-size-adjust-009.html on
Windows. The test assumes that the Noto font has a cap-height of
1462/2048 units. However, DirectWrite on Windows reports a cap-height of
1472/2048 units. This mismatch prevents the test from passing on
Windows. Besides, this change affects the Windows result of
font-size-adjust-system-fallback.html. The Windows expectation was based
on an incorrect aspect-ratio calculation, so we need to update it accordingly.
Test:
external/wpt/svg/fonts/font-size-adjust-scale-text.svg (new)
Bug: 364926904
Change-Id: I6eb7cbde52aed72bdd2df75cf99ce99b56e89a43
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6473830
Reviewed-by: Dominik Röttsches [email protected]
Commit-Queue: ChangSeok Oh [email protected]
Cr-Commit-Position: refs/heads/main@{#1511868}