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

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

Issue 141433026: Font metrics, version 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Adding Layout tests. Should work for simple text. Created 6 years, 10 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 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 #if ENABLE(SVG_FONTS) 179 #if ENABLE(SVG_FONTS)
180 if (TextRun::RenderingContext* renderingContext = run.renderingContext()) 180 if (TextRun::RenderingContext* renderingContext = run.renderingContext())
181 return renderingContext->floatWidthUsingSVGFont(*this, run, charsConsume d, glyphName); 181 return renderingContext->floatWidthUsingSVGFont(*this, run, charsConsume d, glyphName);
182 #endif 182 #endif
183 183
184 charsConsumed = run.length(); 184 charsConsumed = run.length();
185 glyphName = ""; 185 glyphName = "";
186 return width(run); 186 return width(run);
187 } 187 }
188 188
189 FloatRect Font::selectionRectForText(const TextRun& run, const FloatPoint& point , int h, int from, int to) const 189 FloatRect Font::selectionRectForText(const TextRun& run, const FloatPoint& point , int h, int from, int to, bool accountForGlyphBounds) const
190 { 190 {
191 to = (to == -1 ? run.length() : to); 191 to = (to == -1 ? run.length() : to);
192 192
193 CodePath codePathToUse = codePath(run); 193 CodePath codePathToUse = codePath(run);
194 // FIXME: Use the fast code path once it handles partial runs with kerning a nd ligatures. See http://webkit.org/b/100050 194 // FIXME: Use the fast code path once it handles partial runs with kerning a nd ligatures. See http://webkit.org/b/100050
195 if (codePathToUse != ComplexPath && typesettingFeatures() && (from || to != run.length())) 195 if (codePathToUse != ComplexPath && typesettingFeatures() && (from || to != run.length()))
196 codePathToUse = ComplexPath; 196 codePathToUse = ComplexPath;
197 197
198 if (codePathToUse != ComplexPath) 198 if (codePathToUse != ComplexPath)
199 return selectionRectForSimpleText(run, point, h, from, to); 199 return selectionRectForSimpleText(run, point, h, from, to, accountForGly phBounds);
200 200
201 return selectionRectForComplexText(run, point, h, from, to); 201 return selectionRectForComplexText(run, point, h, from, to);
202 } 202 }
203 203
204 int Font::offsetForPosition(const TextRun& run, float x, bool includePartialGlyp hs) const 204 int Font::offsetForPosition(const TextRun& run, float x, bool includePartialGlyp hs) const
205 { 205 {
206 // FIXME: Use the fast code path once it handles partial runs with kerning a nd ligatures. See http://webkit.org/b/100050 206 // FIXME: Use the fast code path once it handles partial runs with kerning a nd ligatures. See http://webkit.org/b/100050
207 if (codePath(run) != ComplexPath && !typesettingFeatures()) 207 if (codePath(run) != ComplexPath && !typesettingFeatures())
208 return offsetForPositionForSimpleText(run, x, includePartialGlyphs); 208 return offsetForPositionForSimpleText(run, x, includePartialGlyphs);
209 209
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 } 270 }
271 271
272 void Font::willUseFontData() const 272 void Font::willUseFontData() const
273 { 273 {
274 const FontFamily& family = fontDescription().family(); 274 const FontFamily& family = fontDescription().family();
275 if (m_fontFallbackList && m_fontFallbackList->fontSelector() && !family.fami lyIsEmpty()) 275 if (m_fontFallbackList && m_fontFallbackList->fontSelector() && !family.fami lyIsEmpty())
276 m_fontFallbackList->fontSelector()->willUseFontData(fontDescription(), f amily.family()); 276 m_fontFallbackList->fontSelector()->willUseFontData(fontDescription(), f amily.family());
277 } 277 }
278 278
279 } 279 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698