Commit 1d791242 authored by bfulgham@webkit.org's avatar bfulgham@webkit.org

2009-06-12 Brent Fulgham <bfulgham@webkit.org>

        Reviewed by Eric Seidel.

        https://bugs.webkit.org/show_bug.cgi?id=26353
        Corrects handling of Cairo fonts that were getting out of
        sync due to default copy construction.  Also refactors
        some incorrect platform font destruction code that belongs
        in the font object's destructor.

        * platform/graphics/win/FontPlatformData.h:
        * platform/graphics/win/FontPlatformDataCGWin.cpp:
        (WebCore::FontPlatformData::~FontPlatformData):
        * platform/graphics/win/FontPlatformDataCairoWin.cpp:
        (WebCore::FontPlatformData::platformDataInit):
        (WebCore::FontPlatformData::FontPlatformData):
        (WebCore::FontPlatformData::setFont):
        (WebCore::FontPlatformData::~FontPlatformData):
        * platform/graphics/win/FontPlatformDataWin.cpp:
        * platform/graphics/win/SimpleFontDataCGWin.cpp:
        * platform/graphics/win/SimpleFontDataCairoWin.cpp:
        (WebCore::SimpleFontData::platformInit):
        (WebCore::SimpleFontData::platformWidthForGlyph):
        * platform/graphics/win/SimpleFontDataWin.cpp:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@44628 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a3a95dfb
2009-06-12 Brent Fulgham <bfulgham@webkit.org>
Reviewed by Eric Seidel.
https://bugs.webkit.org/show_bug.cgi?id=26353
Corrects handling of Cairo fonts that were getting out of
sync due to default copy construction. Also refactors
some incorrect platform font destruction code that belongs
in the font object's destructor.
* platform/graphics/win/FontPlatformData.h:
* platform/graphics/win/FontPlatformDataCGWin.cpp:
(WebCore::FontPlatformData::~FontPlatformData):
* platform/graphics/win/FontPlatformDataCairoWin.cpp:
(WebCore::FontPlatformData::platformDataInit):
(WebCore::FontPlatformData::FontPlatformData):
(WebCore::FontPlatformData::setFont):
(WebCore::FontPlatformData::~FontPlatformData):
* platform/graphics/win/FontPlatformDataWin.cpp:
* platform/graphics/win/SimpleFontDataCGWin.cpp:
* platform/graphics/win/SimpleFontDataCairoWin.cpp:
(WebCore::SimpleFontData::platformInit):
(WebCore::SimpleFontData::platformWidthForGlyph):
* platform/graphics/win/SimpleFontDataWin.cpp:
2009-06-12 Peter Kasting <pkasting@google.com>
Reviewed by Eric Seidel.
......@@ -24,7 +24,7 @@
#include <wtf/Platform.h>
#if PLATFORM(WIN_OS) && !defined(BUILDING_WX__) && !COMPILER(GCC)
#if PLATFORM(WIN_OS) && !defined(BUILDING_WX__)
#if defined(BUILDING_JavaScriptCore) || defined(BUILDING_WTF)
#define JS_EXPORTDATA __declspec(dllexport)
#else
......@@ -66,11 +66,11 @@
#endif
// CURL needs winsock, so don't prevent inclusion of it
#if !USE(CURL)
//#if !USE(CURL)
#ifndef _WINSOCKAPI_
#define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h
#endif
#endif
//#endif
#endif /* PLATFORM(WIN_OS) */
......@@ -107,12 +107,20 @@
#endif
#if PLATFORM(WIN)
#define WTF_PLATFORM_CF 1
#if 0
#define WTF_PLATFORM_CG 1
#undef WTF_PLATFORM_CAIRO
#define WTF_USE_CFNETWORK 1
#undef WTF_USE_CURL
#else
#undef WTF_PLATFORM_CG
#define WTF_PLATFORM_CAIRO 1
#undef WTF_USE_CFNETWORK
#define WTF_USE_CURL 1
#endif
#undef WTF_USE_PTHREADS
#undef WTF_USE_WININET
#define WTF_PLATFORM_CF 1
#define WTF_USE_PTHREADS 0
#endif
#if PLATFORM(MAC)
......
......@@ -64,6 +64,7 @@ public:
FontPlatformData(HFONT, CGFontRef, float size, bool bold, bool oblique, bool useGDI);
#elif PLATFORM(CAIRO)
FontPlatformData(cairo_font_face_t*, float size, bool bold, bool oblique);
FontPlatformData(const FontPlatformData&);
#endif
~FontPlatformData();
......
......@@ -137,4 +137,8 @@ FontPlatformData::FontPlatformData(HFONT hfont, CGFontRef font, float size, bool
{
}
FontPlatformData::~FontPlatformData()
{
}
}
......@@ -41,6 +41,7 @@ namespace WebCore {
void FontPlatformData::platformDataInit(HFONT font, float size, HDC hdc, WCHAR* faceName)
{
m_fontFace = cairo_win32_font_face_create_for_hfont(font);
cairo_matrix_t sizeMatrix, ctm;
cairo_matrix_init_identity(&ctm);
cairo_matrix_init_scale(&sizeMatrix, size, size);
......@@ -79,6 +80,17 @@ FontPlatformData::FontPlatformData(cairo_font_face_t* fontFace, float size, bool
cairo_font_options_destroy(options);
}
FontPlatformData::FontPlatformData(const FontPlatformData& source)
: m_font(source.m_font)
, m_size(source.m_size)
, m_fontFace(cairo_font_face_reference(source.m_fontFace))
, m_scaledFont(cairo_scaled_font_reference(source.m_scaledFont))
, m_syntheticBold(source.m_syntheticBold)
, m_syntheticOblique(source.m_syntheticOblique)
, m_useGDI(source.m_useGDI)
{
}
void FontPlatformData::setFont(cairo_t* cr) const
{
ASSERT(m_scaledFont);
......@@ -86,4 +98,10 @@ void FontPlatformData::setFont(cairo_t* cr) const
cairo_set_scaled_font(cr, m_scaledFont);
}
FontPlatformData::~FontPlatformData()
{
cairo_scaled_font_destroy(m_scaledFont);
cairo_font_face_destroy(m_fontFace);
}
}
......@@ -85,8 +85,4 @@ FontPlatformData::FontPlatformData(float size, bool bold, bool oblique)
{
}
FontPlatformData::~FontPlatformData()
{
}
}
......@@ -126,11 +126,6 @@ void SimpleFontData::platformCharWidthInit()
}
}
void SimpleFontData::platformDestroy()
{
platformCommonDestroy();
}
float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
{
if (m_platformData.useGDI())
......
......@@ -47,7 +47,6 @@ void SimpleFontData::platformInit()
m_scriptCache = 0;
m_scriptFontProperties = 0;
m_isSystemFont = false;
m_syntheticBoldOffset = 0;
m_syntheticBoldOffset = m_platformData.syntheticBold() ? 1.0f : 0.f;
......@@ -97,16 +96,6 @@ void SimpleFontData::platformCharWidthInit()
// charwidths are set in platformInit.
}
void SimpleFontData::platformDestroy()
{
cairo_font_face_destroy(m_platformData.fontFace());
cairo_scaled_font_destroy(m_platformData.scaledFont());
DeleteObject(m_platformData.hfont());
platformCommonDestroy();
}
float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
{
if (m_platformData.useGDI())
......
......@@ -89,7 +89,7 @@ void SimpleFontData::initGDIFont()
return;
}
void SimpleFontData::platformCommonDestroy()
void SimpleFontData::platformDestroy()
{
// We don't hash this on Win32, so it's effectively owned by us.
delete m_smallCapsFontData;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment