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

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

Issue 2386333002: reflow comments in platform/fonts (Closed)
Patch Set: comments 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 // Glyph bounds will be the minimum rect containing all glyph strokes, in coor dinates using 104 // Glyph bounds will be the minimum rect containing all glyph strokes, in
105 // (<text run x position>, <baseline position>) as the origin. 105 // coordinates using (<text run x position>, <baseline position>) as the
106 // origin.
106 float width(const TextRun&, 107 float width(const TextRun&,
107 HashSet<const SimpleFontData*>* fallbackFonts = nullptr, 108 HashSet<const SimpleFontData*>* fallbackFonts = nullptr,
108 FloatRect* glyphBounds = nullptr) const; 109 FloatRect* glyphBounds = nullptr) const;
109 110
110 int offsetForPosition(const TextRun&, 111 int offsetForPosition(const TextRun&,
111 float position, 112 float position,
112 bool includePartialGlyphs) const; 113 bool includePartialGlyphs) const;
113 FloatRect selectionRectForText(const TextRun&, 114 FloatRect selectionRectForText(const TextRun&,
114 const FloatPoint&, 115 const FloatPoint&,
115 int h, 116 int h,
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 private: 216 private:
216 bool shouldSkipDrawing() const { 217 bool shouldSkipDrawing() const {
217 return m_fontFallbackList && m_fontFallbackList->shouldSkipDrawing(); 218 return m_fontFallbackList && m_fontFallbackList->shouldSkipDrawing();
218 } 219 }
219 220
220 FontDescription m_fontDescription; 221 FontDescription m_fontDescription;
221 mutable RefPtr<FontFallbackList> m_fontFallbackList; 222 mutable RefPtr<FontFallbackList> m_fontFallbackList;
222 mutable unsigned m_canShapeWordByWord : 1; 223 mutable unsigned m_canShapeWordByWord : 1;
223 mutable unsigned m_shapeWordByWordComputed : 1; 224 mutable unsigned m_shapeWordByWordComputed : 1;
224 225
225 // For accessing buildGlyphBuffer and retrieving fonts used in rendering a nod e. 226 // For accessing buildGlyphBuffer and retrieving fonts used in rendering a
227 // node.
226 friend class InspectorCSSAgent; 228 friend class InspectorCSSAgent;
227 }; 229 };
228 230
229 inline Font::~Font() {} 231 inline Font::~Font() {}
230 232
231 inline const SimpleFontData* Font::primaryFont() const { 233 inline const SimpleFontData* Font::primaryFont() const {
232 ASSERT(m_fontFallbackList); 234 ASSERT(m_fontFallbackList);
233 return m_fontFallbackList->primarySimpleFontData(m_fontDescription); 235 return m_fontFallbackList->primarySimpleFontData(m_fontDescription);
234 } 236 }
235 237
236 inline const FontData* Font::fontDataAt(unsigned index) const { 238 inline const FontData* Font::fontDataAt(unsigned index) const {
237 ASSERT(m_fontFallbackList); 239 ASSERT(m_fontFallbackList);
238 return m_fontFallbackList->fontDataAt(m_fontDescription, index); 240 return m_fontFallbackList->fontDataAt(m_fontDescription, index);
239 } 241 }
240 242
241 inline FontSelector* Font::getFontSelector() const { 243 inline FontSelector* Font::getFontSelector() const {
242 return m_fontFallbackList ? m_fontFallbackList->getFontSelector() : 0; 244 return m_fontFallbackList ? m_fontFallbackList->getFontSelector() : 0;
243 } 245 }
244 246
245 inline float Font::tabWidth(const SimpleFontData& fontData, 247 inline float Font::tabWidth(const SimpleFontData& fontData,
246 const TabSize& tabSize, 248 const TabSize& tabSize,
247 float position) const { 249 float position) const {
248 float baseTabWidth = tabSize.getPixelSize(fontData.spaceWidth()); 250 float baseTabWidth = tabSize.getPixelSize(fontData.spaceWidth());
249 if (!baseTabWidth) 251 if (!baseTabWidth)
250 return getFontDescription().letterSpacing(); 252 return getFontDescription().letterSpacing();
251 float distanceToTabStop = baseTabWidth - fmodf(position, baseTabWidth); 253 float distanceToTabStop = baseTabWidth - fmodf(position, baseTabWidth);
252 254
253 // Let the minimum width be the half of the space width so that it's always re cognizable. 255 // Let the minimum width be the half of the space width so that it's always
254 // if the distance to the next tab stop is less than that, advance an addition al tab stop. 256 // recognizable. if the distance to the next tab stop is less than that,
257 // advance an additional tab stop.
255 if (distanceToTabStop < fontData.spaceWidth() / 2) 258 if (distanceToTabStop < fontData.spaceWidth() / 2)
256 distanceToTabStop += baseTabWidth; 259 distanceToTabStop += baseTabWidth;
257 260
258 return distanceToTabStop; 261 return distanceToTabStop;
259 } 262 }
260 263
261 } // namespace blink 264 } // namespace blink
262 265
263 #endif 266 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/AlternateFontFamily.h ('k') | third_party/WebKit/Source/platform/fonts/Font.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698