Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1166)

Unified Diff: Source/platform/fonts/skia/SimpleFontDataSkia.cpp

Issue 295923006: Fix underline position and thickness calculation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/TestExpectations ('k') | public/blink_skia_config.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/skia/SimpleFontDataSkia.cpp
diff --git a/Source/platform/fonts/skia/SimpleFontDataSkia.cpp b/Source/platform/fonts/skia/SimpleFontDataSkia.cpp
index 2ac44c3768002d951d47fee60d77e94d2992863e..0e20e86668f63c57737ae24ff42c47bdd1641456 100644
--- a/Source/platform/fonts/skia/SimpleFontDataSkia.cpp
+++ b/Source/platform/fonts/skia/SimpleFontDataSkia.cpp
@@ -131,11 +131,12 @@ void SimpleFontData::platformInit()
m_fontMetrics.setLineGap(lineGap);
m_fontMetrics.setLineSpacing(lroundf(ascent) + lroundf(descent) + lroundf(lineGap));
- float underlineThickness = SkScalarToFloat(metrics.fUnderlineThickness);
- m_fontMetrics.setUnderlineThickness(underlineThickness);
-
- float underlinePosition = SkScalarToFloat(metrics.fUnderlinePosition);
- m_fontMetrics.setUnderlineThickness(underlinePosition);
+ SkScalar underlineThickness, underlinePosition;
+ if (metrics.hasUnderlineThickness(&underlineThickness)
+ && metrics.hasUnderlinePosition(&underlinePosition)) {
+ m_fontMetrics.setUnderlineThickness(SkScalarToFloat(underlineThickness));
+ m_fontMetrics.setUnderlinePosition(SkScalarToFloat(-underlinePosition));
+ }
if (platformData().orientation() == Vertical && !isTextOrientationFallback()) {
static const uint32_t vheaTag = SkSetFourByteTag('v', 'h', 'e', 'a');
« no previous file with comments | « LayoutTests/TestExpectations ('k') | public/blink_skia_config.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698