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

Unified Diff: Source/platform/fonts/harfbuzz/FontHarfBuzz.cpp

Issue 130433006: Implement CSS Emphasis Marks for complex text (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: New Approach, splitting hb-clusters into grapheme clusters, comment cleanup, rebaseline Created 6 years, 10 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: Source/platform/fonts/harfbuzz/FontHarfBuzz.cpp
diff --git a/Source/platform/fonts/harfbuzz/FontHarfBuzz.cpp b/Source/platform/fonts/harfbuzz/FontHarfBuzz.cpp
index af44f81aff09ab80c085da185a88c80f29146b06..41934b20cb7595f97b3d1470e1b7d6cf37aa2f3b 100644
--- a/Source/platform/fonts/harfbuzz/FontHarfBuzz.cpp
+++ b/Source/platform/fonts/harfbuzz/FontHarfBuzz.cpp
@@ -186,9 +186,24 @@ void Font::drawComplexText(GraphicsContext* gc, const TextRunPaintInfo& runInfo,
drawGlyphBuffer(gc, runInfo, glyphBuffer, adjustedPoint);
}
-void Font::drawEmphasisMarksForComplexText(GraphicsContext* /* context */, const TextRunPaintInfo& /* runInfo */, const AtomicString& /* mark */, const FloatPoint& /* point */) const
+void Font::drawEmphasisMarksForComplexText(GraphicsContext* context, const TextRunPaintInfo& runInfo, const AtomicString& mark, const FloatPoint& point) const
{
- notImplemented();
+ GlyphBuffer glyphBuffer;
+
+ float initialAdvance = getGlyphsAndAdvancesForComplexText(runInfo.run, runInfo.from, runInfo.to, glyphBuffer, ForTextEmphasis);
+
+ if (glyphBuffer.isEmpty())
+ return;
+
+ drawEmphasisMarks(context, runInfo, glyphBuffer, mark, FloatPoint(point.x() + initialAdvance, point.y()));
+}
+
+float Font::getGlyphsAndAdvancesForComplexText(const TextRun& run, int from, int to, GlyphBuffer& glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const
+{
+ HarfBuzzShaper shaper(this, run, ForTextEmphasis); // TODO: forTextEmphasis argument? Nullify space & separator glyphs
leviw_travelin_and_unemployed 2014/02/10 00:10:38 I'm not sure I understand this TODO. Can you make
+ shaper.setDrawRange(from, to);
+ shaper.shape(&glyphBuffer);
+ return 0;
}
float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>* /* fallbackFonts */, GlyphOverflow* /* glyphOverflow */) const

Powered by Google App Engine
This is Rietveld 408576698