Changeset 166633 in webkit


Ignore:
Timestamp:
Apr 2, 2014 12:05:14 AM (10 years ago)
Author:
fred.wang@free.fr
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. 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/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:

(WebCore::SimpleFontData::SimpleFontData):
(WebCore::SimpleFontData::mathData): Initialize and return the math data.

  • 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):

Location:
trunk/Source/WebCore
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/CMakeLists.txt

    r166622 r166633  
    19481948    platform/graphics/filters/SourceGraphic.cpp
    19491949    platform/graphics/filters/SpotLightSource.cpp
     1950
     1951    platform/graphics/opentype/OpenTypeMathData.cpp
    19501952
    19511953    platform/graphics/texmap/TextureMapper.cpp
  • trunk/Source/WebCore/ChangeLog

    r166632 r166633  
     12014-04-02  Frédéric Wang  <fred.wang@free.fr>
     2
     3        Operator stretching: expose a math data API
     4        https://bugs.webkit.org/show_bug.cgi?id=130572
     5
     6        Reviewed by Chris Fleizach.
     7
     8        We expose a new SimpleFontData API to give access to the data from the
     9        OpenType MATH table. The class OpenTypeMathData will
     10        be implemented in bug 130324. On Darwin platform, we also implement the
     11        missing FontPlatformData::openTypeTable function which will be necessary
     12        to load the OpenType MATH table. The changes are intended to be used
     13        for MathML operator stretching (bug 130322) so tests are not added yet.
     14
     15        * CMakeLists.txt: add new OpenTypeMathData files.
     16        * WebCore.vcxproj/WebCore.vcxproj: ditto.
     17        * WebCore.vcxproj/WebCore.vcxproj.filters: ditto.
     18        * WebCore.xcodeproj/project.pbxproj: ditto.
     19        * platform/graphics/FontPlatformData.cpp:
     20        (WebCore::FontPlatformData::openTypeTable): We implement openTypeTable() on Darwin platform.
     21        * platform/graphics/FontPlatformData.h: We expose openTypeTable() on Darwin platform.
     22        * platform/graphics/SimpleFontData.cpp:
     23        (WebCore::SimpleFontData::SimpleFontData):
     24        (WebCore::SimpleFontData::mathData): Initialize and return the math data.
     25        * platform/graphics/SimpleFontData.h: We expose a mathData() function to access the MATH data.
     26        * platform/graphics/opentype/OpenTypeMathData.cpp: Added. This is a new class that will be used to parse the data from the OpenType MATH table.
     27        (WebCore::OpenTypeMathData::OpenTypeMathData):
     28        * platform/graphics/opentype/OpenTypeMathData.h: Added.
     29        (WebCore::OpenTypeMathData::create):
     30        (WebCore::OpenTypeMathData::hasMathData):
     31
    1322014-04-01  Mihnea Ovidenie  <mihnea@adobe.com>
    233
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj

    r166622 r166633  
    79907990    <ClCompile Include="..\platform\graphics\win\IntSizeWin.cpp" />
    79917991    <ClCompile Include="..\platform\graphics\win\MediaPlayerPrivateFullscreenWindow.cpp" />
     7992    <ClCompile Include="..\platform\graphics\opentype\OpenTypeMathData.cpp" />
    79927993    <ClCompile Include="..\platform\graphics\opentype\OpenTypeUtilities.cpp" />
    79937994    <ClCompile Include="..\platform\graphics\opentype\OpenTypeVerticalData.cpp" />
     
    1940719408    <ClInclude Include="..\platform\graphics\win\LocalWindowsContext.h" />
    1940819409    <CustomBuildStep Include="..\platform\graphics\win\MediaPlayerPrivateFullscreenWindow.h" />
     19410    <ClInclude Include="..\platform\graphics\opentype\OpenTypeMathData.h" />
    1940919411    <ClInclude Include="..\platform\graphics\opentype\OpenTypeTypes.h" />
    1941019412    <ClInclude Include="..\platform\graphics\opentype\OpenTypeUtilities.h" />
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters

    r166622 r166633  
    14831483      <Filter>platform\graphics\win</Filter>
    14841484    </ClCompile>
     1485    <ClCompile Include="..\platform\graphics\opentype\OpenTypeMathData.cpp">
     1486      <Filter>platform\graphics\win</Filter>
     1487    </ClCompile>
    14851488    <ClCompile Include="..\platform\graphics\opentype\OpenTypeUtilities.cpp">
    14861489      <Filter>platform\graphics\win</Filter>
     
    84488451    </ClInclude>
    84498452    <ClInclude Include="..\platform\graphics\win\LocalWindowsContext.h">
     8453      <Filter>platform\graphics\win</Filter>
     8454    </ClInclude>
     8455    <ClInclude Include="..\platform\graphics\opentype\OpenTypeMathData.h">
    84508456      <Filter>platform\graphics\win</Filter>
    84518457    </ClInclude>
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r166622 r166633  
    45954595                B2C3DA640D006CD600EF6F26 /* SimpleFontData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA530D006CD600EF6F26 /* SimpleFontData.cpp */; };
    45964596                B2C3DA650D006CD600EF6F26 /* SimpleFontData.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA540D006CD600EF6F26 /* SimpleFontData.h */; settings = {ATTRIBUTES = (Private, ); }; };
     4597                B2D3DA640D006CD600EF6F27 /* OpenTypeMathData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2D3DA530D006CD600EF6F27 /* OpenTypeMathData.cpp */; };
     4598                B2D3DA650D006CD600EF6F27 /* OpenTypeMathData.h in Headers */ = {isa = PBXBuildFile; fileRef = B2D3DA540D006CD600EF6F27 /* OpenTypeMathData.h */; settings = {ATTRIBUTES = (Private, ); }; };
    45974599                B2C3DA660D006CD600EF6F26 /* FontDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA550D006CD600EF6F26 /* FontDescription.h */; settings = {ATTRIBUTES = (Private, ); }; };
    45984600                B2C3DA670D006CD600EF6F26 /* FontGlyphs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA560D006CD600EF6F26 /* FontGlyphs.cpp */; };
     
    1184911851                B2C3DA530D006CD600EF6F26 /* SimpleFontData.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleFontData.cpp; sourceTree = "<group>"; };
    1185011852                B2C3DA540D006CD600EF6F26 /* SimpleFontData.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SimpleFontData.h; sourceTree = "<group>"; };
     11853                B2D3DA530D006CD600EF6F27 /* OpenTypeMathData.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = opentype/OpenTypeMathData.cpp; sourceTree = "<group>"; };
     11854                B2D3DA540D006CD600EF6F27 /* OpenTypeMathData.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = opentype/OpenTypeMathData.h; sourceTree = "<group>"; };
    1185111855                B2C3DA550D006CD600EF6F26 /* FontDescription.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FontDescription.h; sourceTree = "<group>"; };
    1185211856                B2C3DA560D006CD600EF6F26 /* FontGlyphs.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FontGlyphs.cpp; sourceTree = "<group>"; };
     
    2014120145                                B2C3DA530D006CD600EF6F26 /* SimpleFontData.cpp */,
    2014220146                                B2C3DA540D006CD600EF6F26 /* SimpleFontData.h */,
     20147                                B2D3DA530D006CD600EF6F27 /* OpenTypeMathData.cpp */,
     20148                                B2D3DA540D006CD600EF6F27 /* OpenTypeMathData.h */,
    2014320149                                CD641EB21818F5ED00EE4C41 /* SourceBufferPrivate.h */,
    2014420150                                CDC61DA0180867D8004B913F /* SourceBufferPrivate.h */,
     
    2548825494                                41D168EE10226E89009BC827 /* SharedWorkerThread.h in Headers */,
    2548925495                                B2C3DA650D006CD600EF6F26 /* SimpleFontData.h in Headers */,
     25496                                B2D3DA650D006CD600EF6F27 /* OpenTypeMathData.h in Headers */,
    2549025497                                E48944A3180B57D800F165D8 /* SimpleLineLayout.h in Headers */,
    2549125498                                E4E9B11D1814569C003ACCDF /* SimpleLineLayoutFunctions.h in Headers */,
     
    2885528862                                41D168ED10226E89009BC827 /* SharedWorkerThread.cpp in Sources */,
    2885628863                                B2C3DA640D006CD600EF6F26 /* SimpleFontData.cpp in Sources */,
     28864                                B2D3DA640D006CD600EF6F27 /* OpenTypeMathData.cpp in Sources */,
    2885728865                                163E88F7118A39D200ED9231 /* SimpleFontDataCoreText.cpp in Sources */,
    2885828866                                37E65950163B10C200EB4574 /* SimpleFontDataIOS.mm in Sources */,
  • trunk/Source/WebCore/platform/graphics/FontPlatformData.cpp

    r166381 r166633  
    2727#include <wtf/text/StringHash.h>
    2828#include <wtf/text/WTFString.h>
     29
     30#if OS(DARWIN) && USE(CG)
     31#include "SharedBuffer.h"
     32#include <CoreGraphics/CGFont.h>
     33#endif
    2934
    3035namespace WebCore {
     
    170175}
    171176
     177#if OS(DARWIN) && USE(CG)
     178PassRefPtr<SharedBuffer> FontPlatformData::openTypeTable(uint32_t table) const
     179{
     180    if (CFDataRef data = CGFontCopyTableForTag(cgFont(), table))
     181        return SharedBuffer::wrapCFData(data);
     182   
     183    return nullptr;
    172184}
     185#endif
     186
     187}
  • trunk/Source/WebCore/platform/graphics/FontPlatformData.h

    r166381 r166633  
    217217    }
    218218
    219 #if PLATFORM(WIN) && (USE(CG) || USE(CAIRO))
     219#if (OS(DARWIN) && USE(CG)) || (PLATFORM(WIN) && (USE(CG) || USE(CAIRO)))
    220220    PassRefPtr<SharedBuffer> openTypeTable(uint32_t table) const;
    221221#endif
  • trunk/Source/WebCore/platform/graphics/SimpleFontData.cpp

    r166381 r166633  
    3333#include "Font.h"
    3434#include "FontCache.h"
     35#include "OpenTypeMathData.h"
    3536#include <wtf/MathExtras.h>
    3637
     
    5354    , m_isTextOrientationFallback(isTextOrientationFallback)
    5455    , m_isBrokenIdeographFallback(false)
     56    , m_mathData(nullptr)
    5557#if ENABLE(OPENTYPE_VERTICAL)
    5658    , m_verticalData(0)
     
    7779    , m_isTextOrientationFallback(false)
    7880    , m_isBrokenIdeographFallback(false)
     81    , m_mathData(nullptr)
    7982#if ENABLE(OPENTYPE_VERTICAL)
    8083    , m_verticalData(0)
     
    256259}
    257260#endif
     261
     262const OpenTypeMathData* SimpleFontData::mathData() const
     263{
     264    if (!m_mathData) {
     265        m_mathData = OpenTypeMathData::create(m_platformData);
     266        if (!m_mathData->hasMathData())
     267            m_mathData.clear();
     268    }
     269    return m_mathData.get();
     270}
    258271
    259272PassOwnPtr<SimpleFontData::DerivedFontData> SimpleFontData::DerivedFontData::create(bool forCustomFont)
  • trunk/Source/WebCore/platform/graphics/SimpleFontData.h

    r166381 r166633  
    3333#include "GlyphMetricsMap.h"
    3434#include "GlyphPageTreeNode.h"
     35#include "OpenTypeMathData.h"
    3536#if ENABLE(OPENTYPE_VERTICAL)
    3637#include "OpenTypeVerticalData.h"
     
    9394
    9495    const FontPlatformData& platformData() const { return m_platformData; }
     96    const OpenTypeMathData* mathData() const;
    9597#if ENABLE(OPENTYPE_VERTICAL)
    9698    const OpenTypeVerticalData* verticalData() const { return m_verticalData.get(); }
     
    260262    bool m_isTextOrientationFallback;
    261263    bool m_isBrokenIdeographFallback;
     264    mutable RefPtr<OpenTypeMathData> m_mathData;
    262265#if ENABLE(OPENTYPE_VERTICAL)
    263266    RefPtr<OpenTypeVerticalData> m_verticalData;
Note: See TracChangeset for help on using the changeset viewer.