[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Wed Apr 7 23:32:52 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 679ae49fbceec5d5712e113a5e431217cb7916c3
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Nov 12 03:20:15 2009 +0000

    2009-11-11  Yusuke Sato  <yusukes at chromium.org>
    
            Reviewed by Adam Barth.
    
            [chromium] Remove t2embed.dll functions from FontCustomPlatformData.cpp for Chromium
            https://bugs.webkit.org/show_bug.cgi?id=31345
    
            Remove dependency on t2embed.dll so that Chromium for Windows can start even if t2embed.dll cannot be accessed.
    
            * platform/graphics/chromium/FontCustomPlatformData.cpp:
            (WebCore::FontCustomPlatformData::~FontCustomPlatformData): Remove TTDeleteEmbeddedFont() call. Always use RemoveFontMemResourceEx().
            (WebCore::FontCustomPlatformData::fontPlatformData): Remove TTGetNewFontName() call.
            (WebCore::createFontCustomPlatformData): Remove TTLoadEmbeddedFont() call. Always use AddFontMemResourceEx() via renameAndActivateFont() in opentype/OpenTypeUtility.h. Remove EOTStream class as well.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50859 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 4fa6b05..1dbce8d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2009-11-11  Yusuke Sato  <yusukes at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        [chromium] Remove t2embed.dll functions from FontCustomPlatformData.cpp for Chromium
+        https://bugs.webkit.org/show_bug.cgi?id=31345
+
+        Remove dependency on t2embed.dll so that Chromium for Windows can start even if t2embed.dll cannot be accessed.
+
+        * platform/graphics/chromium/FontCustomPlatformData.cpp:
+        (WebCore::FontCustomPlatformData::~FontCustomPlatformData): Remove TTDeleteEmbeddedFont() call. Always use RemoveFontMemResourceEx().
+        (WebCore::FontCustomPlatformData::fontPlatformData): Remove TTGetNewFontName() call.
+        (WebCore::createFontCustomPlatformData): Remove TTLoadEmbeddedFont() call. Always use AddFontMemResourceEx() via renameAndActivateFont() in opentype/OpenTypeUtility.h. Remove EOTStream class as well.
+
 2009-11-11  Beth Dakin  <bdakin at apple.com>
 
         Build fix. No review needed.
diff --git a/WebCore/platform/graphics/chromium/FontCustomPlatformData.cpp b/WebCore/platform/graphics/chromium/FontCustomPlatformData.cpp
index 88035d5..4081521 100644
--- a/WebCore/platform/graphics/chromium/FontCustomPlatformData.cpp
+++ b/WebCore/platform/graphics/chromium/FontCustomPlatformData.cpp
@@ -46,8 +46,6 @@
 
 #if PLATFORM(WIN_OS)
 #include <objbase.h>
-#include <t2embapi.h>
-#pragma comment(lib, "t2embed")
 #elif PLATFORM(LINUX)
 #include <cstring>
 #endif
@@ -57,13 +55,8 @@ namespace WebCore {
 FontCustomPlatformData::~FontCustomPlatformData()
 {
 #if PLATFORM(WIN_OS)
-    if (m_fontReference) {
-        if (m_name.isNull()) {
-            ULONG status;
-            TTDeleteEmbeddedFont(m_fontReference, 0, &status);
-        } else
-            RemoveFontMemResourceEx(m_fontReference);
-    }
+    if (m_fontReference)
+        RemoveFontMemResourceEx(m_fontReference);
 #elif PLATFORM(LINUX)
     if (m_fontReference)
         m_fontReference->unref();
@@ -76,19 +69,15 @@ FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, b
     ASSERT(m_fontReference);
 
     LOGFONT logFont;
-    if (m_name.isNull())
-        TTGetNewFontName(&m_fontReference, logFont.lfFaceName, LF_FACESIZE, 0, 0);
-    else {
-        // m_name comes from createUniqueFontName, which, in turn, gets
-        // it from base64-encoded uuid (128-bit). So, m_name
-        // can never be longer than LF_FACESIZE (32).
-        if (m_name.length() + 1 >= LF_FACESIZE) {
-            ASSERT_NOT_REACHED();
-            return FontPlatformData();
-        }
-        memcpy(logFont.lfFaceName, m_name.charactersWithNullTermination(),
-               sizeof(logFont.lfFaceName[0]) * (1 + m_name.length()));
+    // m_name comes from createUniqueFontName, which, in turn, gets
+    // it from base64-encoded uuid (128-bit). So, m_name
+    // can never be longer than LF_FACESIZE (32).
+    if (m_name.length() + 1 >= LF_FACESIZE) {
+        ASSERT_NOT_REACHED();
+        return FontPlatformData();
     }
+    memcpy(logFont.lfFaceName, m_name.charactersWithNullTermination(),
+           sizeof(logFont.lfFaceName[0]) * (1 + m_name.length()));
 
     // FIXME: almost identical to FillLogFont in FontCacheWin.cpp.
     // Need to refactor. 
@@ -119,69 +108,6 @@ FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, b
 }
 
 #if PLATFORM(WIN_OS)
-// FIXME: EOTStream class and static functions in this #if block are
-// duplicated from platform/graphics/win/FontCustomPlatformData.cpp
-// and need to be shared.
-
-// Streams the concatenation of a header and font data.
-class EOTStream {
-public:
-    EOTStream(const EOTHeader& eotHeader, const SharedBuffer* fontData, size_t overlayDst, size_t overlaySrc, size_t overlayLength)
-        : m_eotHeader(eotHeader)
-        , m_fontData(fontData)
-        , m_overlayDst(overlayDst)
-        , m_overlaySrc(overlaySrc)
-        , m_overlayLength(overlayLength)
-        , m_offset(0)
-        , m_inHeader(true)
-    {
-    }
-
-    size_t read(void* buffer, size_t count);
-
-private:
-    const EOTHeader& m_eotHeader;
-    const SharedBuffer* m_fontData;
-    size_t m_overlayDst;
-    size_t m_overlaySrc;
-    size_t m_overlayLength;
-    size_t m_offset;
-    bool m_inHeader;
-};
-
-size_t EOTStream::read(void* buffer, size_t count)
-{
-    size_t bytesToRead = count;
-    if (m_inHeader) {
-        size_t bytesFromHeader = std::min(m_eotHeader.size() - m_offset, count);
-        memcpy(buffer, m_eotHeader.data() + m_offset, bytesFromHeader);
-        m_offset += bytesFromHeader;
-        bytesToRead -= bytesFromHeader;
-        if (m_offset == m_eotHeader.size()) {
-            m_inHeader = false;
-            m_offset = 0;
-        }
-    }
-    if (bytesToRead && !m_inHeader) {
-        size_t bytesFromData = std::min(m_fontData->size() - m_offset, bytesToRead);
-        memcpy(buffer, m_fontData->data() + m_offset, bytesFromData);
-        if (m_offset < m_overlayDst + m_overlayLength && m_offset + bytesFromData >= m_overlayDst) {
-            size_t dstOffset = std::max<int>(m_overlayDst - m_offset, 0);
-            size_t srcOffset = std::max<int>(0, m_offset - m_overlayDst);
-            size_t bytesToCopy = std::min(bytesFromData - dstOffset, m_overlayLength - srcOffset);
-            memcpy(reinterpret_cast<char*>(buffer) + dstOffset, m_fontData->data() + m_overlaySrc + srcOffset, bytesToCopy);
-        }
-        m_offset += bytesFromData;
-        bytesToRead -= bytesFromData;
-    }
-    return count - bytesToRead;
-}
-
-static unsigned long WINAPIV readEmbedProc(void* stream, void* buffer, unsigned long length)
-{
-    return static_cast<EOTStream*>(stream)->read(buffer, length);
-}
-
 // Creates a unique and unpredictable font name, in order to avoid collisions and to
 // not allow access from CSS.
 static String createUniqueFontName()
@@ -246,37 +172,13 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
     ASSERT_ARG(buffer, buffer);
 
 #if PLATFORM(WIN_OS)
-    // Introduce the font to GDI. AddFontMemResourceEx cannot be used, because it will pollute the process's
+    // Introduce the font to GDI. AddFontMemResourceEx should be used with care, because it will pollute the process's
     // font namespace (Windows has no API for creating an HFONT from data without exposing the font to the
-    // entire process first). TTLoadEmbeddedFont lets us override the font family name, so using a unique name
-    // we avoid namespace collisions.
-
+    // entire process first).
     String fontName = createUniqueFontName();
-
-    // TTLoadEmbeddedFont works only with Embedded OpenType (.eot) data,
-    // so we need to create an EOT header and prepend it to the font data.
-    EOTHeader eotHeader;
-    size_t overlayDst;
-    size_t overlaySrc;
-    size_t overlayLength;
-
-    if (!getEOTHeader(buffer, eotHeader, overlayDst, overlaySrc, overlayLength))
+    HANDLE fontReference = renameAndActivateFont(buffer, fontName);
+    if (!fontReference)
         return 0;
-
-    HANDLE fontReference;
-    ULONG privStatus;
-    ULONG status;
-    EOTStream eotStream(eotHeader, buffer, overlayDst, overlaySrc, overlayLength);
-
-    LONG loadEmbeddedFontResult = TTLoadEmbeddedFont(&fontReference, TTLOAD_PRIVATE, &privStatus, LICENSE_PREVIEWPRINT, &status, readEmbedProc, &eotStream, const_cast<LPWSTR>(fontName.charactersWithNullTermination()), 0, 0);
-    if (loadEmbeddedFontResult == E_NONE)
-        fontName = String();
-    else {
-        fontReference = renameAndActivateFont(buffer, fontName);
-        if (!fontReference)
-            return 0;
-    }
-
     return new FontCustomPlatformData(fontReference, fontName);
 #elif PLATFORM(LINUX)
     RemoteFontStream stream(buffer);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list