New issue
Advanced search Search tips

Issue 808003 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

FontMetrics UnderlinePosition() and UnderlineThickness() are not initialized

Project Member Reported by drott@chromium.org, Feb 1 2018

Issue description

TextPainter code relies on FontMetrics::UnderlinePosition() and FontMetrics::UnderlineThickness(), but apparently they are only zero initialzed in SimpleFontData. 

As a rough sketch, we need to do something like:

--- a/third_party/WebKit/Source/platform/fonts/SimpleFontData.cpp
+++ b/third_party/WebKit/Source/platform/fonts/SimpleFontData.cpp
@@ -94,6 +94,11 @@ void SimpleFontData::PlatformInit(bool subpixel_ascent_descent) {
   font_metrics_.SetAscent(ascent);
   font_metrics_.SetDescent(descent);
 
+  if (metrics.fFlags & SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag)
+    font_metrics_.SetUnderlinePosition(metrics.fUnderlinePosition);
+  if (metrics.fFlags & SkPaint::FontMetrics::kUnderlineThicknessIsValid_Flag)
+    font_metrics_.SetUnderlineThickness(metrics.fUnderlineThickness);

But in addition, probably keep a flag to distinguish a zero from an unavailable value.

Plus, keeping a blacklist for CJK fonts with bad underlines, compare 
https://dxr.mozilla.org/mozilla-central/source/modules/libpref/init/all.js#2578


 

Sign in to add a comment