OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 namespace blink { | 32 namespace blink { |
33 | 33 |
34 SegmentedFontData::~SegmentedFontData() | 34 SegmentedFontData::~SegmentedFontData() |
35 { | 35 { |
36 GlyphPageTreeNode::pruneTreeCustomFontData(this); | 36 GlyphPageTreeNode::pruneTreeCustomFontData(this); |
37 } | 37 } |
38 | 38 |
39 const SimpleFontData* SegmentedFontData::fontDataForCharacter(UChar32 c) const | 39 const SimpleFontData* SegmentedFontData::fontDataForCharacter(UChar32 c) const |
40 { | 40 { |
41 Vector<FontDataRange>::const_iterator end = m_ranges.end(); | 41 Vector<FontDataForRangeSet>::const_iterator end = m_faces.end(); |
42 for (Vector<FontDataRange>::const_iterator it = m_ranges.begin(); it != end;
++it) { | 42 for (Vector<FontDataForRangeSet>::const_iterator it = m_faces.begin(); it !=
end; ++it) { |
43 if (it->from() <= c && it->to() >= c) | 43 if (it->contains(c)) |
44 return it->fontData().get(); | 44 return it->fontData().get(); |
45 } | 45 } |
46 return m_ranges[0].fontData().get(); | 46 return m_faces[0].fontData().get(); |
47 } | 47 } |
48 | 48 |
49 bool SegmentedFontData::containsCharacter(UChar32 c) const | 49 bool SegmentedFontData::containsCharacter(UChar32 c) const |
50 { | 50 { |
51 Vector<FontDataRange>::const_iterator end = m_ranges.end(); | 51 Vector<FontDataForRangeSet>::const_iterator end = m_faces.end(); |
52 for (Vector<FontDataRange>::const_iterator it = m_ranges.begin(); it != end;
++it) { | 52 for (Vector<FontDataForRangeSet>::const_iterator it = m_faces.begin(); it !=
end; ++it) { |
53 if (c >= it->from() && c <= it->to()) | 53 if (it->contains(c)) |
54 return true; | 54 return true; |
55 } | 55 } |
56 return false; | 56 return false; |
57 } | 57 } |
58 | 58 |
59 bool SegmentedFontData::isCustomFont() const | 59 bool SegmentedFontData::isCustomFont() const |
60 { | 60 { |
61 // All segmented fonts are custom fonts. | 61 // All segmented fonts are custom fonts. |
62 return true; | 62 return true; |
63 } | 63 } |
64 | 64 |
65 bool SegmentedFontData::isLoading() const | 65 bool SegmentedFontData::isLoading() const |
66 { | 66 { |
67 Vector<FontDataRange>::const_iterator end = m_ranges.end(); | 67 Vector<FontDataForRangeSet>::const_iterator end = m_faces.end(); |
68 for (Vector<FontDataRange>::const_iterator it = m_ranges.begin(); it != end;
++it) { | 68 for (Vector<FontDataForRangeSet>::const_iterator it = m_faces.begin(); it !=
end; ++it) { |
69 if (it->fontData()->isLoading()) | 69 if (it->fontData()->isLoading()) |
70 return true; | 70 return true; |
71 } | 71 } |
72 return false; | 72 return false; |
73 } | 73 } |
74 | 74 |
75 // Returns true if any of the sub fonts are loadingFallback. | 75 // Returns true if any of the sub fonts are loadingFallback. |
76 bool SegmentedFontData::isLoadingFallback() const | 76 bool SegmentedFontData::isLoadingFallback() const |
77 { | 77 { |
78 Vector<FontDataRange>::const_iterator end = m_ranges.end(); | 78 Vector<FontDataForRangeSet>::const_iterator end = m_faces.end(); |
79 for (Vector<FontDataRange>::const_iterator it = m_ranges.begin(); it != end;
++it) { | 79 for (Vector<FontDataForRangeSet>::const_iterator it = m_faces.begin(); it !=
end; ++it) { |
80 if (it->fontData()->isLoadingFallback()) | 80 if (it->fontData()->isLoadingFallback()) |
81 return true; | 81 return true; |
82 } | 82 } |
83 return false; | 83 return false; |
84 } | 84 } |
85 | 85 |
86 bool SegmentedFontData::isSegmented() const | 86 bool SegmentedFontData::isSegmented() const |
87 { | 87 { |
88 return true; | 88 return true; |
89 } | 89 } |
90 | 90 |
91 bool SegmentedFontData::shouldSkipDrawing() const | 91 bool SegmentedFontData::shouldSkipDrawing() const |
92 { | 92 { |
93 Vector<FontDataRange>::const_iterator end = m_ranges.end(); | 93 Vector<FontDataForRangeSet>::const_iterator end = m_faces.end(); |
94 for (Vector<FontDataRange>::const_iterator it = m_ranges.begin(); it != end;
++it) { | 94 for (Vector<FontDataForRangeSet>::const_iterator it = m_faces.begin(); it !=
end; ++it) { |
95 if (it->fontData()->shouldSkipDrawing()) | 95 if (it->fontData()->shouldSkipDrawing()) |
96 return true; | 96 return true; |
97 } | 97 } |
98 return false; | 98 return false; |
99 } | 99 } |
100 | 100 |
101 } // namespace blink | 101 } // namespace blink |
OLD | NEW |