Modified: trunk/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp (134452 => 134453)
--- trunk/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp 2012-11-13 19:29:40 UTC (rev 134452)
+++ trunk/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp 2012-11-13 19:31:14 UTC (rev 134453)
@@ -35,18 +35,10 @@
#include "FontDescription.h"
#include "HWndDC.h"
#include <mlang.h>
-#include <winsock2.h>
#include <wtf/MathExtras.h>
-#if USE(CG)
-#include <ApplicationServices/ApplicationServices.h>
-#include <WebKitSystemInterface/WebKitSystemInterface.h>
-#endif
-
namespace WebCore {
-using std::max;
-
const float cSmallCapsFontSizeMultiplier = 0.7f;
static bool g_shouldApplyMacAscentHack;
@@ -103,13 +95,13 @@
m_avgCharWidth = textMetrics.tmAveCharWidth;
m_maxCharWidth = textMetrics.tmMaxCharWidth;
float xHeight = ascent * 0.56f; // Best guess for xHeight if no x glyph is present.
-
+#if !OS(WINCE)
GLYPHMETRICS gm;
MAT2 mat = { 1, 0, 0, 1 };
DWORD len = GetGlyphOutline(hdc, 'x', GGO_METRICS, &gm, 0, 0, &mat);
if (len != GDI_ERROR && gm.gmptGlyphOrigin.y > 0)
xHeight = gm.gmptGlyphOrigin.y;
-
+#endif
m_fontMetrics.setXHeight(xHeight);
m_fontMetrics.setUnitsPerEm(metrics.otmEMSquare);
@@ -128,8 +120,10 @@
void SimpleFontData::platformDestroy()
{
+#if !OS(WINCE)
ScriptFreeCache(&m_scriptCache);
delete m_scriptFontProperties;
+#endif
}
PassRefPtr<SimpleFontData> SimpleFontData::createScaledFontData(const FontDescription& fontDescription, float scaleFactor) const
@@ -205,35 +199,50 @@
FloatRect SimpleFontData::boundsForGDIGlyph(Glyph glyph) const
{
+#if OS(WINCE)
+ return FloatRect();
+#else
HWndDC hdc(0);
SetGraphicsMode(hdc, GM_ADVANCED);
HGDIOBJ oldFont = SelectObject(hdc, m_platformData.hfont());
-
+
GLYPHMETRICS gdiMetrics;
static const MAT2 identity = { 0, 1, 0, 0, 0, 0, 0, 1 };
GetGlyphOutline(hdc, glyph, GGO_METRICS | GGO_GLYPH_INDEX, &gdiMetrics, 0, 0, &identity);
-
+
SelectObject(hdc, oldFont);
-
+
return FloatRect(gdiMetrics.gmptGlyphOrigin.x, -gdiMetrics.gmptGlyphOrigin.y,
gdiMetrics.gmBlackBoxX + m_syntheticBoldOffset, gdiMetrics.gmBlackBoxY);
+#endif
}
-
+
float SimpleFontData::widthForGDIGlyph(Glyph glyph) const
{
HWndDC hdc(0);
+#if !OS(WINCE)
SetGraphicsMode(hdc, GM_ADVANCED);
+#endif
HGDIOBJ oldFont = SelectObject(hdc, m_platformData.hfont());
+#if OS(WINCE)
+ WCHAR c = glyph;
+ SIZE fontSize;
+ GetTextExtentPoint32W(hdc, &c, 1, &fontSize);
+ float result = fontSize.cx * m_platformData.size() / 72.f;
+#else
GLYPHMETRICS gdiMetrics;
static const MAT2 identity = { 0, 1, 0, 0, 0, 0, 0, 1 };
GetGlyphOutline(hdc, glyph, GGO_METRICS | GGO_GLYPH_INDEX, &gdiMetrics, 0, 0, &identity);
+ float result = gdiMetrics.gmCellIncX + m_syntheticBoldOffset;
+#endif
SelectObject(hdc, oldFont);
- return gdiMetrics.gmCellIncX + m_syntheticBoldOffset;
+ return result;
}
+#if !OS(WINCE)
SCRIPT_FONTPROPERTIES* SimpleFontData::scriptFontProperties() const
{
if (!m_scriptFontProperties) {
@@ -251,5 +260,6 @@
}
return m_scriptFontProperties;
}
+#endif
-}
+} // namespace WebCore