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

Side by Side Diff: Source/platform/fonts/Font.cpp

Issue 613193002: Avoid drawing emphasis marks over ellipsis glyphs (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated to not add in glyph buffer ellipsis character 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2006, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2006, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved. 6 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 HarfBuzzShaper shaper(this, runInfo.run); 954 HarfBuzzShaper shaper(this, runInfo.run);
955 shaper.setDrawRange(runInfo.from, runInfo.to); 955 shaper.setDrawRange(runInfo.from, runInfo.to);
956 if (!shaper.shape(&glyphBuffer) || glyphBuffer.isEmpty()) 956 if (!shaper.shape(&glyphBuffer) || glyphBuffer.isEmpty())
957 return 0; 957 return 0;
958 return drawGlyphBuffer(gc, runInfo, glyphBuffer, point); 958 return drawGlyphBuffer(gc, runInfo, glyphBuffer, point);
959 } 959 }
960 960
961 void Font::drawEmphasisMarksForComplexText(GraphicsContext* context, const TextR unPaintInfo& runInfo, const AtomicString& mark, const FloatPoint& point) const 961 void Font::drawEmphasisMarksForComplexText(GraphicsContext* context, const TextR unPaintInfo& runInfo, const AtomicString& mark, const FloatPoint& point) const
962 { 962 {
963 GlyphBuffer glyphBuffer; 963 GlyphBuffer glyphBuffer;
964 964 HarfBuzzShaper shaper(this, runInfo.run, HarfBuzzShaper::ForTextEmphasis);
965 float initialAdvance = getGlyphsAndAdvancesForComplexText(runInfo, glyphBuff er, ForTextEmphasis); 965 shaper.setDrawRange(runInfo.from, runInfo.to);
966 966 if (!shaper.shape(&glyphBuffer) || glyphBuffer.isEmpty())
967 if (glyphBuffer.isEmpty())
968 return; 967 return;
969 968
970 drawEmphasisMarks(context, runInfo, glyphBuffer, mark, FloatPoint(point.x() + initialAdvance, point.y())); 969 drawEmphasisMarks(context, runInfo, glyphBuffer, mark, point);
971 }
972
973 float Font::getGlyphsAndAdvancesForComplexText(const TextRunPaintInfo& runInfo, GlyphBuffer& glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const
974 {
975 HarfBuzzShaper shaper(this, runInfo.run, HarfBuzzShaper::ForTextEmphasis);
976 shaper.setDrawRange(runInfo.from, runInfo.to);
977 shaper.shape(&glyphBuffer);
978 return 0;
979 } 970 }
980 971
981 float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon tData*>* fallbackFonts, IntRectExtent* glyphBounds) const 972 float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon tData*>* fallbackFonts, IntRectExtent* glyphBounds) const
982 { 973 {
983 HarfBuzzShaper shaper(this, run, HarfBuzzShaper::NotForTextEmphasis, fallbac kFonts); 974 HarfBuzzShaper shaper(this, run, HarfBuzzShaper::NotForTextEmphasis, fallbac kFonts);
984 if (!shaper.shape()) 975 if (!shaper.shape())
985 return 0; 976 return 0;
986 977
987 glyphBounds->setTop(floorf(-shaper.glyphBoundingBox().top())); 978 glyphBounds->setTop(floorf(-shaper.glyphBoundingBox().top()));
988 glyphBounds->setBottom(ceilf(shaper.glyphBoundingBox().bottom())); 979 glyphBounds->setBottom(ceilf(shaper.glyphBoundingBox().bottom()));
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 if (delta <= 0) 1177 if (delta <= 0)
1187 break; 1178 break;
1188 } 1179 }
1189 } 1180 }
1190 } 1181 }
1191 1182
1192 return offset; 1183 return offset;
1193 } 1184 }
1194 1185
1195 } // namespace blink 1186 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698