diff options
author | Ben Murdoch <benm@google.com> | 2011-06-02 12:07:03 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-06-10 10:47:21 +0100 |
commit | 2daae5fd11344eaa88a0d92b0f6d65f8d2255c00 (patch) | |
tree | e4964fbd1cb70599f7718ff03e50ea1dab33890b /Source/WebCore/platform/graphics/chromium/FontUtilsChromiumWin.cpp | |
parent | 87bdf0060a247bfbe668342b87e0874182e0ffa9 (diff) | |
download | external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.zip external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.gz external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.bz2 |
Merge WebKit at r84325: Initial merge by git.
Change-Id: Ic1a909300ecc0a13ddc6b4e784371d2ac6e3d59b
Diffstat (limited to 'Source/WebCore/platform/graphics/chromium/FontUtilsChromiumWin.cpp')
-rw-r--r-- | Source/WebCore/platform/graphics/chromium/FontUtilsChromiumWin.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/Source/WebCore/platform/graphics/chromium/FontUtilsChromiumWin.cpp b/Source/WebCore/platform/graphics/chromium/FontUtilsChromiumWin.cpp index bea0572..a4798dd 100644 --- a/Source/WebCore/platform/graphics/chromium/FontUtilsChromiumWin.cpp +++ b/Source/WebCore/platform/graphics/chromium/FontUtilsChromiumWin.cpp @@ -250,17 +250,31 @@ int getAscent(HFONT hfont) return gotMetrics ? tm.tmAscent : kUndefinedAscent; } +WORD getSpaceGlyph(HFONT hfont) +{ + HDC dc = GetDC(0); + HGDIOBJ oldFont = SelectObject(dc, hfont); + WCHAR space = L' '; + WORD spaceGlyph = 0; + GetGlyphIndices(dc, &space, 1, &spaceGlyph, 0); + SelectObject(dc, oldFont); + ReleaseDC(0, dc); + return spaceGlyph; +} + struct FontData { FontData() : hfont(0) , ascent(kUndefinedAscent) , scriptCache(0) + , spaceGlyph(0) { } HFONT hfont; int ascent; mutable SCRIPT_CACHE scriptCache; + WORD spaceGlyph; }; // Again, using hash_map does not earn us much here. page_cycler_test intl2 @@ -379,7 +393,8 @@ bool getDerivedFontData(const UChar* family, LOGFONT* logfont, int* ascent, HFONT* hfont, - SCRIPT_CACHE** scriptCache) + SCRIPT_CACHE** scriptCache, + WORD* spaceGlyph) { ASSERT(logfont); ASSERT(family); @@ -408,6 +423,7 @@ bool getDerivedFontData(const UChar* family, // cache it so that we won't have to call CreateFontIndirect once // more for HFONT next time. derived->ascent = getAscent(derived->hfont); + derived->spaceGlyph = getSpaceGlyph(derived->hfont); } else { derived = &iter->second; // Last time, GetAscent failed so that only HFONT was @@ -419,6 +435,7 @@ bool getDerivedFontData(const UChar* family, *hfont = derived->hfont; *ascent = derived->ascent; *scriptCache = &(derived->scriptCache); + *spaceGlyph = derived->spaceGlyph; return *ascent != kUndefinedAscent; } |