OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 29 matching lines...) Expand all Loading... |
40 HashSet<String> unicodeName2; | 40 HashSet<String> unicodeName2; |
41 HashSet<String> glyphName1; | 41 HashSet<String> glyphName1; |
42 HashSet<String> glyphName2; | 42 HashSet<String> glyphName2; |
43 | 43 |
44 SVGKerningPair() | 44 SVGKerningPair() |
45 : kerning(0) | 45 : kerning(0) |
46 { | 46 { |
47 } | 47 } |
48 }; | 48 }; |
49 | 49 |
| 50 typedef unsigned KerningPairKey; |
50 typedef Vector<SVGKerningPair> KerningPairVector; | 51 typedef Vector<SVGKerningPair> KerningPairVector; |
| 52 typedef HashMap<KerningPairKey, float> KerningTable; |
51 | 53 |
52 class SVGMissingGlyphElement; | 54 class SVGMissingGlyphElement; |
53 | 55 |
54 class SVGFontElement FINAL : public SVGElement { | 56 class SVGFontElement FINAL : public SVGElement { |
55 public: | 57 public: |
56 static PassRefPtr<SVGFontElement> create(Document&); | 58 static PassRefPtr<SVGFontElement> create(Document&); |
57 | 59 |
58 void invalidateGlyphCache(); | 60 void invalidateGlyphCache(); |
59 void collectGlyphsForString(const String&, Vector<SVGGlyph>&); | 61 void collectGlyphsForString(const String&, Vector<SVGGlyph>&); |
60 void collectGlyphsForGlyphName(const String&, Vector<SVGGlyph>&); | 62 void collectGlyphsForAltGlyphReference(const String&, Vector<SVGGlyph>&); |
61 | 63 |
62 float horizontalKerningForPairOfStringsAndGlyphs(const String& u1, const Str
ing& g1, const String& u2, const String& g2) const; | 64 float horizontalKerningForPairOfGlyphs(Glyph, Glyph) const; |
63 float verticalKerningForPairOfStringsAndGlyphs(const String& u1, const Strin
g& g1, const String& u2, const String& g2) const; | 65 float verticalKerningForPairOfGlyphs(Glyph, Glyph) const; |
64 | 66 |
65 // Used by SimpleFontData/WidthIterator. | 67 // Used by SimpleFontData/WidthIterator. |
66 SVGGlyph svgGlyphForGlyph(Glyph); | 68 SVGGlyph svgGlyphForGlyph(Glyph); |
67 Glyph missingGlyph(); | 69 Glyph missingGlyph(); |
68 | 70 |
69 SVGMissingGlyphElement* firstMissingGlyphElement() const; | 71 SVGMissingGlyphElement* firstMissingGlyphElement() const; |
70 | 72 |
71 private: | 73 private: |
72 explicit SVGFontElement(Document&); | 74 explicit SVGFontElement(Document&); |
73 | 75 |
74 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; } | 76 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; } |
75 | 77 |
76 void ensureGlyphCache(); | 78 void ensureGlyphCache(); |
77 void registerLigaturesInGlyphCache(Vector<String>&); | 79 void registerLigaturesInGlyphCache(Vector<String>&); |
| 80 Vector<SVGGlyph> buildGlyphList(const UnicodeRanges&, const HashSet<String>&
unicodeNames, const HashSet<String>& glyphNames) const; |
| 81 void addPairsToKerningTable(const SVGKerningPair&, KerningTable&); |
| 82 void buildKerningTable(const KerningPairVector&, KerningTable&); |
78 | 83 |
79 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFontElement) | 84 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFontElement) |
80 END_DECLARE_ANIMATED_PROPERTIES | 85 END_DECLARE_ANIMATED_PROPERTIES |
81 | 86 |
82 KerningPairVector m_horizontalKerningPairs; | 87 KerningTable m_horizontalKerningTable; |
83 KerningPairVector m_verticalKerningPairs; | 88 KerningTable m_verticalKerningTable; |
84 SVGGlyphMap m_glyphMap; | 89 SVGGlyphMap m_glyphMap; |
85 Glyph m_missingGlyph; | 90 Glyph m_missingGlyph; |
86 bool m_isGlyphCacheValid; | 91 bool m_isGlyphCacheValid; |
87 }; | 92 }; |
88 | 93 |
89 DEFINE_NODE_TYPE_CASTS(SVGFontElement, hasTagName(SVGNames::fontTag)); | 94 DEFINE_NODE_TYPE_CASTS(SVGFontElement, hasTagName(SVGNames::fontTag)); |
90 | 95 |
91 } // namespace WebCore | 96 } // namespace WebCore |
92 | 97 |
93 #endif // ENABLE(SVG_FONTS) | 98 #endif // ENABLE(SVG_FONTS) |
94 #endif | 99 #endif |
OLD | NEW |