OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 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 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 #include "platform/fonts/GlyphPage.h" | 32 #include "platform/fonts/GlyphPage.h" |
33 #include <string.h> | 33 #include <string.h> |
34 #include "wtf/HashMap.h" | 34 #include "wtf/HashMap.h" |
35 #include "wtf/OwnPtr.h" | 35 #include "wtf/OwnPtr.h" |
36 #include "wtf/PassRefPtr.h" | 36 #include "wtf/PassRefPtr.h" |
37 #include "wtf/RefCounted.h" | 37 #include "wtf/RefCounted.h" |
38 #include "wtf/unicode/Unicode.h" | 38 #include "wtf/unicode/Unicode.h" |
39 | 39 |
40 #ifndef NDEBUG | 40 #ifndef NDEBUG |
41 void showGlyphPageTrees(); | 41 void PLATFORM_EXPORT showGlyphPageTrees(); |
42 void showGlyphPageTree(unsigned pageNumber); | 42 void PLATFORM_EXPORT showGlyphPageTree(unsigned pageNumber); |
43 #endif | 43 #endif |
44 | 44 |
45 namespace WebCore { | 45 namespace WebCore { |
46 | 46 |
47 class FontData; | 47 class FontData; |
48 class SimpleFontData; | 48 class SimpleFontData; |
49 | 49 |
50 // The glyph page tree is a data structure that maps (FontData, glyph page numbe
r) | 50 // The glyph page tree is a data structure that maps (FontData, glyph page numbe
r) |
51 // to a GlyphPage. Level 0 (the "root") is special. There is one root | 51 // to a GlyphPage. Level 0 (the "root") is special. There is one root |
52 // GlyphPageTreeNode for each glyph page number. The roots do not have a | 52 // GlyphPageTreeNode for each glyph page number. The roots do not have a |
53 // GlyphPage associated with them, and their initializePage() function is never | 53 // GlyphPage associated with them, and their initializePage() function is never |
54 // called to fill the glyphs. | 54 // called to fill the glyphs. |
55 // | 55 // |
56 // Each root node maps a FontData pointer to another GlyphPageTreeNode at | 56 // Each root node maps a FontData pointer to another GlyphPageTreeNode at |
57 // level 1 (the "root child") that stores the actual glyphs for a specific font
data. | 57 // level 1 (the "root child") that stores the actual glyphs for a specific font
data. |
58 // These nodes will only have a GlyphPage if they have glyphs for that range. | 58 // These nodes will only have a GlyphPage if they have glyphs for that range. |
59 // | 59 // |
60 // Levels greater than one correspond to subsequent levels of the fallback list | 60 // Levels greater than one correspond to subsequent levels of the fallback list |
61 // for that font. These levels override their parent's page of glyphs by | 61 // for that font. These levels override their parent's page of glyphs by |
62 // filling in holes with the new font (thus making a more complete page). | 62 // filling in holes with the new font (thus making a more complete page). |
63 // | 63 // |
64 // A NULL FontData pointer corresponds to the system fallback | 64 // A NULL FontData pointer corresponds to the system fallback |
65 // font. It is tracked separately from the regular pages and overrides so that | 65 // font. It is tracked separately from the regular pages and overrides so that |
66 // the glyph pages do not get polluted with these last-resort glyphs. The | 66 // the glyph pages do not get polluted with these last-resort glyphs. The |
67 // system fallback page is not populated at construction like the other pages, | 67 // system fallback page is not populated at construction like the other pages, |
68 // but on demand for each glyph, because the system may need to use different | 68 // but on demand for each glyph, because the system may need to use different |
69 // fallback fonts for each. This lazy population is done by the Font. | 69 // fallback fonts for each. This lazy population is done by the Font. |
70 class GlyphPageTreeNode { | 70 class PLATFORM_EXPORT GlyphPageTreeNode { |
71 WTF_MAKE_FAST_ALLOCATED; | 71 WTF_MAKE_FAST_ALLOCATED; WTF_MAKE_NONCOPYABLE(GlyphPageTreeNode); |
72 public: | 72 public: |
73 static GlyphPageTreeNode* getRootChild(const FontData* fontData, unsigned pa
geNumber) | 73 static GlyphPageTreeNode* getRootChild(const FontData* fontData, unsigned pa
geNumber) |
74 { | 74 { |
75 return getRoot(pageNumber)->getChild(fontData, pageNumber); | 75 return getRoot(pageNumber)->getChild(fontData, pageNumber); |
76 } | 76 } |
77 | 77 |
78 static void pruneTreeCustomFontData(const FontData*); | 78 static void pruneTreeCustomFontData(const FontData*); |
79 static void pruneTreeFontData(const SimpleFontData*); | 79 static void pruneTreeFontData(const SimpleFontData*); |
80 | 80 |
81 void pruneCustomFontData(const FontData*); | 81 void pruneCustomFontData(const FontData*); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 unsigned m_pageNumber; | 132 unsigned m_pageNumber; |
133 | 133 |
134 friend void ::showGlyphPageTrees(); | 134 friend void ::showGlyphPageTrees(); |
135 friend void ::showGlyphPageTree(unsigned pageNumber); | 135 friend void ::showGlyphPageTree(unsigned pageNumber); |
136 #endif | 136 #endif |
137 }; | 137 }; |
138 | 138 |
139 } // namespace WebCore | 139 } // namespace WebCore |
140 | 140 |
141 #endif // GlyphPageTreeNode_h | 141 #endif // GlyphPageTreeNode_h |
OLD | NEW |