| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 mutable unsigned can_shape_word_by_word_ : 1; | 198 mutable unsigned can_shape_word_by_word_ : 1; |
| 199 mutable unsigned shape_word_by_word_computed_ : 1; | 199 mutable unsigned shape_word_by_word_computed_ : 1; |
| 200 | 200 |
| 201 // For m_fontDescription & m_fontFallbackList access. | 201 // For m_fontDescription & m_fontFallbackList access. |
| 202 friend class CachingWordShaper; | 202 friend class CachingWordShaper; |
| 203 }; | 203 }; |
| 204 | 204 |
| 205 inline Font::~Font() {} | 205 inline Font::~Font() {} |
| 206 | 206 |
| 207 inline const SimpleFontData* Font::PrimaryFont() const { | 207 inline const SimpleFontData* Font::PrimaryFont() const { |
| 208 ASSERT(font_fallback_list_); | 208 DCHECK(font_fallback_list_); |
| 209 return font_fallback_list_->PrimarySimpleFontData(font_description_); | 209 return font_fallback_list_->PrimarySimpleFontData(font_description_); |
| 210 } | 210 } |
| 211 | 211 |
| 212 inline const FontData* Font::FontDataAt(unsigned index) const { | 212 inline const FontData* Font::FontDataAt(unsigned index) const { |
| 213 ASSERT(font_fallback_list_); | 213 DCHECK(font_fallback_list_); |
| 214 return font_fallback_list_->FontDataAt(font_description_, index); | 214 return font_fallback_list_->FontDataAt(font_description_, index); |
| 215 } | 215 } |
| 216 | 216 |
| 217 inline FontSelector* Font::GetFontSelector() const { | 217 inline FontSelector* Font::GetFontSelector() const { |
| 218 return font_fallback_list_ ? font_fallback_list_->GetFontSelector() : 0; | 218 return font_fallback_list_ ? font_fallback_list_->GetFontSelector() : 0; |
| 219 } | 219 } |
| 220 | 220 |
| 221 inline float Font::TabWidth(const SimpleFontData* font_data, | 221 inline float Font::TabWidth(const SimpleFontData* font_data, |
| 222 const TabSize& tab_size, | 222 const TabSize& tab_size, |
| 223 float position) const { | 223 float position) const { |
| 224 if (!font_data) | 224 if (!font_data) |
| 225 return GetFontDescription().LetterSpacing(); | 225 return GetFontDescription().LetterSpacing(); |
| 226 float base_tab_width = tab_size.GetPixelSize(font_data->SpaceWidth()); | 226 float base_tab_width = tab_size.GetPixelSize(font_data->SpaceWidth()); |
| 227 if (!base_tab_width) | 227 if (!base_tab_width) |
| 228 return GetFontDescription().LetterSpacing(); | 228 return GetFontDescription().LetterSpacing(); |
| 229 float distance_to_tab_stop = base_tab_width - fmodf(position, base_tab_width); | 229 float distance_to_tab_stop = base_tab_width - fmodf(position, base_tab_width); |
| 230 | 230 |
| 231 // Let the minimum width be the half of the space width so that it's always | 231 // Let the minimum width be the half of the space width so that it's always |
| 232 // recognizable. if the distance to the next tab stop is less than that, | 232 // recognizable. if the distance to the next tab stop is less than that, |
| 233 // advance an additional tab stop. | 233 // advance an additional tab stop. |
| 234 if (distance_to_tab_stop < font_data->SpaceWidth() / 2) | 234 if (distance_to_tab_stop < font_data->SpaceWidth() / 2) |
| 235 distance_to_tab_stop += base_tab_width; | 235 distance_to_tab_stop += base_tab_width; |
| 236 | 236 |
| 237 return distance_to_tab_stop; | 237 return distance_to_tab_stop; |
| 238 } | 238 } |
| 239 | 239 |
| 240 } // namespace blink | 240 } // namespace blink |
| 241 | 241 |
| 242 #endif | 242 #endif |
| OLD | NEW |