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

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: WiP Created 6 years, 11 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 178
179 GlyphBuffer glyphBuffer; 179 GlyphBuffer glyphBuffer;
180 HarfBuzzShaper shaper(this, runInfo.run); 180 HarfBuzzShaper shaper(this, runInfo.run);
181 shaper.setDrawRange(runInfo.from, runInfo.to); 181 shaper.setDrawRange(runInfo.from, runInfo.to);
182 if (!shaper.shape(&glyphBuffer)) 182 if (!shaper.shape(&glyphBuffer))
183 return; 183 return;
184 FloatPoint adjustedPoint = shaper.adjustStartPoint(point); 184 FloatPoint adjustedPoint = shaper.adjustStartPoint(point);
185 drawGlyphBuffer(gc, runInfo, glyphBuffer, adjustedPoint); 185 drawGlyphBuffer(gc, runInfo, glyphBuffer, adjustedPoint);
186 } 186 }
187 187
188 void Font::drawEmphasisMarksForComplexText(GraphicsContext* /* context */, const TextRunPaintInfo& /* runInfo */, const AtomicString& /* mark */, const FloatPoi nt& /* point */) const 188 void Font::drawEmphasisMarksForComplexText(GraphicsContext* context, const TextR unPaintInfo& runInfo, const AtomicString& mark, const FloatPoint& point) const
189 { 189 {
190 notImplemented(); 190 GlyphBuffer glyphBuffer;
191
192 float initialAdvance = getGlyphsAndAdvancesForComplexText(runInfo.run, runIn fo.from, runInfo.to, glyphBuffer, ForTextEmphasis);
193
194 if (glyphBuffer.isEmpty())
195 return;
196
197 drawEmphasisMarks(context, runInfo, glyphBuffer, mark, FloatPoint(point.x() + initialAdvance, point.y()));
198 }
199
200 float Font::getGlyphsAndAdvancesForComplexText(const TextRun& run, int from, int to, GlyphBuffer& glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const
201 {
202 HarfBuzzShaper shaper(this, run, ForTextEmphasis); // TODO: forTextEmphasis argument? Nullify space & separator glyphs
203 shaper.setDrawRange(from, to);
204 if (!shaper.shape(&glyphBuffer))
205 return 0;
206
207 // TODO: rtl()? Get this initial value?
208 return 0;
191 } 209 }
192 210
193 float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon tData*>* /* fallbackFonts */, GlyphOverflow* /* glyphOverflow */) const 211 float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon tData*>* /* fallbackFonts */, GlyphOverflow* /* glyphOverflow */) const
194 { 212 {
195 HarfBuzzShaper shaper(this, run); 213 HarfBuzzShaper shaper(this, run);
196 if (!shaper.shape()) 214 if (!shaper.shape())
197 return 0; 215 return 0;
198 return shaper.totalWidth(); 216 return shaper.totalWidth();
199 } 217 }
200 218
(...skipping 12 matching lines...) Expand all
213 const FloatPoint& point, int height, 231 const FloatPoint& point, int height,
214 int from, int to) const 232 int from, int to) const
215 { 233 {
216 HarfBuzzShaper shaper(this, run); 234 HarfBuzzShaper shaper(this, run);
217 if (!shaper.shape()) 235 if (!shaper.shape())
218 return FloatRect(); 236 return FloatRect();
219 return shaper.selectionRect(point, height, from, to); 237 return shaper.selectionRect(point, height, from, to);
220 } 238 }
221 239
222 } // namespace WebCore 240 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/platform/fonts/harfbuzz/HarfBuzzShaper.h » ('j') | Source/platform/fonts/harfbuzz/HarfBuzzShaper.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698