Title: [166364] trunk/Source/WebCore
Revision
166364
Author
fred.w...@free.fr
Date
2014-03-27 11:06:21 -0700 (Thu, 27 Mar 2014)

Log Message

Operator stretching: expose a math data API
https://bugs.webkit.org/show_bug.cgi?id=130572

Reviewed by Chris Fleizach.

We expose a new SimpleFontData API to give access to the data from the
OpenType MATH table using a font cache. The class OpenTypeMathData will
be implemented in bug 130324. On Darwin platform, we also implement the
missing FontPlatformData::openTypeTable function which will be necessary
to load the OpenType MATH table. The changes are intended to be used
for MathML operator stretching (bug 130322) so tests are not added yet.

* CMakeLists.txt: add new OpenTypeMathData files.
* WebCore.vcxproj/WebCore.vcxproj: ditto.
* WebCore.vcxproj/WebCore.vcxproj.filters: ditto.
* WebCore.xcodeproj/project.pbxproj: ditto.
* platform/graphics/FontCache.cpp: We add a FontCache::getMathData function to implement a cache for the math data.
We make the math and vertical data share the same key for the cache.
(WebCore::fontMathDataCacheInstance):
(WebCore::FontCache::getMathData):
(WebCore::fontVerticalDataCacheInstance):
* platform/graphics/FontCache.h: We declare FontCache::getMathData and FontFileKey on all platforms.
* platform/graphics/FontPlatformData.cpp:
(WebCore::FontPlatformData::openTypeTable): We implement openTypeTable() on Darwin platform.
* platform/graphics/FontPlatformData.h: We expose openTypeTable() on Darwin platform.
* platform/graphics/SimpleFontData.cpp: We initialize m_mathData from the font cache.
(WebCore::SimpleFontData::SimpleFontData):
* platform/graphics/SimpleFontData.h: We expose a mathData() function to access the MATH data.
* platform/graphics/opentype/OpenTypeMathData.cpp: Added. This is a new class that will be used to parse the data from the OpenType MATH table.
(WebCore::OpenTypeMathData::OpenTypeMathData):
* platform/graphics/opentype/OpenTypeMathData.h: Added.
(WebCore::OpenTypeMathData::create):
(WebCore::OpenTypeMathData::hasMathData):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (166363 => 166364)


--- trunk/Source/WebCore/CMakeLists.txt	2014-03-27 17:51:38 UTC (rev 166363)
+++ trunk/Source/WebCore/CMakeLists.txt	2014-03-27 18:06:21 UTC (rev 166364)
@@ -1950,6 +1950,8 @@
     platform/graphics/filters/SourceGraphic.cpp
     platform/graphics/filters/SpotLightSource.cpp
 
+    platform/graphics/opentype/OpenTypeMathData.cpp
+
     platform/graphics/texmap/TextureMapper.cpp
     platform/graphics/texmap/TextureMapperBackingStore.cpp
     platform/graphics/texmap/TextureMapperFPSCounter.cpp

Modified: trunk/Source/WebCore/ChangeLog (166363 => 166364)


--- trunk/Source/WebCore/ChangeLog	2014-03-27 17:51:38 UTC (rev 166363)
+++ trunk/Source/WebCore/ChangeLog	2014-03-27 18:06:21 UTC (rev 166364)
@@ -1,3 +1,39 @@
+2014-03-27  Frédéric Wang  <fred.w...@free.fr>
+
+        Operator stretching: expose a math data API
+        https://bugs.webkit.org/show_bug.cgi?id=130572
+
+        Reviewed by Chris Fleizach.
+
+        We expose a new SimpleFontData API to give access to the data from the
+        OpenType MATH table using a font cache. The class OpenTypeMathData will
+        be implemented in bug 130324. On Darwin platform, we also implement the
+        missing FontPlatformData::openTypeTable function which will be necessary
+        to load the OpenType MATH table. The changes are intended to be used
+        for MathML operator stretching (bug 130322) so tests are not added yet.
+
+        * CMakeLists.txt: add new OpenTypeMathData files.
+        * WebCore.vcxproj/WebCore.vcxproj: ditto.
+        * WebCore.vcxproj/WebCore.vcxproj.filters: ditto.
+        * WebCore.xcodeproj/project.pbxproj: ditto.
+        * platform/graphics/FontCache.cpp: We add a FontCache::getMathData function to implement a cache for the math data.
+        We make the math and vertical data share the same key for the cache.
+        (WebCore::fontMathDataCacheInstance):
+        (WebCore::FontCache::getMathData):
+        (WebCore::fontVerticalDataCacheInstance):
+        * platform/graphics/FontCache.h: We declare FontCache::getMathData and FontFileKey on all platforms.
+        * platform/graphics/FontPlatformData.cpp:
+        (WebCore::FontPlatformData::openTypeTable): We implement openTypeTable() on Darwin platform.
+        * platform/graphics/FontPlatformData.h: We expose openTypeTable() on Darwin platform.
+        * platform/graphics/SimpleFontData.cpp: We initialize m_mathData from the font cache.
+        (WebCore::SimpleFontData::SimpleFontData):
+        * platform/graphics/SimpleFontData.h: We expose a mathData() function to access the MATH data.
+        * platform/graphics/opentype/OpenTypeMathData.cpp: Added. This is a new class that will be used to parse the data from the OpenType MATH table.
+        (WebCore::OpenTypeMathData::OpenTypeMathData):
+        * platform/graphics/opentype/OpenTypeMathData.h: Added.
+        (WebCore::OpenTypeMathData::create):
+        (WebCore::OpenTypeMathData::hasMathData):
+
 2014-03-27  Brent Fulgham  <bfulg...@apple.com>
 
         Fix a crash caused by track insertion after load()

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (166363 => 166364)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2014-03-27 17:51:38 UTC (rev 166363)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2014-03-27 18:06:21 UTC (rev 166364)
@@ -7949,6 +7949,7 @@
     <ClCompile Include="..\platform\graphics\win\IntRectWin.cpp" />
     <ClCompile Include="..\platform\graphics\win\IntSizeWin.cpp" />
     <ClCompile Include="..\platform\graphics\win\MediaPlayerPrivateFullscreenWindow.cpp" />
+    <ClCompile Include="..\platform\graphics\opentype\OpenTypeMathData.cpp" />
     <ClCompile Include="..\platform\graphics\opentype\OpenTypeUtilities.cpp" />
     <ClCompile Include="..\platform\graphics\opentype\OpenTypeVerticalData.cpp" />
     <ClCompile Include="..\platform\graphics\win\SimpleFontDataCairoWin.cpp">
@@ -19373,6 +19374,7 @@
     <ClInclude Include="..\platform\graphics\win\FullScreenControllerClient.h" />
     <ClInclude Include="..\platform\graphics\win\LocalWindowsContext.h" />
     <CustomBuildStep Include="..\platform\graphics\win\MediaPlayerPrivateFullscreenWindow.h" />
+    <ClInclude Include="..\platform\graphics\opentype\OpenTypeMathData.h" />
     <ClInclude Include="..\platform\graphics\opentype\OpenTypeTypes.h" />
     <ClInclude Include="..\platform\graphics\opentype\OpenTypeUtilities.h" />
     <ClInclude Include="..\platform\graphics\opentype\OpenTypeVerticalData.h" />

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (166363 => 166364)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2014-03-27 17:51:38 UTC (rev 166363)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2014-03-27 18:06:21 UTC (rev 166364)
@@ -1476,6 +1476,9 @@
     <ClCompile Include="..\platform\graphics\win\MediaPlayerPrivateFullscreenWindow.cpp">
       <Filter>platform\graphics\win</Filter>
     </ClCompile>
+    <ClCompile Include="..\platform\graphics\opentype\OpenTypeMathData.cpp">
+      <Filter>platform\graphics\win</Filter>
+    </ClCompile>
     <ClCompile Include="..\platform\graphics\opentype\OpenTypeUtilities.cpp">
       <Filter>platform\graphics\win</Filter>
     </ClCompile>
@@ -8434,6 +8437,9 @@
     <ClInclude Include="..\platform\graphics\win\LocalWindowsContext.h">
       <Filter>platform\graphics\win</Filter>
     </ClInclude>
+    <ClInclude Include="..\platform\graphics\opentype\OpenTypeMathData.h">
+      <Filter>platform\graphics\win</Filter>
+    </ClInclude>
     <ClInclude Include="..\platform\graphics\opentype\OpenTypeTypes.h">
       <Filter>platform\graphics\win</Filter>
     </ClInclude>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (166363 => 166364)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-03-27 17:51:38 UTC (rev 166363)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-03-27 18:06:21 UTC (rev 166364)
@@ -4593,6 +4593,8 @@
 		B2C3DA630D006CD600EF6F26 /* FontCache.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA520D006CD600EF6F26 /* FontCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		B2C3DA640D006CD600EF6F26 /* SimpleFontData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA530D006CD600EF6F26 /* SimpleFontData.cpp */; };
 		B2C3DA650D006CD600EF6F26 /* SimpleFontData.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA540D006CD600EF6F26 /* SimpleFontData.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		B2D3DA640D006CD600EF6F27 /* OpenTypeMathData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2D3DA530D006CD600EF6F27 /* OpenTypeMathData.cpp */; };
+		B2D3DA650D006CD600EF6F27 /* OpenTypeMathData.h in Headers */ = {isa = PBXBuildFile; fileRef = B2D3DA540D006CD600EF6F27 /* OpenTypeMathData.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		B2C3DA660D006CD600EF6F26 /* FontDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA550D006CD600EF6F26 /* FontDescription.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		B2C3DA670D006CD600EF6F26 /* FontGlyphs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA560D006CD600EF6F26 /* FontGlyphs.cpp */; };
 		B2C3DA680D006CD600EF6F26 /* FontGlyphs.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA570D006CD600EF6F26 /* FontGlyphs.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -11844,6 +11846,8 @@
 		B2C3DA520D006CD600EF6F26 /* FontCache.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FontCache.h; sourceTree = "<group>"; };
 		B2C3DA530D006CD600EF6F26 /* SimpleFontData.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleFontData.cpp; sourceTree = "<group>"; };
 		B2C3DA540D006CD600EF6F26 /* SimpleFontData.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SimpleFontData.h; sourceTree = "<group>"; };
+		B2D3DA530D006CD600EF6F27 /* OpenTypeMathData.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = opentype/OpenTypeMathData.cpp; sourceTree = "<group>"; };
+		B2D3DA540D006CD600EF6F27 /* OpenTypeMathData.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = opentype/OpenTypeMathData.h; sourceTree = "<group>"; };
 		B2C3DA550D006CD600EF6F26 /* FontDescription.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FontDescription.h; sourceTree = "<group>"; };
 		B2C3DA560D006CD600EF6F26 /* FontGlyphs.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FontGlyphs.cpp; sourceTree = "<group>"; };
 		B2C3DA570D006CD600EF6F26 /* FontGlyphs.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FontGlyphs.h; sourceTree = "<group>"; };
@@ -20136,6 +20140,8 @@
 				0F3DD44E12F5EA1B000D9190 /* ShadowBlur.h */,
 				B2C3DA530D006CD600EF6F26 /* SimpleFontData.cpp */,
 				B2C3DA540D006CD600EF6F26 /* SimpleFontData.h */,
+				B2D3DA530D006CD600EF6F27 /* OpenTypeMathData.cpp */,
+				B2D3DA540D006CD600EF6F27 /* OpenTypeMathData.h */,
 				CD641EB21818F5ED00EE4C41 /* SourceBufferPrivate.h */,
 				CDC61DA0180867D8004B913F /* SourceBufferPrivate.h */,
 				CDC8B5AC1804AE5D0016E685 /* SourceBufferPrivateClient.h */,
@@ -25479,6 +25485,7 @@
 				E1B7839C163740A70007B692 /* SharedWorkerStrategy.h in Headers */,
 				41D168EE10226E89009BC827 /* SharedWorkerThread.h in Headers */,
 				B2C3DA650D006CD600EF6F26 /* SimpleFontData.h in Headers */,
+				B2D3DA650D006CD600EF6F27 /* OpenTypeMathData.h in Headers */,
 				E48944A3180B57D800F165D8 /* SimpleLineLayout.h in Headers */,
 				E4E9B11D1814569C003ACCDF /* SimpleLineLayoutFunctions.h in Headers */,
 				E4E9B1191810916F003ACCDF /* SimpleLineLayoutResolver.h in Headers */,
@@ -28843,6 +28850,7 @@
 				E1B784201639CBBE0007B692 /* SharedWorkerRepository.cpp in Sources */,
 				41D168ED10226E89009BC827 /* SharedWorkerThread.cpp in Sources */,
 				B2C3DA640D006CD600EF6F26 /* SimpleFontData.cpp in Sources */,
+				B2D3DA640D006CD600EF6F27 /* OpenTypeMathData.cpp in Sources */,
 				163E88F7118A39D200ED9231 /* SimpleFontDataCoreText.cpp in Sources */,
 				37E65950163B10C200EB4574 /* SimpleFontDataIOS.mm in Sources */,
 				B2AFFC7F0D00A5C10030074D /* SimpleFontDataMac.mm in Sources */,

Modified: trunk/Source/WebCore/platform/graphics/FontCache.cpp (166363 => 166364)


--- trunk/Source/WebCore/platform/graphics/FontCache.cpp	2014-03-27 17:51:38 UTC (rev 166363)
+++ trunk/Source/WebCore/platform/graphics/FontCache.cpp	2014-03-27 18:06:21 UTC (rev 166364)
@@ -34,6 +34,7 @@
 #include "FontGlyphs.h"
 #include "FontPlatformData.h"
 #include "FontSelector.h"
+#include "OpenTypeMathData.h"
 #include "WebKitFontFamilyNames.h"
 #include <wtf/HashMap.h>
 #include <wtf/ListHashSet.h>
@@ -266,8 +267,7 @@
     return it->value.get();
 }
 
-#if ENABLE(OPENTYPE_VERTICAL)
-struct FontVerticalDataCacheKeyHash {
+struct FontFileCacheKeyHash {
     static unsigned hash(const FontCache::FontFileKey& fontFileKey)
     {
         return PtrHash<const FontCache::FontFileKey*>::hash(&fontFileKey);
@@ -281,7 +281,7 @@
     static const bool safeToCompareToEmptyOrDeleted = true;
 };
 
-struct FontVerticalDataCacheKeyTraits : WTF::GenericHashTraits<FontCache::FontFileKey> {
+struct FontFileCacheKeyTraits : WTF::GenericHashTraits<FontCache::FontFileKey> {
     static const bool emptyValueIsZero = true;
     static const bool needsDestruction = true;
     static const FontCache::FontFileKey& emptyValue()
@@ -299,10 +299,33 @@
     }
 };
 
-typedef HashMap<FontCache::FontFileKey, RefPtr<OpenTypeVerticalData>, FontVerticalDataCacheKeyHash, FontVerticalDataCacheKeyTraits> FontVerticalDataCache;
+typedef HashMap<FontCache::FontFileKey, RefPtr<OpenTypeMathData>, FontFileCacheKeyHash, FontFileCacheKeyTraits> FontMathDataCache;
 
-FontVerticalDataCache& fontVerticalDataCacheInstance()
+static FontMathDataCache& fontMathDataCacheInstance()
 {
+    static NeverDestroyed<FontMathDataCache> fontMathDataCache;
+    return fontMathDataCache;
+}
+
+PassRefPtr<OpenTypeMathData> FontCache::getMathData(const FontFileKey& key, const FontPlatformData& fontData)
+{
+    FontMathDataCache& fontMathDataCache = fontMathDataCacheInstance();
+    FontMathDataCache::iterator result = fontMathDataCache.find(key);
+    if (result != fontMathDataCache.end())
+        return result.get()->value;
+
+    RefPtr<OpenTypeMathData> mathData = OpenTypeMathData::create(fontData);
+    if (!mathData->hasMathData())
+        mathData.clear();
+    fontMathDataCache.set(key, mathData);
+    return mathData;
+}
+
+#if ENABLE(OPENTYPE_VERTICAL)
+typedef HashMap<FontCache::FontFileKey, RefPtr<OpenTypeVerticalData>, FontFileCacheKeyHash, FontFileCacheKeyTraits> FontVerticalDataCache;
+
+static FontVerticalDataCache& fontVerticalDataCacheInstance()
+{
     static NeverDestroyed<FontVerticalDataCache> fontVerticalDataCache;
     return fontVerticalDataCache;
 }

Modified: trunk/Source/WebCore/platform/graphics/FontCache.h (166363 => 166364)


--- trunk/Source/WebCore/platform/graphics/FontCache.h	2014-03-27 17:51:38 UTC (rev 166363)
+++ trunk/Source/WebCore/platform/graphics/FontCache.h	2014-03-27 18:06:21 UTC (rev 166364)
@@ -54,6 +54,7 @@
 class FontPlatformData;
 class FontData;
 class FontSelector;
+class OpenTypeMathData;
 class OpenTypeVerticalData;
 class SimpleFontData;
 
@@ -151,8 +152,9 @@
     PassRefPtr<SimpleFontData> fontDataFromDescriptionAndLogFont(const FontDescription&, ShouldRetain, const LOGFONT&, AtomicString& outFontFamilyName);
 #endif
 
+    typedef AtomicString FontFileKey;
+    PassRefPtr<OpenTypeMathData> getMathData(const FontFileKey&, const FontPlatformData&);
 #if ENABLE(OPENTYPE_VERTICAL)
-    typedef AtomicString FontFileKey;
     PassRefPtr<OpenTypeVerticalData> getVerticalData(const FontFileKey&, const FontPlatformData&);
 #endif
 

Modified: trunk/Source/WebCore/platform/graphics/FontPlatformData.cpp (166363 => 166364)


--- trunk/Source/WebCore/platform/graphics/FontPlatformData.cpp	2014-03-27 17:51:38 UTC (rev 166363)
+++ trunk/Source/WebCore/platform/graphics/FontPlatformData.cpp	2014-03-27 18:06:21 UTC (rev 166364)
@@ -27,6 +27,11 @@
 #include <wtf/text/StringHash.h>
 #include <wtf/text/WTFString.h>
 
+#if OS(DARWIN) && USE(CG)
+#include "SharedBuffer.h"
+#include <CoreGraphics/CGFont.h>
+#endif
+
 namespace WebCore {
 
 FontPlatformData::FontPlatformData(WTF::HashTableDeletedValueType)
@@ -169,4 +174,14 @@
     return platformDataAssign(other);
 }
 
+#if OS(DARWIN) && USE(CG)
+PassRefPtr<SharedBuffer> FontPlatformData::openTypeTable(uint32_t table) const
+{
+    if (CFDataRef data = "" table))
+        return SharedBuffer::wrapCFData(data);
+    
+    return nullptr;
 }
+#endif
+
+}

Modified: trunk/Source/WebCore/platform/graphics/FontPlatformData.h (166363 => 166364)


--- trunk/Source/WebCore/platform/graphics/FontPlatformData.h	2014-03-27 17:51:38 UTC (rev 166363)
+++ trunk/Source/WebCore/platform/graphics/FontPlatformData.h	2014-03-27 18:06:21 UTC (rev 166364)
@@ -216,7 +216,7 @@
 #endif
     }
 
-#if PLATFORM(WIN) && (USE(CG) || USE(CAIRO))
+#if (OS(DARWIN) && USE(CG)) || (PLATFORM(WIN) && (USE(CG) || USE(CAIRO)))
     PassRefPtr<SharedBuffer> openTypeTable(uint32_t table) const;
 #endif
 

Modified: trunk/Source/WebCore/platform/graphics/SimpleFontData.cpp (166363 => 166364)


--- trunk/Source/WebCore/platform/graphics/SimpleFontData.cpp	2014-03-27 17:51:38 UTC (rev 166363)
+++ trunk/Source/WebCore/platform/graphics/SimpleFontData.cpp	2014-03-27 18:06:21 UTC (rev 166364)
@@ -32,6 +32,7 @@
 
 #include "Font.h"
 #include "FontCache.h"
+#include "OpenTypeMathData.h"
 #include <wtf/MathExtras.h>
 
 #if ENABLE(OPENTYPE_VERTICAL)
@@ -52,6 +53,7 @@
     , m_isLoading(isLoading)
     , m_isTextOrientationFallback(isTextOrientationFallback)
     , m_isBrokenIdeographFallback(false)
+    , m_mathData(nullptr)
 #if ENABLE(OPENTYPE_VERTICAL)
     , m_verticalData(0)
 #endif
@@ -60,6 +62,18 @@
     platformInit();
     platformGlyphInit();
     platformCharWidthInit();
+
+    bool tryMathData = false;
+#if PLATFORM(WIN) && (USE(CG) || USE(CAIRO))
+    tryMathData = platformData.hfont();
+#elif OS(DARWIN) && USE(CG)
+    tryMathData = platformData.font();
+#elif USE(FREETYPE)
+    tryMathData = platformData.hash();
+#endif
+    if (tryMathData)
+        m_mathData = fontCache()->getMathData(String::number(platformData.hash()), platformData);
+
 #if ENABLE(OPENTYPE_VERTICAL)
     if (platformData.orientation() == Vertical && !isTextOrientationFallback) {
         m_verticalData = platformData.verticalData();
@@ -76,6 +90,7 @@
     , m_isLoading(false)
     , m_isTextOrientationFallback(false)
     , m_isBrokenIdeographFallback(false)
+    , m_mathData(nullptr)
 #if ENABLE(OPENTYPE_VERTICAL)
     , m_verticalData(0)
 #endif

Modified: trunk/Source/WebCore/platform/graphics/SimpleFontData.h (166363 => 166364)


--- trunk/Source/WebCore/platform/graphics/SimpleFontData.h	2014-03-27 17:51:38 UTC (rev 166363)
+++ trunk/Source/WebCore/platform/graphics/SimpleFontData.h	2014-03-27 18:06:21 UTC (rev 166364)
@@ -32,6 +32,7 @@
 #include "GlyphBuffer.h"
 #include "GlyphMetricsMap.h"
 #include "GlyphPageTreeNode.h"
+#include "OpenTypeMathData.h"
 #if ENABLE(OPENTYPE_VERTICAL)
 #include "OpenTypeVerticalData.h"
 #endif
@@ -92,6 +93,7 @@
     static const SimpleFontData* systemFallback() { return reinterpret_cast<const SimpleFontData*>(-1); }
 
     const FontPlatformData& platformData() const { return m_platformData; }
+    const OpenTypeMathData* mathData() const { return m_mathData ? m_mathData.get() : nullptr; }
 #if ENABLE(OPENTYPE_VERTICAL)
     const OpenTypeVerticalData* verticalData() const { return m_verticalData.get(); }
 #endif
@@ -259,6 +261,7 @@
 
     bool m_isTextOrientationFallback;
     bool m_isBrokenIdeographFallback;
+    RefPtr<OpenTypeMathData> m_mathData;
 #if ENABLE(OPENTYPE_VERTICAL)
     RefPtr<OpenTypeVerticalData> m_verticalData;
 #endif

Added: trunk/Source/WebCore/platform/graphics/opentype/OpenTypeMathData.cpp (0 => 166364)


--- trunk/Source/WebCore/platform/graphics/opentype/OpenTypeMathData.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/opentype/OpenTypeMathData.cpp	2014-03-27 18:06:21 UTC (rev 166364)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2014 Frederic Wang (fred.w...@free.fr). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "OpenTypeMathData.h"
+
+#include "FontPlatformData.h"
+
+using namespace std;
+
+namespace WebCore {
+
+OpenTypeMathData::OpenTypeMathData(const FontPlatformData&)
+{
+    // FIXME: We should read the data from the MATH table (https://bugs.webkit.org/show_bug.cgi?id=130324).
+    m_mathBuffer = nullptr;
+}
+
+} // namespace WebCore
Property changes on: trunk/Source/WebCore/platform/graphics/opentype/OpenTypeMathData.cpp
___________________________________________________________________

Added: svn:eol-style

Added: trunk/Source/WebCore/platform/graphics/opentype/OpenTypeMathData.h (0 => 166364)


--- trunk/Source/WebCore/platform/graphics/opentype/OpenTypeMathData.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/opentype/OpenTypeMathData.h	2014-03-27 18:06:21 UTC (rev 166364)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2014 Frederic Wang (fred.w...@free.fr). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef OpenTypeMathData_h
+#define OpenTypeMathData_h
+
+#include "SharedBuffer.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class FontPlatformData;
+
+class OpenTypeMathData : public RefCounted<OpenTypeMathData> {
+public:
+    static PassRefPtr<OpenTypeMathData> create(const FontPlatformData& fontData)
+    {
+        return adoptRef(new OpenTypeMathData(fontData));
+    }
+
+    bool hasMathData() const { return m_mathBuffer; }
+
+private:
+    explicit OpenTypeMathData(const FontPlatformData&);
+    RefPtr<SharedBuffer> m_mathBuffer;
+};
+
+} // namespace WebCore
+
+#endif // OpenTypeMathData_h
Property changes on: trunk/Source/WebCore/platform/graphics/opentype/OpenTypeMathData.h
___________________________________________________________________

Added: svn:eol-style

_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to