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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/Font.h

Issue 2416603002: Add ability to compute text intercepts to Font (Closed)
Patch Set: Rebased Created 4 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) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 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, 2007, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2006, 2007, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) 2008 Holger Hans Peter Freyther 6 * Copyright (C) 2008 Holger Hans Peter Freyther
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 CustomFontNotReadyAction, 94 CustomFontNotReadyAction,
95 float deviceScaleFactor, 95 float deviceScaleFactor,
96 const SkPaint&) const; 96 const SkPaint&) const;
97 void drawEmphasisMarks(SkCanvas*, 97 void drawEmphasisMarks(SkCanvas*,
98 const TextRunPaintInfo&, 98 const TextRunPaintInfo&,
99 const AtomicString& mark, 99 const AtomicString& mark,
100 const FloatPoint&, 100 const FloatPoint&,
101 float deviceScaleFactor, 101 float deviceScaleFactor,
102 const SkPaint&) const; 102 const SkPaint&) const;
103 103
104 // This method follows the behavior and allocation model of the underlying
105 // Skia function: Return the number of intervals that intersect the intercept
106 // along the axis of the advance. The return count is zero or a multiple of
107 // two, and is at most the number of glyphs * 2 in TextRun part of
pdr. 2016/10/14 04:40:56 Super nit: Add "the", remove the second period. ".
drott 2016/10/14 15:16:44 I changed the signature of this method and the com
108 // TextRunPaintInfo.. The caller may pass nullptr for intervals to determine
109 // the size of the interval array.
110 // TODO(drott): crbug.com/655154 Fix this for upright in vertical.
111 int getTextIntercepts(SkCanvas*,
f(malita) 2016/10/13 18:09:19 SkCanvas param doesn't seem needed.
drott 2016/10/14 15:15:34 Ah true, thanks - I initially thought I needed it,
112 const TextRunPaintInfo&,
113 float deviceScaleFactor,
114 const SkPaint&,
115 const SkScalar* bounds,
116 SkScalar* intervals) const;
f(malita) 2016/10/13 18:09:19 I'm not necessarily opposed to following Skia's si
drott 2016/10/14 15:15:34 Good idea, looks better and less alien on the Blin
117
104 // Glyph bounds will be the minimum rect containing all glyph strokes, in 118 // Glyph bounds will be the minimum rect containing all glyph strokes, in
105 // coordinates using (<text run x position>, <baseline position>) as the 119 // coordinates using (<text run x position>, <baseline position>) as the
106 // origin. 120 // origin.
107 float width(const TextRun&, 121 float width(const TextRun&,
108 HashSet<const SimpleFontData*>* fallbackFonts = nullptr, 122 HashSet<const SimpleFontData*>* fallbackFonts = nullptr,
109 FloatRect* glyphBounds = nullptr) const; 123 FloatRect* glyphBounds = nullptr) const;
110 124
111 int offsetForPosition(const TextRun&, 125 int offsetForPosition(const TextRun&,
112 float position, 126 float position,
113 bool includePartialGlyphs) const; 127 bool includePartialGlyphs) const;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 // advance an additional tab stop. 271 // advance an additional tab stop.
258 if (distanceToTabStop < fontData.spaceWidth() / 2) 272 if (distanceToTabStop < fontData.spaceWidth() / 2)
259 distanceToTabStop += baseTabWidth; 273 distanceToTabStop += baseTabWidth;
260 274
261 return distanceToTabStop; 275 return distanceToTabStop;
262 } 276 }
263 277
264 } // namespace blink 278 } // namespace blink
265 279
266 #endif 280 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/fonts/Font.cpp » ('j') | third_party/WebKit/Source/platform/fonts/Font.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698