From 639eb7bc552ee8ab2309a797d0f353304fd2b3da Mon Sep 17 00:00:00 2001 From: Martin Robinson Date: Fri, 16 May 2025 20:23:02 +0200 Subject: [PATCH] fonts: Fix calculation of font underline thickness on macOS (#37029) There was a typo in how underline thickness (in pixels) was converted to app units. It was interpreting the pixel value as an f64 app unit value, which meant that the resulting thickness was 1/60 of the value expected. Testing: macOS does not currently run WPT tests, so it is difficult to test this one. I have manually confirmed that underlines now show up and are the expected thickness. Fixes: #36945 Signed-off-by: Martin Robinson --- components/fonts/platform/macos/font.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/fonts/platform/macos/font.rs b/components/fonts/platform/macos/font.rs index 56eb8f4dd2c..5249621be81 100644 --- a/components/fonts/platform/macos/font.rs +++ b/components/fonts/platform/macos/font.rs @@ -287,7 +287,7 @@ impl PlatformFontMethods for PlatformFont { .unwrap_or(average_advance); let metrics = FontMetrics { - underline_size: Au::from_f64_au(underline_thickness), + underline_size: Au::from_f64_px(underline_thickness), // TODO(Issue #201): underline metrics are not reliable. Have to pull out of font table // directly. //