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

Side by Side 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: countGraphemesInCluster based on m_normalizedBuffer (win build fix) 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved. 2 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 179
180 GlyphBuffer glyphBuffer; 180 GlyphBuffer glyphBuffer;
181 HarfBuzzShaper shaper(this, runInfo.run); 181 HarfBuzzShaper shaper(this, runInfo.run);
182 shaper.setDrawRange(runInfo.from, runInfo.to); 182 shaper.setDrawRange(runInfo.from, runInfo.to);
183 if (!shaper.shape(&glyphBuffer)) 183 if (!shaper.shape(&glyphBuffer))
184 return; 184 return;
185 FloatPoint adjustedPoint = shaper.adjustStartPoint(point); 185 FloatPoint adjustedPoint = shaper.adjustStartPoint(point);
186 drawGlyphBuffer(gc, runInfo, glyphBuffer, adjustedPoint); 186 drawGlyphBuffer(gc, runInfo, glyphBuffer, adjustedPoint);
187 } 187 }
188 188
189 void Font::drawEmphasisMarksForComplexText(GraphicsContext* /* context */, const TextRunPaintInfo& /* runInfo */, const AtomicString& /* mark */, const FloatPoi nt& /* point */) const 189 void Font::drawEmphasisMarksForComplexText(GraphicsContext* context, const TextR unPaintInfo& runInfo, const AtomicString& mark, const FloatPoint& point) const
190 { 190 {
191 notImplemented(); 191 GlyphBuffer glyphBuffer;
192
193 float initialAdvance = getGlyphsAndAdvancesForComplexText(runInfo.run, runIn fo.from, runInfo.to, glyphBuffer, ForTextEmphasis);
194
195 if (glyphBuffer.isEmpty())
196 return;
197
198 drawEmphasisMarks(context, runInfo, glyphBuffer, mark, FloatPoint(point.x() + initialAdvance, point.y()));
199 }
200
201 float Font::getGlyphsAndAdvancesForComplexText(const TextRun& run, int from, int to, GlyphBuffer& glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const
202 {
203 HarfBuzzShaper shaper(this, run, HarfBuzzShaper::ForTextEmphasis);
204 shaper.setDrawRange(from, to);
205 shaper.shape(&glyphBuffer);
206 return 0;
192 } 207 }
193 208
194 float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon tData*>* /* fallbackFonts */, GlyphOverflow* /* glyphOverflow */) const 209 float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon tData*>* /* fallbackFonts */, GlyphOverflow* /* glyphOverflow */) const
195 { 210 {
196 HarfBuzzShaper shaper(this, run); 211 HarfBuzzShaper shaper(this, run);
197 if (!shaper.shape()) 212 if (!shaper.shape())
198 return 0; 213 return 0;
199 return shaper.totalWidth(); 214 return shaper.totalWidth();
200 } 215 }
201 216
(...skipping 12 matching lines...) Expand all
214 const FloatPoint& point, int height, 229 const FloatPoint& point, int height,
215 int from, int to) const 230 int from, int to) const
216 { 231 {
217 HarfBuzzShaper shaper(this, run); 232 HarfBuzzShaper shaper(this, run);
218 if (!shaper.shape()) 233 if (!shaper.shape())
219 return FloatRect(); 234 return FloatRect();
220 return shaper.selectionRect(point, height, from, to); 235 return shaper.selectionRect(point, height, from, to);
221 } 236 }
222 237
223 } // namespace WebCore 238 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/text/emphasis-complex.html ('k') | Source/platform/fonts/harfbuzz/HarfBuzzShaper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698