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

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

Issue 1773403002: Update SVG text layout to use shaped glyph data & go fast (O(n^2)->O(n)) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@1773353003
Patch Set: Fix TestExpectations collision Created 4 years, 9 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 28 matching lines...) Expand all
39 #include "wtf/HashSet.h" 39 #include "wtf/HashSet.h"
40 #include "wtf/MathExtras.h" 40 #include "wtf/MathExtras.h"
41 #include "wtf/text/CharacterNames.h" 41 #include "wtf/text/CharacterNames.h"
42 42
43 class SkCanvas; 43 class SkCanvas;
44 class SkPaint; 44 class SkPaint;
45 struct SkPoint; 45 struct SkPoint;
46 46
47 namespace blink { 47 namespace blink {
48 48
49 struct CharacterRange;
49 class FloatPoint; 50 class FloatPoint;
50 class FloatRect; 51 class FloatRect;
51 class FontFallbackIterator; 52 class FontFallbackIterator;
52 class FontData; 53 class FontData;
53 class FontMetrics; 54 class FontMetrics;
54 class FontSelector; 55 class FontSelector;
55 class GlyphBuffer; 56 class GlyphBuffer;
56 class TextRun; 57 class TextRun;
57 struct TextRunPaintInfo; 58 struct TextRunPaintInfo;
58 59
(...skipping 20 matching lines...) Expand all
79 bool drawText(SkCanvas*, const TextRunPaintInfo&, const FloatPoint&, float d eviceScaleFactor, const SkPaint&) const; 80 bool drawText(SkCanvas*, const TextRunPaintInfo&, const FloatPoint&, float d eviceScaleFactor, const SkPaint&) const;
80 bool drawBidiText(SkCanvas*, const TextRunPaintInfo&, const FloatPoint&, Cus tomFontNotReadyAction, float deviceScaleFactor, const SkPaint&) const; 81 bool drawBidiText(SkCanvas*, const TextRunPaintInfo&, const FloatPoint&, Cus tomFontNotReadyAction, float deviceScaleFactor, const SkPaint&) const;
81 void drawEmphasisMarks(SkCanvas*, const TextRunPaintInfo&, const AtomicStrin g& mark, const FloatPoint&, float deviceScaleFactor, const SkPaint&) const; 82 void drawEmphasisMarks(SkCanvas*, const TextRunPaintInfo&, const AtomicStrin g& mark, const FloatPoint&, float deviceScaleFactor, const SkPaint&) const;
82 83
83 // Glyph bounds will be the minimum rect containing all glyph strokes, in co ordinates using 84 // Glyph bounds will be the minimum rect containing all glyph strokes, in co ordinates using
84 // (<text run x position>, <baseline position>) as the origin. 85 // (<text run x position>, <baseline position>) as the origin.
85 float width(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = nullptr, FloatRect* glyphBounds = nullptr) const; 86 float width(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = nullptr, FloatRect* glyphBounds = nullptr) const;
86 87
87 int offsetForPosition(const TextRun&, float position, bool includePartialGly phs) const; 88 int offsetForPosition(const TextRun&, float position, bool includePartialGly phs) const;
88 FloatRect selectionRectForText(const TextRun&, const FloatPoint&, int h, int from = 0, int to = -1, bool accountForGlyphBounds = false) const; 89 FloatRect selectionRectForText(const TextRun&, const FloatPoint&, int h, int from = 0, int to = -1, bool accountForGlyphBounds = false) const;
90 Vector<CharacterRange> individualCharacterRanges(const TextRun&, int from, i nt to) const;
89 91
90 // Metrics that we query the FontFallbackList for. 92 // Metrics that we query the FontFallbackList for.
91 const FontMetrics& fontMetrics() const 93 const FontMetrics& fontMetrics() const
92 { 94 {
93 RELEASE_ASSERT(primaryFont()); 95 RELEASE_ASSERT(primaryFont());
94 return primaryFont()->fontMetrics(); 96 return primaryFont()->fontMetrics();
95 } 97 }
96 float spaceWidth() const { return primaryFont()->spaceWidth() + fontDescript ion().letterSpacing(); } 98 float spaceWidth() const { return primaryFont()->spaceWidth() + fontDescript ion().letterSpacing(); }
97 float tabWidth(const SimpleFontData&, const TabSize&, float position) const; 99 float tabWidth(const SimpleFontData&, const TabSize&, float position) const;
98 float tabWidth(const TabSize& tabSize, float position) const { return tabWid th(*primaryFont(), tabSize, position); } 100 float tabWidth(const TabSize& tabSize, float position) const { return tabWid th(*primaryFont(), tabSize, position); }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 // if the distance to the next tab stop is less than that, advance an additi onal tab stop. 197 // if the distance to the next tab stop is less than that, advance an additi onal tab stop.
196 if (distanceToTabStop < std::max(fontDescription().letterSpacing(), LayoutUn it::epsilon())) 198 if (distanceToTabStop < std::max(fontDescription().letterSpacing(), LayoutUn it::epsilon()))
197 distanceToTabStop += baseTabWidth; 199 distanceToTabStop += baseTabWidth;
198 200
199 return distanceToTabStop; 201 return distanceToTabStop;
200 } 202 }
201 203
202 } // namespace blink 204 } // namespace blink
203 205
204 #endif 206 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/svg/SVGTextMetricsBuilder.cpp ('k') | third_party/WebKit/Source/platform/fonts/Font.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698