Reviewed by John Sullivan.
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Jan 2008 15:16:41 +0000 (15:16 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Jan 2008 15:16:41 +0000 (15:16 +0000)
        - make the ATSUI code path work with custom fonts rather than crash

        * platform/graphics/mac/FontCustomPlatformData.cpp:
        (WebCore::FontCustomPlatformData::fontPlatformData):
        * platform/graphics/mac/FontMac.mm:
        (WebCore::initializeATSUStyle):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@29227 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/graphics/mac/FontCustomPlatformData.cpp
WebCore/platform/graphics/mac/FontMac.mm

index 5daa01fba6a6ae6830954027b37f783a91462582..fb6431c83a2d4be8c16533ad3322903e66385a66 100644 (file)
@@ -1,3 +1,14 @@
+2008-01-07  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by John Sullivan.
+
+        - make the ATSUI code path work with custom fonts rather than crash
+
+        * platform/graphics/mac/FontCustomPlatformData.cpp:
+        (WebCore::FontCustomPlatformData::fontPlatformData):
+        * platform/graphics/mac/FontMac.mm:
+        (WebCore::initializeATSUStyle):
+
 2008-01-07  Thiago Macieira  <thiago.macieira@trolltech.com>
 
         Reviewed by Simon.
index 439af5049c19fba218c4e046d208d39a521145e7..0f61e9a2505e8904cd7aeec9a48d51a02729c90b 100644 (file)
@@ -35,7 +35,7 @@ FontCustomPlatformData::~FontCustomPlatformData()
 
 FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic)
 {
-    return FontPlatformData(m_cgFont, (ATSUFontID)m_atsFont, size, bold, italic);
+    return FontPlatformData(m_cgFont, FMGetFontFromATSFontRef(m_atsFont), size, bold, italic);
 }
 
 FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
index 0df24e65c28ca1429cf2c2e9c613d606d10dc78f..3415e41a7df43a6132ac1333597511293a8f20fc 100644 (file)
@@ -106,7 +106,7 @@ static void initializeATSUStyle(const FontData* fontData)
         if (status != noErr)
             LOG_ERROR("ATSUCreateStyle failed (%d)", status);
     
-        ATSUFontID fontID = wkGetNSFontATSUFontId(fontData->m_font.font());
+        ATSUFontID fontID = fontData->platformData().m_atsuFontID;
         if (fontID == 0) {
             ATSUDisposeStyle(fontData->m_ATSUStyle);
             LOG_ERROR("unable to get ATSUFontID for %@", fontData->m_font.font());
@@ -116,7 +116,8 @@ static void initializeATSUStyle(const FontData* fontData)
         CGAffineTransform transform = CGAffineTransformMakeScale(1, -1);
         if (fontData->m_font.m_syntheticOblique)
             transform = CGAffineTransformConcat(transform, CGAffineTransformMake(1, 0, -tanf(SYNTHETIC_OBLIQUE_ANGLE * acosf(0) / 90), 1, 0, 0)); 
-        Fixed fontSize = FloatToFixed([fontData->m_font.font() pointSize]);
+        Fixed fontSize = FloatToFixed(fontData->platformData().m_size);
+
         // Turn off automatic kerning until it is supported in the CG code path (6136 in bugzilla)
         Fract kerningInhibitFactor = FloatToFract(1.0);
         ATSUAttributeTag styleTags[4] = { kATSUSizeTag, kATSUFontTag, kATSUFontMatrixTag, kATSUKerningInhibitFactorTag };