| 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 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved. | 6 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved. |
| 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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 // Fastest loop, for the common case (normal variant). | 416 // Fastest loop, for the common case (normal variant). |
| 417 while (true) { | 417 while (true) { |
| 418 page = node->page(m_fontDescription.script()); | 418 page = node->page(m_fontDescription.script()); |
| 419 if (page) { | 419 if (page) { |
| 420 GlyphData data = page->glyphDataForCharacter(c); | 420 GlyphData data = page->glyphDataForCharacter(c); |
| 421 if (data.fontData) { | 421 if (data.fontData) { |
| 422 if (!data.fontData->platformData().isVerticalAnyUpright() ||
data.fontData->isTextOrientationFallback()) | 422 if (!data.fontData->platformData().isVerticalAnyUpright() ||
data.fontData->isTextOrientationFallback()) |
| 423 return data; | 423 return data; |
| 424 | 424 |
| 425 bool isUpright = m_fontDescription.isVerticalUpright(c); | 425 bool isUpright = m_fontDescription.isVerticalUpright(c); |
| 426 if (isUpright && Character::isCJKIdeographOrSymbol(c)) { | 426 if (!isUpright || !Character::isCJKIdeographOrSymbol(c)) |
| 427 if (!data.fontData->hasVerticalGlyphs()) { | |
| 428 // Use the broken ideograph font data. The broken id
eograph font will use the horizontal width of glyphs | |
| 429 // to make sure you get a square (even for broken gl
yphs like symbols used for punctuation). | |
| 430 variant = BrokenIdeographVariant; | |
| 431 break; | |
| 432 } | |
| 433 } else { | |
| 434 return glyphDataForNonCJKCharacterWithGlyphOrientation(c
, isUpright, data, pageNumber); | 427 return glyphDataForNonCJKCharacterWithGlyphOrientation(c
, isUpright, data, pageNumber); |
| 435 } | |
| 436 | 428 |
| 437 return data; | 429 return data; |
| 438 } | 430 } |
| 439 | 431 |
| 440 if (node->isSystemFallback()) | 432 if (node->isSystemFallback()) |
| 441 break; | 433 break; |
| 442 } | 434 } |
| 443 | 435 |
| 444 // Proceed with the fallback list. | 436 // Proceed with the fallback list. |
| 445 node = toGlyphPageTreeNode(node)->getChild(fontDataAt(node->level())
, pageNumber); | 437 node = toGlyphPageTreeNode(node)->getChild(fontDataAt(node->level())
, pageNumber); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 // FIXME: Unclear if this should normalizeSpaces above 0xFFFF. | 483 // FIXME: Unclear if this should normalizeSpaces above 0xFFFF. |
| 492 // Doing so changes fast/text/international/plane2-diffs.html | 484 // Doing so changes fast/text/international/plane2-diffs.html |
| 493 UChar32 characterToRender = c; | 485 UChar32 characterToRender = c; |
| 494 if (characterToRender <= 0xFFFF) | 486 if (characterToRender <= 0xFFFF) |
| 495 characterToRender = Character::normalizeSpaces(characterToRender); | 487 characterToRender = Character::normalizeSpaces(characterToRender); |
| 496 | 488 |
| 497 const FontData* fontData = fontDataAt(0); | 489 const FontData* fontData = fontDataAt(0); |
| 498 if (fontData) { | 490 if (fontData) { |
| 499 const SimpleFontData* fontDataToSubstitute = fontData->fontDataForCharac
ter(characterToRender); | 491 const SimpleFontData* fontDataToSubstitute = fontData->fontDataForCharac
ter(characterToRender); |
| 500 RefPtr<SimpleFontData> characterFontData = FontCache::fontCache()->fallb
ackFontForCharacter(m_fontDescription, characterToRender, fontDataToSubstitute); | 492 RefPtr<SimpleFontData> characterFontData = FontCache::fontCache()->fallb
ackFontForCharacter(m_fontDescription, characterToRender, fontDataToSubstitute); |
| 501 if (characterFontData) { | 493 if (characterFontData && variant != NormalVariant) { |
| 502 if (characterFontData->platformData().isVerticalAnyUpright() && !cha
racterFontData->hasVerticalGlyphs() && Character::isCJKIdeographOrSymbol(c)) | 494 characterFontData = characterFontData->variantFontData(m_fontDescrip
tion, variant); |
| 503 variant = BrokenIdeographVariant; | |
| 504 if (variant != NormalVariant) | |
| 505 characterFontData = characterFontData->variantFontData(m_fontDes
cription, variant); | |
| 506 } | 495 } |
| 507 if (characterFontData) { | 496 if (characterFontData) { |
| 508 // Got the fallback glyph and font. | 497 // Got the fallback glyph and font. |
| 509 GlyphPage* fallbackPage = GlyphPageTreeNode::getRootChild(characterF
ontData.get(), pageNumber)->page(); | 498 GlyphPage* fallbackPage = GlyphPageTreeNode::getRootChild(characterF
ontData.get(), pageNumber)->page(); |
| 510 GlyphData data = fallbackPage && fallbackPage->glyphForCharacter(c)
? fallbackPage->glyphDataForCharacter(c) : characterFontData->missingGlyphData()
; | 499 GlyphData data = fallbackPage && fallbackPage->glyphForCharacter(c)
? fallbackPage->glyphDataForCharacter(c) : characterFontData->missingGlyphData()
; |
| 511 // Cache it so we don't have to do system fallback again next time. | 500 // Cache it so we don't have to do system fallback again next time. |
| 512 if (variant == NormalVariant) { | 501 if (variant == NormalVariant) { |
| 513 page->setGlyphDataForCharacter(c, data.glyph, data.fontData); | 502 page->setGlyphDataForCharacter(c, data.glyph, data.fontData); |
| 514 data.fontData->setMaxGlyphPageTreeLevel(std::max(data.fontData->
maxGlyphPageTreeLevel(), node->level())); | 503 data.fontData->setMaxGlyphPageTreeLevel(std::max(data.fontData->
maxGlyphPageTreeLevel(), node->level())); |
| 515 if (data.fontData->platformData().isVerticalAnyUpright() && !dat
a.fontData->isTextOrientationFallback() && !Character::isCJKIdeographOrSymbol(c)
) | 504 if (data.fontData->platformData().isVerticalAnyUpright() && !dat
a.fontData->isTextOrientationFallback() && !Character::isCJKIdeographOrSymbol(c)
) |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 { | 830 { |
| 842 return m_fontFallbackList && m_fontFallbackList->loadingCustomFonts(); | 831 return m_fontFallbackList && m_fontFallbackList->loadingCustomFonts(); |
| 843 } | 832 } |
| 844 | 833 |
| 845 bool Font::isFallbackValid() const | 834 bool Font::isFallbackValid() const |
| 846 { | 835 { |
| 847 return !m_fontFallbackList || m_fontFallbackList->isValid(); | 836 return !m_fontFallbackList || m_fontFallbackList->isValid(); |
| 848 } | 837 } |
| 849 | 838 |
| 850 } // namespace blink | 839 } // namespace blink |
| OLD | NEW |