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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 RefPtr<SimpleFontData> characterFontData = FontCache::fontCache()->platformF
allbackForCharacter(m_fontDescription, characterToRender, fontDataToSubstitute); | 493 RefPtr<SimpleFontData> characterFontData = FontCache::fontCache()->platformF
allbackForCharacter(m_fontDescription, characterToRender, fontDataToSubstitute); |
494 if (characterFontData) { | 494 if (characterFontData) { |
495 if (characterFontData->platformData().orientation() == Vertical && !char
acterFontData->hasVerticalGlyphs() && Character::isCJKIdeographOrSymbol(c)) | 495 if (characterFontData->platformData().orientation() == Vertical && !char
acterFontData->hasVerticalGlyphs() && Character::isCJKIdeographOrSymbol(c)) |
496 variant = BrokenIdeographVariant; | 496 variant = BrokenIdeographVariant; |
497 if (variant != NormalVariant) | 497 if (variant != NormalVariant) |
498 characterFontData = characterFontData->variantFontData(m_fontDescrip
tion, variant); | 498 characterFontData = characterFontData->variantFontData(m_fontDescrip
tion, variant); |
499 } | 499 } |
500 if (characterFontData) { | 500 if (characterFontData) { |
501 // Got the fallback glyph and font. | 501 // Got the fallback glyph and font. |
502 GlyphPage* fallbackPage = GlyphPageTreeNode::getRootChild(characterFontD
ata.get(), pageNumber)->page(); | 502 GlyphPage* fallbackPage = GlyphPageTreeNode::getRootChild(characterFontD
ata.get(), pageNumber)->page(); |
503 GlyphData data = fallbackPage && fallbackPage->fontDataForCharacter(c) ?
fallbackPage->glyphDataForCharacter(c) : characterFontData->missingGlyphData(); | 503 GlyphData data = fallbackPage && fallbackPage->glyphForCharacter(c) ? fa
llbackPage->glyphDataForCharacter(c) : characterFontData->missingGlyphData(); |
504 // Cache it so we don't have to do system fallback again next time. | 504 // Cache it so we don't have to do system fallback again next time. |
505 if (variant == NormalVariant) { | 505 if (variant == NormalVariant) { |
506 page->setGlyphDataForCharacter(c, data.glyph, data.fontData); | 506 page->setGlyphDataForCharacter(c, data.glyph, data.fontData); |
507 data.fontData->setMaxGlyphPageTreeLevel(max(data.fontData->maxGlyphP
ageTreeLevel(), node->level())); | 507 data.fontData->setMaxGlyphPageTreeLevel(max(data.fontData->maxGlyphP
ageTreeLevel(), node->level())); |
508 if (!Character::isCJKIdeographOrSymbol(c) && data.fontData->platform
Data().orientation() != Horizontal && !data.fontData->isTextOrientationFallback(
)) | 508 if (!Character::isCJKIdeographOrSymbol(c) && data.fontData->platform
Data().orientation() != Horizontal && !data.fontData->isTextOrientationFallback(
)) |
509 return glyphDataAndPageForNonCJKCharacterWithGlyphOrientation(c,
m_fontDescription.nonCJKGlyphOrientation(), data, page, pageNumber); | 509 return glyphDataAndPageForNonCJKCharacterWithGlyphOrientation(c,
m_fontDescription.nonCJKGlyphOrientation(), data, page, pageNumber); |
510 } | 510 } |
511 return make_pair(data, page); | 511 return make_pair(data, page); |
512 } | 512 } |
513 | 513 |
514 // Even system fallback can fail; use the missing glyph in that case. | 514 // Even system fallback can fail; use the missing glyph in that case. |
515 // FIXME: It would be nicer to use the missing glyph from the last resort fo
nt instead. | 515 // FIXME: It would be nicer to use the missing glyph from the last resort fo
nt instead. |
516 GlyphData data = primaryFont()->missingGlyphData(); | 516 GlyphData data = primaryFont()->missingGlyphData(); |
517 if (variant == NormalVariant) { | 517 if (variant == NormalVariant) { |
518 page->setGlyphDataForCharacter(c, data.glyph, data.fontData); | 518 page->setGlyphDataForCharacter(c, data.glyph, data.fontData); |
519 data.fontData->setMaxGlyphPageTreeLevel(max(data.fontData->maxGlyphPageT
reeLevel(), node->level())); | 519 data.fontData->setMaxGlyphPageTreeLevel(max(data.fontData->maxGlyphPageT
reeLevel(), node->level())); |
520 } | 520 } |
521 return make_pair(data, page); | 521 return make_pair(data, page); |
522 } | 522 } |
523 | 523 |
524 bool Font::primaryFontHasGlyphForCharacter(UChar32 character) const | 524 bool Font::primaryFontHasGlyphForCharacter(UChar32 character) const |
525 { | 525 { |
526 unsigned pageNumber = (character / GlyphPage::size); | 526 unsigned pageNumber = (character / GlyphPage::size); |
527 | 527 |
528 GlyphPageTreeNode* node = GlyphPageTreeNode::getRootChild(primaryFont(), pag
eNumber); | 528 GlyphPageTreeNode* node = GlyphPageTreeNode::getRootChild(primaryFont(), pag
eNumber); |
529 GlyphPage* page = node->page(); | 529 GlyphPage* page = node->page(); |
530 | 530 |
531 return page && page->fontDataForCharacter(character); | 531 return page && page->glyphForCharacter(character); |
532 } | 532 } |
533 | 533 |
534 // FIXME: This function may not work if the emphasis mark uses a complex script,
but none of the | 534 // FIXME: This function may not work if the emphasis mark uses a complex script,
but none of the |
535 // standard emphasis marks do so. | 535 // standard emphasis marks do so. |
536 bool Font::getEmphasisMarkGlyphData(const AtomicString& mark, GlyphData& glyphDa
ta) const | 536 bool Font::getEmphasisMarkGlyphData(const AtomicString& mark, GlyphData& glyphDa
ta) const |
537 { | 537 { |
538 if (mark.isEmpty()) | 538 if (mark.isEmpty()) |
539 return false; | 539 return false; |
540 | 540 |
541 UChar32 character = mark[0]; | 541 UChar32 character = mark[0]; |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 if (delta <= 0) | 825 if (delta <= 0) |
826 break; | 826 break; |
827 } | 827 } |
828 } | 828 } |
829 } | 829 } |
830 | 830 |
831 return offset; | 831 return offset; |
832 } | 832 } |
833 | 833 |
834 } | 834 } |
OLD | NEW |