| OLD | NEW |
| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // The complex path is more restrictive about returning fallback fonts t
han the simple path, so we need an explicit test to make their behaviors match. | 144 // The complex path is more restrictive about returning fallback fonts t
han the simple path, so we need an explicit test to make their behaviors match. |
| 145 if (!FontPlatformFeatures::canReturnFallbackFontsForComplexText()) | 145 if (!FontPlatformFeatures::canReturnFallbackFontsForComplexText()) |
| 146 fallbackFonts = 0; | 146 fallbackFonts = 0; |
| 147 // The simple path can optimize the case where glyph overflow is not obs
ervable. | 147 // The simple path can optimize the case where glyph overflow is not obs
ervable. |
| 148 if (codePathToUse != SimpleWithGlyphOverflowPath && (glyphOverflow && !g
lyphOverflow->computeBounds)) | 148 if (codePathToUse != SimpleWithGlyphOverflowPath && (glyphOverflow && !g
lyphOverflow->computeBounds)) |
| 149 glyphOverflow = 0; | 149 glyphOverflow = 0; |
| 150 } | 150 } |
| 151 | 151 |
| 152 bool hasKerningOrLigatures = fontDescription().typesettingFeatures() & (Kern
ing | Ligatures); | 152 bool hasKerningOrLigatures = fontDescription().typesettingFeatures() & (Kern
ing | Ligatures); |
| 153 bool hasWordSpacingOrLetterSpacing = fontDescription().wordSpacing() || font
Description().letterSpacing(); | 153 bool hasWordSpacingOrLetterSpacing = fontDescription().wordSpacing() || font
Description().letterSpacing(); |
| 154 float* cacheEntry = m_fontFallbackList->widthCache().add(run, std::numeric_l
imits<float>::quiet_NaN(), hasKerningOrLigatures, hasWordSpacingOrLetterSpacing,
glyphOverflow); | 154 bool isCacheable = (codePathToUse == ComplexPath || hasKerningOrLigatures) |
| 155 && !hasWordSpacingOrLetterSpacing // Word spacing and letter spacing can
change the width of a word. |
| 156 && !glyphOverflow // Since this is just a width cache, we don't have eno
ugh information to satisfy glyph queries. |
| 157 && !run.allowTabs(); // If we allow tabs and a tab occurs inside a word,
the width of the word varies based on its position on the line. |
| 158 |
| 159 float* cacheEntry = isCacheable |
| 160 ? m_fontFallbackList->widthCache().add(run, std::numeric_limits<float>::
quiet_NaN()) |
| 161 : 0; |
| 155 if (cacheEntry && !std::isnan(*cacheEntry)) | 162 if (cacheEntry && !std::isnan(*cacheEntry)) |
| 156 return *cacheEntry; | 163 return *cacheEntry; |
| 157 | 164 |
| 158 float result; | 165 float result; |
| 159 if (codePathToUse == ComplexPath) | 166 if (codePathToUse == ComplexPath) |
| 160 result = floatWidthForComplexText(run, fallbackFonts, glyphOverflow); | 167 result = floatWidthForComplexText(run, fallbackFonts, glyphOverflow); |
| 161 else | 168 else |
| 162 result = floatWidthForSimpleText(run, fallbackFonts, glyphOverflow); | 169 result = floatWidthForSimpleText(run, fallbackFonts, glyphOverflow); |
| 163 | 170 |
| 164 if (cacheEntry && (!fallbackFonts || fallbackFonts->isEmpty())) | 171 if (cacheEntry && (!fallbackFonts || fallbackFonts->isEmpty())) |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 if (delta <= 0) | 827 if (delta <= 0) |
| 821 break; | 828 break; |
| 822 } | 829 } |
| 823 } | 830 } |
| 824 } | 831 } |
| 825 | 832 |
| 826 return offset; | 833 return offset; |
| 827 } | 834 } |
| 828 | 835 |
| 829 } | 836 } |
| OLD | NEW |