Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Side by Side Diff: Source/WebCore/platform/graphics/opentype/OpenTypeVerticalData.h

Issue 11299089: Merge 134871 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1312/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Koji Ishii <kojiishi@gmail.com> 2 * Copyright (C) 2012 Koji Ishii <kojiishi@gmail.com>
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 11 matching lines...) Expand all
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */ 23 */
24 24
25 #ifndef OpenTypeVerticalData_h 25 #ifndef OpenTypeVerticalData_h
26 #define OpenTypeVerticalData_h 26 #define OpenTypeVerticalData_h
27 27
28 #if ENABLE(OPENTYPE_VERTICAL) 28 #if ENABLE(OPENTYPE_VERTICAL)
29 29
30 #include "Glyph.h" 30 #include "Glyph.h"
31 #include <wtf/HashMap.h> 31 #include <wtf/HashMap.h>
32 #include <wtf/PassRefPtr.h>
33 #include <wtf/RefCounted.h>
32 #include <wtf/Vector.h> 34 #include <wtf/Vector.h>
33 35
34 namespace WebCore { 36 namespace WebCore {
35 37
36 class FontPlatformData; 38 class FontPlatformData;
37 class GlyphPage; 39 class GlyphPage;
38 class SimpleFontData; 40 class SimpleFontData;
39 41
40 class OpenTypeVerticalData { 42 class OpenTypeVerticalData : public RefCounted<OpenTypeVerticalData> {
41 public: 43 public:
42 OpenTypeVerticalData(const FontPlatformData&); 44 static PassRefPtr<OpenTypeVerticalData> create(const FontPlatformData& platf ormData)
45 {
46 return adoptRef(new OpenTypeVerticalData(platformData));
47 }
43 48
44 bool isOpenType() const { return !m_advanceWidths.isEmpty(); } 49 bool isOpenType() const { return !m_advanceWidths.isEmpty(); }
45 bool hasVerticalMetrics() const { return !m_advanceHeights.isEmpty(); } 50 bool hasVerticalMetrics() const { return !m_advanceHeights.isEmpty(); }
46 float advanceHeight(const SimpleFontData*, Glyph) const; 51 float advanceHeight(const SimpleFontData*, Glyph) const;
47 void getVerticalTranslationsForGlyphs(const SimpleFontData*, const Glyph*, s ize_t, float* outXYArray) const; 52 void getVerticalTranslationsForGlyphs(const SimpleFontData*, const Glyph*, s ize_t, float* outXYArray) const;
48 void substituteWithVerticalGlyphs(const SimpleFontData*, GlyphPage*, unsigne d offset, unsigned length) const; 53 void substituteWithVerticalGlyphs(const SimpleFontData*, GlyphPage*, unsigne d offset, unsigned length) const;
49 54
50 private: 55 private:
56 explicit OpenTypeVerticalData(const FontPlatformData&);
57
51 void loadMetrics(const FontPlatformData&); 58 void loadMetrics(const FontPlatformData&);
52 void loadVerticalGlyphSubstitutions(const FontPlatformData&); 59 void loadVerticalGlyphSubstitutions(const FontPlatformData&);
53 bool hasVORG() const { return !m_vertOriginY.isEmpty(); } 60 bool hasVORG() const { return !m_vertOriginY.isEmpty(); }
54 61
55 HashMap<Glyph, Glyph> m_verticalGlyphMap; 62 HashMap<Glyph, Glyph> m_verticalGlyphMap;
56 Vector<uint16_t> m_advanceWidths; 63 Vector<uint16_t> m_advanceWidths;
57 Vector<uint16_t> m_advanceHeights; 64 Vector<uint16_t> m_advanceHeights;
58 Vector<int16_t> m_topSideBearings; 65 Vector<int16_t> m_topSideBearings;
59 int16_t m_defaultVertOriginY; 66 int16_t m_defaultVertOriginY;
60 HashMap<Glyph, int16_t> m_vertOriginY; 67 HashMap<Glyph, int16_t> m_vertOriginY;
61 68
62 friend class FontCache; 69 friend class FontCache;
63 bool m_inFontCache; // for mark & sweep in FontCache::purgeInactiveFontData( ) 70 bool m_inFontCache; // for mark & sweep in FontCache::purgeInactiveFontData( )
64 }; 71 };
65 72
66 } // namespace WebCore 73 } // namespace WebCore
67 74
68 #endif // ENABLE(OPENTYPE_VERTICAL) 75 #endif // ENABLE(OPENTYPE_VERTICAL)
69 76
70 #endif // OpenTypeVerticalData_h 77 #endif // OpenTypeVerticalData_h
OLDNEW
« no previous file with comments | « Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698