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

Side by Side Diff: Source/platform/fonts/opentype/OpenTypeVerticalData.h

Issue 617103003: Replace ENABLE_OPENTYPE_VERTICAL implementation with HarfBuzz (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@removeOpenTypeVertical
Patch Set: Additional TestExpectations tweaking for Mac Created 6 years 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
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
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN Y 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN Y
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN Y 16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN Y
17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O N 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O N
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
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)
29
30 #include "platform/PlatformExport.h" 28 #include "platform/PlatformExport.h"
31 #include "platform/fonts/Glyph.h" 29 #include "platform/fonts/Glyph.h"
32 #include "wtf/HashMap.h" 30 #include "wtf/HashMap.h"
33 #include "wtf/PassRefPtr.h" 31 #include "wtf/PassRefPtr.h"
34 #include "wtf/RefCounted.h" 32 #include "wtf/RefCounted.h"
35 #include "wtf/Vector.h" 33 #include "wtf/Vector.h"
36 34
37 namespace blink { 35 namespace blink {
38 36
39 class FontPlatformData; 37 class FontPlatformData;
40 class GlyphPage; 38 class GlyphPage;
41 class SimpleFontData; 39 class SimpleFontData;
42 40
43 class PLATFORM_EXPORT OpenTypeVerticalData : public RefCounted<OpenTypeVerticalD ata> { 41 class PLATFORM_EXPORT OpenTypeVerticalData : public RefCounted<OpenTypeVerticalD ata> {
44 public: 42 public:
45 static PassRefPtr<OpenTypeVerticalData> create(const FontPlatformData& platf ormData) 43 static PassRefPtr<OpenTypeVerticalData> create(const FontPlatformData& platf ormData)
46 { 44 {
47 return adoptRef(new OpenTypeVerticalData(platformData)); 45 return adoptRef(new OpenTypeVerticalData(platformData));
48 } 46 }
49 47
50 bool isOpenType() const { return !m_advanceWidths.isEmpty(); } 48 bool isOpenType() const { return !m_advanceWidths.isEmpty(); }
51 bool hasVerticalMetrics() const { return !m_advanceHeights.isEmpty(); } 49 bool hasVerticalMetrics() const { return !m_advanceHeights.isEmpty(); }
52 float advanceHeight(const SimpleFontData*, Glyph) const; 50 float advanceHeight(const SimpleFontData*, Glyph) const;
53 void getVerticalTranslationsForGlyphs(const SimpleFontData*, const Glyph*, s ize_t, float* outXYArray) const;
54 void substituteWithVerticalGlyphs(const SimpleFontData*, GlyphPage*, unsigne d offset, unsigned length) const;
55 51
56 bool inFontCache() const { return m_inFontCache; } 52 bool inFontCache() const { return m_inFontCache; }
57 void setInFontCache(bool inFontCache) { m_inFontCache = inFontCache; } 53 void setInFontCache(bool inFontCache) { m_inFontCache = inFontCache; }
58 54
55 void getVerticalTranslationsForGlyphs(const SimpleFontData*, const Glyph*, s ize_t, float* outXYArray) const;
56
59 private: 57 private:
58
60 explicit OpenTypeVerticalData(const FontPlatformData&); 59 explicit OpenTypeVerticalData(const FontPlatformData&);
61 60
62 void loadMetrics(const FontPlatformData&); 61 void loadMetrics(const FontPlatformData&);
63 void loadVerticalGlyphSubstitutions(const FontPlatformData&);
64 bool hasVORG() const { return !m_vertOriginY.isEmpty(); } 62 bool hasVORG() const { return !m_vertOriginY.isEmpty(); }
65 63
66 HashMap<Glyph, Glyph> m_verticalGlyphMap; 64 HashMap<Glyph, Glyph> m_verticalGlyphMap;
67 Vector<uint16_t> m_advanceWidths; 65 Vector<uint16_t> m_advanceWidths;
68 Vector<uint16_t> m_advanceHeights; 66 Vector<uint16_t> m_advanceHeights;
69 Vector<int16_t> m_topSideBearings; 67 Vector<int16_t> m_topSideBearings;
70 int16_t m_defaultVertOriginY; 68 int16_t m_defaultVertOriginY;
71 HashMap<Glyph, int16_t> m_vertOriginY; 69 HashMap<Glyph, int16_t> m_vertOriginY;
72 70
73 bool m_inFontCache; // for mark & sweep in FontCache::purgeInactiveFontData( ) 71 bool m_inFontCache; // for mark & sweep in FontCache::purgeInactiveFontData( )
74 }; 72 };
75 73
76 } // namespace blink 74 } // namespace blink
77 75
78 #endif // ENABLE(OPENTYPE_VERTICAL)
79
80 #endif // OpenTypeVerticalData_h 76 #endif // OpenTypeVerticalData_h
OLDNEW
« no previous file with comments | « Source/platform/fonts/SimpleFontData.cpp ('k') | Source/platform/fonts/opentype/OpenTypeVerticalData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698