OLD | NEW |
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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 mutable unsigned m_canShapeWordByWord : 1; | 195 mutable unsigned m_canShapeWordByWord : 1; |
196 mutable unsigned m_shapeWordByWordComputed : 1; | 196 mutable unsigned m_shapeWordByWordComputed : 1; |
197 | 197 |
198 // For m_fontDescription & m_fontFallbackList access. | 198 // For m_fontDescription & m_fontFallbackList access. |
199 friend class CachingWordShaper; | 199 friend class CachingWordShaper; |
200 }; | 200 }; |
201 | 201 |
202 inline Font::~Font() {} | 202 inline Font::~Font() {} |
203 | 203 |
204 inline const SimpleFontData* Font::primaryFont() const { | 204 inline const SimpleFontData* Font::primaryFont() const { |
205 ASSERT(m_fontFallbackList); | 205 DCHECK(m_fontFallbackList); |
206 return m_fontFallbackList->primarySimpleFontData(m_fontDescription); | 206 return m_fontFallbackList->primarySimpleFontData(m_fontDescription); |
207 } | 207 } |
208 | 208 |
209 inline const FontData* Font::fontDataAt(unsigned index) const { | 209 inline const FontData* Font::fontDataAt(unsigned index) const { |
210 ASSERT(m_fontFallbackList); | 210 DCHECK(m_fontFallbackList); |
211 return m_fontFallbackList->fontDataAt(m_fontDescription, index); | 211 return m_fontFallbackList->fontDataAt(m_fontDescription, index); |
212 } | 212 } |
213 | 213 |
214 inline FontSelector* Font::getFontSelector() const { | 214 inline FontSelector* Font::getFontSelector() const { |
215 return m_fontFallbackList ? m_fontFallbackList->getFontSelector() : 0; | 215 return m_fontFallbackList ? m_fontFallbackList->getFontSelector() : 0; |
216 } | 216 } |
217 | 217 |
218 inline float Font::tabWidth(const SimpleFontData* fontData, | 218 inline float Font::tabWidth(const SimpleFontData* fontData, |
219 const TabSize& tabSize, | 219 const TabSize& tabSize, |
220 float position) const { | 220 float position) const { |
221 if (!fontData) | 221 if (!fontData) |
222 return getFontDescription().letterSpacing(); | 222 return getFontDescription().letterSpacing(); |
223 float baseTabWidth = tabSize.getPixelSize(fontData->spaceWidth()); | 223 float baseTabWidth = tabSize.getPixelSize(fontData->spaceWidth()); |
224 if (!baseTabWidth) | 224 if (!baseTabWidth) |
225 return getFontDescription().letterSpacing(); | 225 return getFontDescription().letterSpacing(); |
226 float distanceToTabStop = baseTabWidth - fmodf(position, baseTabWidth); | 226 float distanceToTabStop = baseTabWidth - fmodf(position, baseTabWidth); |
227 | 227 |
228 // Let the minimum width be the half of the space width so that it's always | 228 // Let the minimum width be the half of the space width so that it's always |
229 // recognizable. if the distance to the next tab stop is less than that, | 229 // recognizable. if the distance to the next tab stop is less than that, |
230 // advance an additional tab stop. | 230 // advance an additional tab stop. |
231 if (distanceToTabStop < fontData->spaceWidth() / 2) | 231 if (distanceToTabStop < fontData->spaceWidth() / 2) |
232 distanceToTabStop += baseTabWidth; | 232 distanceToTabStop += baseTabWidth; |
233 | 233 |
234 return distanceToTabStop; | 234 return distanceToTabStop; |
235 } | 235 } |
236 | 236 |
237 } // namespace blink | 237 } // namespace blink |
238 | 238 |
239 #endif | 239 #endif |
OLD | NEW |