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

Unified Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp

Issue 2427773002: Fixing superscript and subscript baseline for tiny fonts in SVG
Patch Set: Created 4 years, 2 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
Index: third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp
index 1366c87c9cc334ef93eb94dbcfe1594dd52ae986..039cd236e70efdbeeb540ecdb5b036ddcc22074c 100644
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp
@@ -398,6 +398,11 @@ void LayoutSVGInlineText::computeNewScaledFontForStyle(
fontDescription.specifiedSize(), DoNotUseSmartMinimumForFontSize));
scaledFont = Font(fontDescription);
+ // If the font size is smaller than 3, rounding ascent and descent values
+ // ignores the baseline shifts for superscript and subscript. In this case,
+ // we use subpixel ascent and descent.
+ if (scaledFont.getFontDescription().getSize().value < 3)
+ scaledFont.getFontDescription().setSubpixelAscentDescent(true);
eae 2016/10/17 20:14:23 It's not clear that updateScaledFont is guaranteed
zakerinasab 2016/10/18 15:51:16 Correct. The problem is that the rounding at the b
scaledFont.update(document.styleEngine().fontSelector());
}

Powered by Google App Engine
This is Rietveld 408576698