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

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

Issue 642863005: Consolidate Font::codePath kerning & ligatures exceptions (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: review comments 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/svg/SVGTextMetricsBuilder.cpp ('k') | Source/platform/fonts/Font.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 const SimpleFontData* primaryFont() const; 124 const SimpleFontData* primaryFont() const;
125 const FontData* fontDataAt(unsigned) const; 125 const FontData* fontDataAt(unsigned) const;
126 inline GlyphData glyphDataForCharacter(UChar32& c, bool mirror, bool spaceNo rmalize = false, FontDataVariant variant = AutoVariant) const 126 inline GlyphData glyphDataForCharacter(UChar32& c, bool mirror, bool spaceNo rmalize = false, FontDataVariant variant = AutoVariant) const
127 { 127 {
128 return glyphDataAndPageForCharacter(c, mirror, spaceNormalize, variant). first; 128 return glyphDataAndPageForCharacter(c, mirror, spaceNormalize, variant). first;
129 } 129 }
130 130
131 std::pair<GlyphData, GlyphPage*> glyphDataAndPageForCharacter(UChar32&, bool mirror, bool normalizeSpace = false, FontDataVariant = AutoVariant) const; 131 std::pair<GlyphData, GlyphPage*> glyphDataAndPageForCharacter(UChar32&, bool mirror, bool normalizeSpace = false, FontDataVariant = AutoVariant) const;
132 bool primaryFontHasGlyphForCharacter(UChar32) const; 132 bool primaryFontHasGlyphForCharacter(UChar32) const;
133 133
134 CodePath codePath(const TextRun&) const; 134 CodePath codePath(const TextRunPaintInfo&) const;
135 135
136 PassTextBlobPtr buildTextBlob(const TextRunPaintInfo&, const FloatPoint& tex tOrigin, bool couldUseLCDRenderedText, CustomFontNotReadyAction = DoNotPaintIfFo ntNotReady) const; 136 PassTextBlobPtr buildTextBlob(const TextRunPaintInfo&, const FloatPoint& tex tOrigin, bool couldUseLCDRenderedText, CustomFontNotReadyAction = DoNotPaintIfFo ntNotReady) const;
137 void drawTextBlob(GraphicsContext*, const SkTextBlob*, const SkPoint& origin ) const; 137 void drawTextBlob(GraphicsContext*, const SkTextBlob*, const SkPoint& origin ) const;
138 138
139 private: 139 private:
140 enum ForTextEmphasisOrNot { NotForTextEmphasis, ForTextEmphasis }; 140 enum ForTextEmphasisOrNot { NotForTextEmphasis, ForTextEmphasis };
141 141
142 // Returns the initial in-stream advance. 142 // Returns the initial in-stream advance.
143 float getGlyphsAndAdvancesForSimpleText(const TextRunPaintInfo&, GlyphBuffer &, ForTextEmphasisOrNot = NotForTextEmphasis) const; 143 float getGlyphsAndAdvancesForSimpleText(const TextRunPaintInfo&, GlyphBuffer &, ForTextEmphasisOrNot = NotForTextEmphasis) const;
144 float drawSimpleText(GraphicsContext*, const TextRunPaintInfo&, const FloatP oint&) const; 144 float drawSimpleText(GraphicsContext*, const TextRunPaintInfo&, const FloatP oint&) const;
(...skipping 15 matching lines...) Expand all
160 int offsetForPositionForComplexText(const TextRun&, float position, bool inc ludePartialGlyphs) const; 160 int offsetForPositionForComplexText(const TextRun&, float position, bool inc ludePartialGlyphs) const;
161 FloatRect selectionRectForComplexText(const TextRun&, const FloatPoint&, int h, int from, int to) const; 161 FloatRect selectionRectForComplexText(const TextRun&, const FloatPoint&, int h, int from, int to) const;
162 162
163 PassTextBlobPtr buildTextBlobForSimpleText(const TextRunPaintInfo&, const Fl oatPoint& textOrigin, bool couldUseLCDRenderedText) const; 163 PassTextBlobPtr buildTextBlobForSimpleText(const TextRunPaintInfo&, const Fl oatPoint& textOrigin, bool couldUseLCDRenderedText) const;
164 PassTextBlobPtr buildTextBlob(const GlyphBuffer&, float initialAdvance, cons t FloatRect& bounds, float& advance, bool couldUseLCD) const; 164 PassTextBlobPtr buildTextBlob(const GlyphBuffer&, float initialAdvance, cons t FloatRect& bounds, float& advance, bool couldUseLCD) const;
165 165
166 friend struct SimpleShaper; 166 friend struct SimpleShaper;
167 friend class SVGTextRunRenderingContext; 167 friend class SVGTextRunRenderingContext;
168 168
169 public: 169 public:
170 // Useful for debugging the different font rendering code paths.
171 static void setCodePath(CodePath);
172 static CodePath codePath();
173 static CodePath s_codePath;
174
175 FontSelector* fontSelector() const; 170 FontSelector* fontSelector() const;
176 171
177 FontFallbackList* fontList() const { return m_fontFallbackList.get(); } 172 FontFallbackList* fontList() const { return m_fontFallbackList.get(); }
178 173
179 void willUseFontData(UChar32) const; 174 void willUseFontData(UChar32) const;
180 175
181 static FloatRect pixelSnappedSelectionRect(float fromX, float toX, float y, float height); 176 static FloatRect pixelSnappedSelectionRect(float fromX, float toX, float y, float height);
182 private: 177 private:
183 bool loadingCustomFonts() const 178 bool loadingCustomFonts() const
184 { 179 {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 { 220 {
226 if (!tabSize) 221 if (!tabSize)
227 return fontDescription().letterSpacing(); 222 return fontDescription().letterSpacing();
228 float tabWidth = tabSize * fontData.spaceWidth() + fontDescription().letterS pacing(); 223 float tabWidth = tabSize * fontData.spaceWidth() + fontDescription().letterS pacing();
229 return tabWidth - fmodf(position, tabWidth); 224 return tabWidth - fmodf(position, tabWidth);
230 } 225 }
231 226
232 } // namespace blink 227 } // namespace blink
233 228
234 #endif 229 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/SVGTextMetricsBuilder.cpp ('k') | Source/platform/fonts/Font.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698