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 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 // FIXME: It would be nicer to use the missing glyph from the last resort fo
nt instead. | 651 // FIXME: It would be nicer to use the missing glyph from the last resort fo
nt instead. |
652 ASSERT(primaryFont()); | 652 ASSERT(primaryFont()); |
653 GlyphData data = primaryFont()->missingGlyphData(); | 653 GlyphData data = primaryFont()->missingGlyphData(); |
654 if (variant == NormalVariant) { | 654 if (variant == NormalVariant) { |
655 page->setGlyphDataForCharacter(c, data.glyph, data.fontData); | 655 page->setGlyphDataForCharacter(c, data.glyph, data.fontData); |
656 data.fontData->setMaxGlyphPageTreeLevel(std::max(data.fontData->maxGlyph
PageTreeLevel(), node->level())); | 656 data.fontData->setMaxGlyphPageTreeLevel(std::max(data.fontData->maxGlyph
PageTreeLevel(), node->level())); |
657 } | 657 } |
658 return data; | 658 return data; |
659 } | 659 } |
660 | 660 |
661 // FIXME: This function may not work if the emphasis mark uses a complex script,
but none of the | |
662 // standard emphasis marks do so. | |
663 bool Font::getEmphasisMarkGlyphData(const AtomicString& mark, GlyphData& glyphDa
ta) const | 661 bool Font::getEmphasisMarkGlyphData(const AtomicString& mark, GlyphData& glyphDa
ta) const |
664 { | 662 { |
665 if (mark.isEmpty()) | 663 if (mark.isEmpty()) |
666 return false; | 664 return false; |
667 | 665 |
668 UChar32 character = mark[0]; | 666 TextRun emphasisMarkRun(mark, mark.length()); |
| 667 TextRunPaintInfo emphasisPaintInfo(emphasisMarkRun); |
| 668 GlyphBuffer glyphBuffer; |
| 669 buildGlyphBuffer(emphasisPaintInfo, glyphBuffer); |
669 | 670 |
670 if (U16_IS_SURROGATE(character)) { | 671 if (glyphBuffer.isEmpty()) |
671 if (!U16_IS_SURROGATE_LEAD(character)) | 672 return false; |
672 return false; | |
673 | 673 |
674 if (mark.length() < 2) | 674 ASSERT(glyphBuffer.fontDataAt(0)); |
675 return false; | 675 glyphData.fontData = glyphBuffer.fontDataAt(0)->emphasisMarkFontData(m_fontD
escription).get(); |
| 676 glyphData.glyph = glyphBuffer.glyphAt(0); |
676 | 677 |
677 UChar low = mark[1]; | |
678 if (!U16_IS_TRAIL(low)) | |
679 return false; | |
680 | |
681 character = U16_GET_SUPPLEMENTARY(character, low); | |
682 } | |
683 | |
684 bool normalizeSpace = false; | |
685 glyphData = glyphDataForCharacter(character, false, normalizeSpace, Emphasis
MarkVariant); | |
686 return true; | 678 return true; |
687 } | 679 } |
688 | 680 |
689 int Font::emphasisMarkAscent(const AtomicString& mark) const | 681 int Font::emphasisMarkAscent(const AtomicString& mark) const |
690 { | 682 { |
691 FontCachePurgePreventer purgePreventer; | 683 FontCachePurgePreventer purgePreventer; |
692 | 684 |
693 GlyphData markGlyphData; | 685 GlyphData markGlyphData; |
694 if (!getEmphasisMarkGlyphData(mark, markGlyphData)) | 686 if (!getEmphasisMarkGlyphData(mark, markGlyphData)) |
695 return 0; | 687 return 0; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 { | 826 { |
835 return m_fontFallbackList && m_fontFallbackList->loadingCustomFonts(); | 827 return m_fontFallbackList && m_fontFallbackList->loadingCustomFonts(); |
836 } | 828 } |
837 | 829 |
838 bool Font::isFallbackValid() const | 830 bool Font::isFallbackValid() const |
839 { | 831 { |
840 return !m_fontFallbackList || m_fontFallbackList->isValid(); | 832 return !m_fontFallbackList || m_fontFallbackList->isValid(); |
841 } | 833 } |
842 | 834 |
843 } // namespace blink | 835 } // namespace blink |
OLD | NEW |