summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/win/SimpleFontDataWin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform/graphics/win/SimpleFontDataWin.cpp')
-rw-r--r--WebCore/platform/graphics/win/SimpleFontDataWin.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/WebCore/platform/graphics/win/SimpleFontDataWin.cpp b/WebCore/platform/graphics/win/SimpleFontDataWin.cpp
index 9d5c3b9..9835e9f 100644
--- a/WebCore/platform/graphics/win/SimpleFontDataWin.cpp
+++ b/WebCore/platform/graphics/win/SimpleFontDataWin.cpp
@@ -63,7 +63,7 @@ bool SimpleFontData::shouldApplyMacAscentHack()
void SimpleFontData::initGDIFont()
{
HDC hdc = GetDC(0);
- HGDIOBJ oldFont = SelectObject(hdc, m_font.hfont());
+ HGDIOBJ oldFont = SelectObject(hdc, m_platformData.hfont());
OUTLINETEXTMETRIC metrics;
GetOutlineTextMetrics(hdc, sizeof(metrics), &metrics);
TEXTMETRIC& textMetrics = metrics.otmTextMetrics;
@@ -71,6 +71,8 @@ void SimpleFontData::initGDIFont()
m_descent = textMetrics.tmDescent;
m_lineGap = textMetrics.tmExternalLeading;
m_lineSpacing = m_ascent + m_descent + m_lineGap;
+ m_avgCharWidth = textMetrics.tmAveCharWidth;
+ m_maxCharWidth = textMetrics.tmMaxCharWidth;
m_xHeight = m_ascent * 0.56f; // Best guess for xHeight if no x glyph is present.
GLYPHMETRICS gm;
@@ -100,17 +102,17 @@ void SimpleFontData::platformCommonDestroy()
SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDescription) const
{
if (!m_smallCapsFontData) {
- float smallCapsHeight = cSmallCapsFontSizeMultiplier * m_font.size();
+ float smallCapsHeight = cSmallCapsFontSizeMultiplier * m_platformData.size();
if (isCustomFont()) {
- FontPlatformData smallCapsFontData(m_font);
+ FontPlatformData smallCapsFontData(m_platformData);
smallCapsFontData.setSize(smallCapsHeight);
m_smallCapsFontData = new SimpleFontData(smallCapsFontData, true, false);
} else {
LOGFONT winfont;
- GetObject(m_font.hfont(), sizeof(LOGFONT), &winfont);
- winfont.lfHeight = -lroundf(smallCapsHeight * (m_font.useGDI() ? 1 : 32));
+ GetObject(m_platformData.hfont(), sizeof(LOGFONT), &winfont);
+ winfont.lfHeight = -lroundf(smallCapsHeight * (m_platformData.useGDI() ? 1 : 32));
HFONT hfont = CreateFontIndirect(&winfont);
- m_smallCapsFontData = new SimpleFontData(FontPlatformData(hfont, smallCapsHeight, m_font.syntheticBold(), m_font.syntheticOblique(), m_font.useGDI()));
+ m_smallCapsFontData = new SimpleFontData(FontPlatformData(hfont, smallCapsHeight, m_platformData.syntheticBold(), m_platformData.syntheticOblique(), m_platformData.useGDI()));
}
}
return m_smallCapsFontData;
@@ -135,7 +137,7 @@ bool SimpleFontData::containsCharacters(const UChar* characters, int length) con
langFontLink->CodePageToCodePages(CP_ACP, &acpCodePages);
DWORD fontCodePages;
- langFontLink->GetFontCodePages(dc, m_font.hfont(), &fontCodePages);
+ langFontLink->GetFontCodePages(dc, m_platformData.hfont(), &fontCodePages);
DWORD actualCodePages;
long numCharactersProcessed;
@@ -162,7 +164,7 @@ void SimpleFontData::determinePitch()
// TEXTMETRICS have this. Set m_treatAsFixedPitch based off that.
HDC dc = GetDC(0);
SaveDC(dc);
- SelectObject(dc, m_font.hfont());
+ SelectObject(dc, m_platformData.hfont());
// Yes, this looks backwards, but the fixed pitch bit is actually set if the font
// is *not* fixed pitch. Unbelievable but true.
@@ -178,7 +180,7 @@ float SimpleFontData::widthForGDIGlyph(Glyph glyph) const
{
HDC hdc = GetDC(0);
SetGraphicsMode(hdc, GM_ADVANCED);
- HGDIOBJ oldFont = SelectObject(hdc, m_font.hfont());
+ HGDIOBJ oldFont = SelectObject(hdc, m_platformData.hfont());
int width;
GetCharWidthI(hdc, glyph, 1, 0, &width);
SelectObject(hdc, oldFont);
@@ -196,7 +198,7 @@ SCRIPT_FONTPROPERTIES* SimpleFontData::scriptFontProperties() const
if (result == E_PENDING) {
HDC dc = GetDC(0);
SaveDC(dc);
- SelectObject(dc, m_font.hfont());
+ SelectObject(dc, m_platformData.hfont());
ScriptGetFontProperties(dc, scriptCache(), m_scriptFontProperties);
RestoreDC(dc, -1);
ReleaseDC(0, dc);