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

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: Nits addressed 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 struct TextIntercept {
105 float m_begin, m_end;
106 };
107
108 // Compute the text intercepts along the axis of the advance and write them
109 // into the specified Vector of TextIntercepts. The number of those is zero or
110 // a multiple of two, and is at most the number of glyphs * 2 in the TextRun
111 // part of TextRunPaintInfo. Specify bounds for the upper and lower extend of
112 // a line crossing through the text, parallel to the baseline.
113 // TODO(drott): crbug.com/655154 Fix this for
114 // upright in vertical.
115 void getTextIntercepts(const TextRunPaintInfo&,
116 float deviceScaleFactor,
117 const SkPaint&,
118 const std::tuple<float, float>& bounds,
119 Vector<TextIntercept>&) const;
120
104 // Glyph bounds will be the minimum rect containing all glyph strokes, in 121 // Glyph bounds will be the minimum rect containing all glyph strokes, in
105 // coordinates using (<text run x position>, <baseline position>) as the 122 // coordinates using (<text run x position>, <baseline position>) as the
106 // origin. 123 // origin.
107 float width(const TextRun&, 124 float width(const TextRun&,
108 HashSet<const SimpleFontData*>* fallbackFonts = nullptr, 125 HashSet<const SimpleFontData*>* fallbackFonts = nullptr,
109 FloatRect* glyphBounds = nullptr) const; 126 FloatRect* glyphBounds = nullptr) const;
110 127
111 int offsetForPosition(const TextRun&, 128 int offsetForPosition(const TextRun&,
112 float position, 129 float position,
113 bool includePartialGlyphs) const; 130 bool includePartialGlyphs) const;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 // advance an additional tab stop. 274 // advance an additional tab stop.
258 if (distanceToTabStop < fontData.spaceWidth() / 2) 275 if (distanceToTabStop < fontData.spaceWidth() / 2)
259 distanceToTabStop += baseTabWidth; 276 distanceToTabStop += baseTabWidth;
260 277
261 return distanceToTabStop; 278 return distanceToTabStop;
262 } 279 }
263 280
264 } // namespace blink 281 } // namespace blink
265 282
266 #endif 283 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/BUILD.gn ('k') | third_party/WebKit/Source/platform/fonts/Font.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698