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

Unified Diff: Source/platform/fonts/Font.cpp

Issue 642863005: Consolidate Font::codePath kerning & ligatures exceptions (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Emphasis fix Created 6 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
« no previous file with comments | « Source/platform/fonts/Font.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/Font.cpp
diff --git a/Source/platform/fonts/Font.cpp b/Source/platform/fonts/Font.cpp
index e2ccfba1a003a2602ba31caaea166e73ec7850db..8252dc9fdb79bea43179a155871fdad641b04656 100644
--- a/Source/platform/fonts/Font.cpp
+++ b/Source/platform/fonts/Font.cpp
@@ -110,12 +110,7 @@ float Font::drawText(GraphicsContext* context, const TextRunPaintInfo& runInfo,
if (shouldSkipDrawing() && customFontNotReadyAction == DoNotPaintIfFontNotReady)
return 0;
- CodePath codePathToUse = codePath(runInfo.run);
- // FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050
- if (codePathToUse != ComplexPath && fontDescription().typesettingFeatures() && (runInfo.from || runInfo.to != runInfo.run.length()))
- codePathToUse = ComplexPath;
-
- if (codePathToUse != ComplexPath)
+ if (codePath(runInfo.run, runInfo.from, runInfo.to) != ComplexPath)
return drawSimpleText(context, runInfo, point);
return drawComplexText(context, runInfo, point);
@@ -126,12 +121,7 @@ void Font::drawEmphasisMarks(GraphicsContext* context, const TextRunPaintInfo& r
if (shouldSkipDrawing())
return;
- CodePath codePathToUse = codePath(runInfo.run);
- // FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050
- if (codePathToUse != ComplexPath && fontDescription().typesettingFeatures() && (runInfo.from || runInfo.to != runInfo.run.length()))
- codePathToUse = ComplexPath;
-
- if (codePathToUse != ComplexPath)
+ if (codePath(runInfo.run, runInfo.from, runInfo.to) != ComplexPath)
drawEmphasisMarksForSimpleText(context, runInfo, mark, point);
else
drawEmphasisMarksForComplexText(context, runInfo, mark, point);
@@ -211,12 +201,7 @@ PassTextBlobPtr Font::buildTextBlob(const TextRunPaintInfo& runInfo, const Float
if (shouldSkipDrawing() && customFontNotReadyAction == DoNotPaintIfFontNotReady)
return nullptr;
- CodePath codePathToUse = codePath(runInfo.run);
- // FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050
- if (codePathToUse != ComplexPath && fontDescription().typesettingFeatures() && (runInfo.from || runInfo.to != runInfo.run.length()))
- codePathToUse = ComplexPath;
-
- if (codePathToUse != ComplexPath)
+ if (codePath(runInfo.run, runInfo.from, runInfo.to) != ComplexPath)
return buildTextBlobForSimpleText(runInfo, textOrigin, couldUseLCDRenderedText);
return nullptr;
@@ -297,12 +282,7 @@ FloatRect Font::selectionRectForText(const TextRun& run, const FloatPoint& point
{
to = (to == -1 ? run.length() : to);
- CodePath codePathToUse = codePath(run);
- // FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050
- if (codePathToUse != ComplexPath && fontDescription().typesettingFeatures() && (from || to != run.length()))
- codePathToUse = ComplexPath;
-
- if (codePathToUse != ComplexPath)
+ if (codePath(run, from, to) != ComplexPath)
return selectionRectForSimpleText(run, point, h, from, to, accountForGlyphBounds);
return selectionRectForComplexText(run, point, h, from, to);
@@ -322,13 +302,15 @@ void Font::setCodePath(CodePath p)
s_codePath = p;
}
-CodePath Font::codePath()
+CodePath Font::codePath(const TextRun& run, int from, int to) const
Dominik Röttsches 2014/10/10 13:37:53 I would make the argument a TextRunPaintInfo - whi
f(malita) 2014/10/10 14:09:12 Done.
{
- return s_codePath;
-}
+ // FIXME: Do we really want to override s_codePath?
Dominik Röttsches 2014/10/10 13:37:54 Can you elaborate on the question? What do we need
f(malita) 2014/10/10 14:09:12 Per comments, I assumed it is a way to force a par
+ // FIXME: Use the fast code path once it handles partial runs with kerning and ligatures.
Dominik Röttsches 2014/10/10 13:37:54 The second FIXME is obsolete. We plan to remove th
f(malita) 2014/10/10 14:09:12 Do you mean SimpleShaper & friends are going away?
+ // See http://webkit.org/b/100050
+ // (Is that still feasible?)
+ if (fontDescription().typesettingFeatures() && (from || to != run.length()))
+ return ComplexPath;
-CodePath Font::codePath(const TextRun& run) const
-{
if (s_codePath != AutoPath)
return s_codePath;
« no previous file with comments | « Source/platform/fonts/Font.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698