Chromium Code Reviews| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 0x212B, 0x213B, 0x2150, 0x2151, 0x2152, 0x217F, 0x2189, 0x2307, 0x2312, 0x23 CE, | 71 0x212B, 0x213B, 0x2150, 0x2151, 0x2152, 0x217F, 0x2189, 0x2307, 0x2312, 0x23 CE, |
| 72 0x2423, 0x25A0, 0x25A1, 0x25A2, 0x25AA, 0x25AB, 0x25B1, 0x25B2, 0x25B3, 0x25 B6, | 72 0x2423, 0x25A0, 0x25A1, 0x25A2, 0x25AA, 0x25AB, 0x25B1, 0x25B2, 0x25B3, 0x25 B6, |
| 73 0x25B7, 0x25BC, 0x25BD, 0x25C0, 0x25C1, 0x25C6, 0x25C7, 0x25C9, 0x25CB, 0x25 CC, | 73 0x25B7, 0x25BC, 0x25BD, 0x25C0, 0x25C1, 0x25C6, 0x25C7, 0x25C9, 0x25CB, 0x25 CC, |
| 74 0x25EF, 0x2605, 0x2606, 0x260E, 0x2616, 0x2617, 0x2640, 0x2642, 0x26A0, 0x26 BD, | 74 0x25EF, 0x2605, 0x2606, 0x260E, 0x2616, 0x2617, 0x2640, 0x2642, 0x26A0, 0x26 BD, |
| 75 0x26BE, 0x2713, 0x271A, 0x273F, 0x2740, 0x2756, 0x2B1A, 0xFE10, 0xFE11, 0xFE 12, | 75 0x26BE, 0x2713, 0x271A, 0x273F, 0x2740, 0x2756, 0x2B1A, 0xFE10, 0xFE11, 0xFE 12, |
| 76 0xFE19, 0xFF1D, | 76 0xFE19, 0xFF1D, |
| 77 // Emoji. | 77 // Emoji. |
| 78 0x1F100 | 78 0x1F100 |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 Font::CodePath Font::s_codePath = Auto; | 81 CodePath Font::s_codePath = AutoPath; |
| 82 | 82 |
| 83 TypesettingFeatures Font::s_defaultTypesettingFeatures = 0; | 83 TypesettingFeatures Font::s_defaultTypesettingFeatures = 0; |
| 84 | 84 |
| 85 // ============================================================================= =============== | 85 // ============================================================================= =============== |
| 86 // Font Implementation (Cross-Platform Portion) | 86 // Font Implementation (Cross-Platform Portion) |
| 87 // ============================================================================= =============== | 87 // ============================================================================= =============== |
| 88 | 88 |
| 89 Font::Font() | 89 Font::Font() |
| 90 : m_letterSpacing(0) | 90 : m_letterSpacing(0) |
| 91 , m_wordSpacing(0) | 91 , m_wordSpacing(0) |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 } | 168 } |
| 169 | 169 |
| 170 void Font::drawText(GraphicsContext* context, const TextRunPaintInfo& runInfo, c onst FloatPoint& point, CustomFontNotReadyAction customFontNotReadyAction) const | 170 void Font::drawText(GraphicsContext* context, const TextRunPaintInfo& runInfo, c onst FloatPoint& point, CustomFontNotReadyAction customFontNotReadyAction) const |
| 171 { | 171 { |
| 172 // Don't draw anything while we are using custom fonts that are in the proce ss of loading, | 172 // Don't draw anything while we are using custom fonts that are in the proce ss of loading, |
| 173 // except if the 'force' argument is set to true (in which case it will use a fallback | 173 // except if the 'force' argument is set to true (in which case it will use a fallback |
| 174 // font). | 174 // font). |
| 175 if (loadingCustomFonts() && customFontNotReadyAction == DoNotPaintIfFontNotR eady) | 175 if (loadingCustomFonts() && customFontNotReadyAction == DoNotPaintIfFontNotR eady) |
| 176 return; | 176 return; |
| 177 | 177 |
| 178 CodePath codePathToUse = codePath(runInfo.run); | 178 CodePath codePathToUse = runInfo.run.characterScanForCodePathValue(); |
| 179 | |
| 180 if (codePathToUse == AutoPath) | |
| 181 codePathToUse = codePath(runInfo.run); | |
| 182 | |
| 179 // FIXME: Use the fast code path once it handles partial runs with kerning a nd ligatures. See http://webkit.org/b/100050 | 183 // FIXME: Use the fast code path once it handles partial runs with kerning a nd ligatures. See http://webkit.org/b/100050 |
| 180 if (codePathToUse != Complex && typesettingFeatures() && (runInfo.from || ru nInfo.to != runInfo.run.length())) | 184 if (codePathToUse != ComplexPath&& typesettingFeatures() && (runInfo.from || runInfo.to != runInfo.run.length())) |
|
eseidel
2013/12/27 04:36:45
nit: missing space before &&
| |
| 181 codePathToUse = Complex; | 185 codePathToUse = ComplexPath; |
| 182 | 186 |
| 183 if (codePathToUse != Complex) | 187 if (codePathToUse != ComplexPath) |
| 184 return drawSimpleText(context, runInfo, point); | 188 return drawSimpleText(context, runInfo, point); |
| 185 | 189 |
| 186 return drawComplexText(context, runInfo, point); | 190 return drawComplexText(context, runInfo, point); |
| 187 } | 191 } |
| 188 | 192 |
| 189 void Font::drawEmphasisMarks(GraphicsContext* context, const TextRunPaintInfo& r unInfo, const AtomicString& mark, const FloatPoint& point) const | 193 void Font::drawEmphasisMarks(GraphicsContext* context, const TextRunPaintInfo& r unInfo, const AtomicString& mark, const FloatPoint& point) const |
| 190 { | 194 { |
| 191 if (loadingCustomFonts()) | 195 if (loadingCustomFonts()) |
| 192 return; | 196 return; |
| 193 | 197 |
| 194 CodePath codePathToUse = codePath(runInfo.run); | 198 CodePath codePathToUse = runInfo.run.characterScanForCodePathValue(); |
| 199 if (codePathToUse == AutoPath) | |
| 200 codePathToUse = codePath(runInfo.run); | |
| 201 | |
| 195 // FIXME: Use the fast code path once it handles partial runs with kerning a nd ligatures. See http://webkit.org/b/100050 | 202 // FIXME: Use the fast code path once it handles partial runs with kerning a nd ligatures. See http://webkit.org/b/100050 |
| 196 if (codePathToUse != Complex && typesettingFeatures() && (runInfo.from || ru nInfo.to != runInfo.run.length())) | 203 if (codePathToUse != ComplexPath && typesettingFeatures() && (runInfo.from | | runInfo.to != runInfo.run.length())) |
| 197 codePathToUse = Complex; | 204 codePathToUse = ComplexPath; |
| 198 | 205 |
| 199 if (codePathToUse != Complex) | 206 if (codePathToUse != ComplexPath) |
| 200 drawEmphasisMarksForSimpleText(context, runInfo, mark, point); | 207 drawEmphasisMarksForSimpleText(context, runInfo, mark, point); |
| 201 else | 208 else |
| 202 drawEmphasisMarksForComplexText(context, runInfo, mark, point); | 209 drawEmphasisMarksForComplexText(context, runInfo, mark, point); |
| 203 } | 210 } |
| 204 | 211 |
| 205 float Font::width(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFo nts, GlyphOverflow* glyphOverflow) const | 212 float Font::width(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFo nts, GlyphOverflow* glyphOverflow) const |
| 206 { | 213 { |
| 207 CodePath codePathToUse = codePath(run); | 214 CodePath codePathToUse = run.characterScanForCodePathValue(); |
| 208 if (codePathToUse != Complex) { | 215 |
| 216 if (codePathToUse == AutoPath) | |
| 217 codePathToUse = codePath(run); | |
| 218 | |
| 219 if (codePathToUse != ComplexPath) { | |
| 209 // 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. | 220 // 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. |
| 210 if (!canReturnFallbackFontsForComplexText()) | 221 if (!canReturnFallbackFontsForComplexText()) |
| 211 fallbackFonts = 0; | 222 fallbackFonts = 0; |
| 212 // The simple path can optimize the case where glyph overflow is not obs ervable. | 223 // The simple path can optimize the case where glyph overflow is not obs ervable. |
| 213 if (codePathToUse != SimpleWithGlyphOverflow && (glyphOverflow && !glyph Overflow->computeBounds)) | 224 if (codePathToUse != SimpleWithGlyphOverflowPath && (glyphOverflow && !g lyphOverflow->computeBounds)) |
| 214 glyphOverflow = 0; | 225 glyphOverflow = 0; |
| 215 } | 226 } |
| 216 | 227 |
| 217 bool hasKerningOrLigatures = typesettingFeatures() & (Kerning | Ligatures); | 228 bool hasKerningOrLigatures = typesettingFeatures() & (Kerning | Ligatures); |
| 218 bool hasWordSpacingOrLetterSpacing = wordSpacing() || letterSpacing(); | 229 bool hasWordSpacingOrLetterSpacing = wordSpacing() || letterSpacing(); |
| 219 float* cacheEntry = m_fontFallbackList->widthCache().add(run, std::numeric_l imits<float>::quiet_NaN(), hasKerningOrLigatures, hasWordSpacingOrLetterSpacing, glyphOverflow); | 230 float* cacheEntry = m_fontFallbackList->widthCache().add(run, std::numeric_l imits<float>::quiet_NaN(), hasKerningOrLigatures, hasWordSpacingOrLetterSpacing, glyphOverflow); |
| 220 if (cacheEntry && !std::isnan(*cacheEntry)) | 231 if (cacheEntry && !std::isnan(*cacheEntry)) |
| 221 return *cacheEntry; | 232 return *cacheEntry; |
| 222 | 233 |
| 223 float result; | 234 float result; |
| 224 if (codePathToUse == Complex) | 235 if (codePathToUse == ComplexPath) |
| 225 result = floatWidthForComplexText(run, fallbackFonts, glyphOverflow); | 236 result = floatWidthForComplexText(run, fallbackFonts, glyphOverflow); |
| 226 else | 237 else |
| 227 result = floatWidthForSimpleText(run, fallbackFonts, glyphOverflow); | 238 result = floatWidthForSimpleText(run, fallbackFonts, glyphOverflow); |
| 228 | 239 |
| 229 if (cacheEntry && (!fallbackFonts || fallbackFonts->isEmpty())) | 240 if (cacheEntry && (!fallbackFonts || fallbackFonts->isEmpty())) |
| 230 *cacheEntry = result; | 241 *cacheEntry = result; |
| 231 return result; | 242 return result; |
| 232 } | 243 } |
| 233 | 244 |
| 234 float Font::width(const TextRun& run, int& charsConsumed, String& glyphName) con st | 245 float Font::width(const TextRun& run, int& charsConsumed, String& glyphName) con st |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 260 ASSERT_NOT_REACHED(); | 271 ASSERT_NOT_REACHED(); |
| 261 return 0; | 272 return 0; |
| 262 } | 273 } |
| 263 | 274 |
| 264 #endif | 275 #endif |
| 265 | 276 |
| 266 FloatRect Font::selectionRectForText(const TextRun& run, const FloatPoint& point , int h, int from, int to) const | 277 FloatRect Font::selectionRectForText(const TextRun& run, const FloatPoint& point , int h, int from, int to) const |
| 267 { | 278 { |
| 268 to = (to == -1 ? run.length() : to); | 279 to = (to == -1 ? run.length() : to); |
| 269 | 280 |
| 270 CodePath codePathToUse = codePath(run); | 281 CodePath codePathToUse = run.characterScanForCodePathValue(); |
| 282 | |
| 283 if (codePathToUse == AutoPath) | |
| 284 codePathToUse = codePath(run); | |
| 285 | |
| 271 // FIXME: Use the fast code path once it handles partial runs with kerning a nd ligatures. See http://webkit.org/b/100050 | 286 // FIXME: Use the fast code path once it handles partial runs with kerning a nd ligatures. See http://webkit.org/b/100050 |
| 272 if (codePathToUse != Complex && typesettingFeatures() && (from || to != run. length())) | 287 if (codePathToUse != ComplexPath && typesettingFeatures() && (from || to != run.length())) |
| 273 codePathToUse = Complex; | 288 codePathToUse = ComplexPath; |
| 274 | 289 |
| 275 if (codePathToUse != Complex) | 290 if (codePathToUse != ComplexPath) |
| 276 return selectionRectForSimpleText(run, point, h, from, to); | 291 return selectionRectForSimpleText(run, point, h, from, to); |
| 277 | 292 |
| 278 return selectionRectForComplexText(run, point, h, from, to); | 293 return selectionRectForComplexText(run, point, h, from, to); |
| 279 } | 294 } |
| 280 | 295 |
| 281 int Font::offsetForPosition(const TextRun& run, float x, bool includePartialGlyp hs) const | 296 int Font::offsetForPosition(const TextRun& run, float x, bool includePartialGlyp hs) const |
| 282 { | 297 { |
| 283 // FIXME: Use the fast code path once it handles partial runs with kerning a nd ligatures. See http://webkit.org/b/100050 | 298 // FIXME: Use the fast code path once it handles partial runs with kerning a nd ligatures. See http://webkit.org/b/100050 |
| 284 if (codePath(run) != Complex && !typesettingFeatures()) | 299 CodePath codePathToUse = run.characterScanForCodePathValue(); |
| 300 | |
| 301 if (codePathToUse == AutoPath) | |
| 302 codePathToUse = codePath(run); | |
| 303 | |
| 304 if (codePathToUse != ComplexPath && !typesettingFeatures()) | |
| 285 return offsetForPositionForSimpleText(run, x, includePartialGlyphs); | 305 return offsetForPositionForSimpleText(run, x, includePartialGlyphs); |
| 286 | 306 |
| 287 return offsetForPositionForComplexText(run, x, includePartialGlyphs); | 307 return offsetForPositionForComplexText(run, x, includePartialGlyphs); |
| 288 } | 308 } |
| 289 | 309 |
| 290 template <typename CharacterType> | 310 template <typename CharacterType> |
| 291 static inline String normalizeSpacesInternal(const CharacterType* characters, un signed length) | 311 static inline String normalizeSpacesInternal(const CharacterType* characters, un signed length) |
| 292 { | 312 { |
| 293 StringBuilder normalized; | 313 StringBuilder normalized; |
| 294 normalized.reserveCapacity(length); | 314 normalized.reserveCapacity(length); |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 320 bool Font::shouldUseSmoothing() | 340 bool Font::shouldUseSmoothing() |
| 321 { | 341 { |
| 322 return shouldUseFontSmoothing; | 342 return shouldUseFontSmoothing; |
| 323 } | 343 } |
| 324 | 344 |
| 325 void Font::setCodePath(CodePath p) | 345 void Font::setCodePath(CodePath p) |
| 326 { | 346 { |
| 327 s_codePath = p; | 347 s_codePath = p; |
| 328 } | 348 } |
| 329 | 349 |
| 330 Font::CodePath Font::codePath() | 350 CodePath Font::codePath() |
| 331 { | 351 { |
| 332 return s_codePath; | 352 return s_codePath; |
| 333 } | 353 } |
| 334 | 354 |
| 335 void Font::setDefaultTypesettingFeatures(TypesettingFeatures typesettingFeatures ) | 355 void Font::setDefaultTypesettingFeatures(TypesettingFeatures typesettingFeatures ) |
| 336 { | 356 { |
| 337 s_defaultTypesettingFeatures = typesettingFeatures; | 357 s_defaultTypesettingFeatures = typesettingFeatures; |
| 338 } | 358 } |
| 339 | 359 |
| 340 TypesettingFeatures Font::defaultTypesettingFeatures() | 360 TypesettingFeatures Font::defaultTypesettingFeatures() |
| 341 { | 361 { |
| 342 return s_defaultTypesettingFeatures; | 362 return s_defaultTypesettingFeatures; |
| 343 } | 363 } |
| 344 | 364 |
| 345 Font::CodePath Font::codePath(const TextRun& run) const | 365 CodePath Font::codePath(const TextRun& run) const |
| 346 { | 366 { |
| 347 if (s_codePath != Auto) | 367 if (s_codePath != AutoPath) |
| 348 return s_codePath; | 368 return s_codePath; |
| 349 | 369 |
| 350 #if ENABLE(SVG_FONTS) | 370 #if ENABLE(SVG_FONTS) |
| 351 if (run.renderingContext()) | 371 if (run.renderingContext()) |
| 352 return Simple; | 372 return SimplePath; |
| 353 #endif | 373 #endif |
| 354 | 374 |
| 355 if (m_fontDescription.featureSettings() && m_fontDescription.featureSettings ()->size() > 0) | 375 if (m_fontDescription.featureSettings() && m_fontDescription.featureSettings ()->size() > 0) |
| 356 return Complex; | 376 return ComplexPath; |
| 357 | 377 |
| 358 if (run.length() > 1 && !WidthIterator::supportsTypesettingFeatures(*this)) | 378 if (run.length() > 1 && !WidthIterator::supportsTypesettingFeatures(*this)) |
| 359 return Complex; | 379 return ComplexPath; |
| 360 | 380 |
| 361 if (!run.characterScanForCodePath()) | 381 if (!run.characterScanForCodePath()) |
| 362 return Simple; | 382 return SimplePath; |
| 363 | 383 |
| 364 if (run.is8Bit()) | 384 if (run.is8Bit()) |
| 365 return Simple; | 385 return SimplePath; |
| 366 | 386 |
| 367 // Start from 0 since drawing and highlighting also measure the characters b efore run->from. | 387 // Start from 0 since drawing and highlighting also measure the characters b efore run->from. |
| 368 return characterRangeCodePath(run.characters16(), run.length()); | 388 return characterRangeCodePath(run.characters16(), run.length()); |
| 369 } | 389 } |
| 370 | 390 |
| 371 static inline UChar keyExtractorUChar(const UChar* value) | 391 static inline UChar keyExtractorUChar(const UChar* value) |
| 372 { | 392 { |
| 373 return *value; | 393 return *value; |
| 374 } | 394 } |
| 375 | 395 |
| 376 static inline UChar32 keyExtractorUChar32(const UChar32* value) | 396 static inline UChar32 keyExtractorUChar32(const UChar32* value) |
| 377 { | 397 { |
| 378 return *value; | 398 return *value; |
| 379 } | 399 } |
| 380 | 400 |
| 381 Font::CodePath Font::characterRangeCodePath(const UChar* characters, unsigned le n) | 401 CodePath Font::characterRangeCodePath(const UChar* characters, unsigned len) |
| 382 { | 402 { |
| 383 static const UChar complexCodePathRanges[] = { | 403 static const UChar complexCodePathRanges[] = { |
| 384 // U+02E5 through U+02E9 (Modifier Letters : Tone letters) | 404 // U+02E5 through U+02E9 (Modifier Letters : Tone letters) |
| 385 0x2E5, 0x2E9, | 405 0x2E5, 0x2E9, |
| 386 // U+0300 through U+036F Combining diacritical marks | 406 // U+0300 through U+036F Combining diacritical marks |
| 387 0x300, 0x36F, | 407 0x300, 0x36F, |
| 388 // U+0591 through U+05CF excluding U+05BE Hebrew combining marks, ... | 408 // U+0591 through U+05CF excluding U+05BE Hebrew combining marks, ... |
| 389 0x0591, 0x05BD, | 409 0x0591, 0x05BD, |
| 390 // ... Hebrew punctuation Paseq, Sof Pasuq and Nun Hafukha | 410 // ... Hebrew punctuation Paseq, Sof Pasuq and Nun Hafukha |
| 391 0x05BF, 0x05CF, | 411 0x05BF, 0x05CF, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 423 0xA800, 0xABFF, | 443 0xA800, 0xABFF, |
| 424 // U+D7B0 through U+D7FF Hangul Jamo Ext. B | 444 // U+D7B0 through U+D7FF Hangul Jamo Ext. B |
| 425 0xD7B0, 0xD7FF, | 445 0xD7B0, 0xD7FF, |
| 426 // U+FE00 through U+FE0F Unicode variation selectors | 446 // U+FE00 through U+FE0F Unicode variation selectors |
| 427 0xFE00, 0xFE0F, | 447 0xFE00, 0xFE0F, |
| 428 // U+FE20 through U+FE2F Combining half marks | 448 // U+FE20 through U+FE2F Combining half marks |
| 429 0xFE20, 0xFE2F | 449 0xFE20, 0xFE2F |
| 430 }; | 450 }; |
| 431 static size_t complexCodePathRangesCount = WTF_ARRAY_LENGTH(complexCodePathR anges); | 451 static size_t complexCodePathRangesCount = WTF_ARRAY_LENGTH(complexCodePathR anges); |
| 432 | 452 |
| 433 CodePath result = Simple; | 453 CodePath result = SimplePath; |
| 434 for (unsigned i = 0; i < len; i++) { | 454 for (unsigned i = 0; i < len; i++) { |
| 435 const UChar c = characters[i]; | 455 const UChar c = characters[i]; |
| 436 | 456 |
| 437 // Shortcut for common case | 457 // Shortcut for common case |
| 438 if (c < 0x2E5) | 458 if (c < 0x2E5) |
| 439 continue; | 459 continue; |
| 440 | 460 |
| 441 // U+1E00 through U+2000 characters with diacritics and stacked diacriti cs | 461 // U+1E00 through U+2000 characters with diacritics and stacked diacriti cs |
| 442 if (c >= 0x1E00 && c <= 0x2000) { | 462 if (c >= 0x1E00 && c <= 0x2000) { |
| 443 result = SimpleWithGlyphOverflow; | 463 result = SimpleWithGlyphOverflowPath; |
| 444 continue; | 464 continue; |
| 445 } | 465 } |
| 446 | 466 |
| 447 // Surrogate pairs | 467 // Surrogate pairs |
| 448 if (c > 0xD7FF && c <= 0xDBFF) { | 468 if (c > 0xD7FF && c <= 0xDBFF) { |
| 449 if (i == len - 1) | 469 if (i == len - 1) |
| 450 continue; | 470 continue; |
| 451 | 471 |
| 452 UChar next = characters[++i]; | 472 UChar next = characters[++i]; |
| 453 if (!U16_IS_TRAIL(next)) | 473 if (!U16_IS_TRAIL(next)) |
| 454 continue; | 474 continue; |
| 455 | 475 |
| 456 UChar32 supplementaryCharacter = U16_GET_SUPPLEMENTARY(c, next); | 476 UChar32 supplementaryCharacter = U16_GET_SUPPLEMENTARY(c, next); |
| 457 | 477 |
| 458 if (supplementaryCharacter < 0x1F1E6) // U+1F1E6 through U+1F1FF Reg ional Indicator Symbols | 478 if (supplementaryCharacter < 0x1F1E6) // U+1F1E6 through U+1F1FF Reg ional Indicator Symbols |
| 459 continue; | 479 continue; |
| 460 if (supplementaryCharacter <= 0x1F1FF) | 480 if (supplementaryCharacter <= 0x1F1FF) |
| 461 return Complex; | 481 return ComplexPath; |
| 462 | 482 |
| 463 if (supplementaryCharacter < 0xE0100) // U+E0100 through U+E01EF Uni code variation selectors. | 483 if (supplementaryCharacter < 0xE0100) // U+E0100 through U+E01EF Uni code variation selectors. |
| 464 continue; | 484 continue; |
| 465 if (supplementaryCharacter <= 0xE01EF) | 485 if (supplementaryCharacter <= 0xE01EF) |
| 466 return Complex; | 486 return ComplexPath; |
| 467 | 487 |
| 468 // FIXME: Check for Brahmi (U+11000 block), Kaithi (U+11080 block) a nd other complex scripts | 488 // FIXME: Check for Brahmi (U+11000 block), Kaithi (U+11080 block) a nd other complex scripts |
| 469 // in plane 1 or higher. | 489 // in plane 1 or higher. |
| 470 | 490 |
| 471 continue; | 491 continue; |
| 472 } | 492 } |
| 473 | 493 |
| 474 // Search for other Complex cases | 494 // Search for other Complex cases |
| 475 UChar* boundingCharacter = approximateBinarySearch<UChar, UChar>( | 495 UChar* boundingCharacter = approximateBinarySearch<UChar, UChar>( |
| 476 (UChar*)complexCodePathRanges, complexCodePathRangesCount, c, keyExt ractorUChar); | 496 (UChar*)complexCodePathRanges, complexCodePathRangesCount, c, keyExt ractorUChar); |
| 477 // Exact matches are complex | 497 // Exact matches are complex |
| 478 if (*boundingCharacter == c) | 498 if (*boundingCharacter == c) |
| 479 return Complex; | 499 return ComplexPath; |
| 480 bool isEndOfRange = ((boundingCharacter - complexCodePathRanges) % 2); | 500 bool isEndOfRange = ((boundingCharacter - complexCodePathRanges) % 2); |
| 481 if (*boundingCharacter < c) { | 501 if (*boundingCharacter < c) { |
| 482 // Determine if we are in a range or out | 502 // Determine if we are in a range or out |
| 483 if (!isEndOfRange) | 503 if (!isEndOfRange) |
| 484 return Complex; | 504 return ComplexPath; |
| 485 continue; | 505 continue; |
| 486 } | 506 } |
| 487 ASSERT(*boundingCharacter > c); | 507 ASSERT(*boundingCharacter > c); |
| 488 // Determine if we are in a range or out - opposite condition to above | 508 // Determine if we are in a range or out - opposite condition to above |
| 489 if (isEndOfRange) | 509 if (isEndOfRange) |
| 490 return Complex; | 510 return ComplexPath; |
| 491 } | 511 } |
| 492 | 512 |
| 493 return result; | 513 return result; |
| 494 } | 514 } |
| 495 | 515 |
| 496 bool Font::isCJKIdeograph(UChar32 c) | 516 bool Font::isCJKIdeograph(UChar32 c) |
| 497 { | 517 { |
| 498 static const UChar32 cjkIdeographRanges[] = { | 518 static const UChar32 cjkIdeographRanges[] = { |
| 499 // CJK Radicals Supplement and Kangxi Radicals. | 519 // CJK Radicals Supplement and Kangxi Radicals. |
| 500 0x2E80, 0x2FDF, | 520 0x2E80, 0x2FDF, |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 688 } | 708 } |
| 689 | 709 |
| 690 void Font::willUseFontData() const | 710 void Font::willUseFontData() const |
| 691 { | 711 { |
| 692 const FontFamily& family = fontDescription().family(); | 712 const FontFamily& family = fontDescription().family(); |
| 693 if (m_fontFallbackList && m_fontFallbackList->fontSelector() && !family.fami lyIsEmpty()) | 713 if (m_fontFallbackList && m_fontFallbackList->fontSelector() && !family.fami lyIsEmpty()) |
| 694 m_fontFallbackList->fontSelector()->willUseFontData(fontDescription(), f amily.family()); | 714 m_fontFallbackList->fontSelector()->willUseFontData(fontDescription(), f amily.family()); |
| 695 } | 715 } |
| 696 | 716 |
| 697 } | 717 } |
| OLD | NEW |