Commit 19da9a6f authored by mitz@apple.com's avatar mitz@apple.com

Reviewed by Maciej Stachowiak.

        - fix <rdar://problem/5333260> Some Chinese characters in Text Encoding menu are bold, others are not
          and <rdar://problem/5280188> Chinese text looks worse on Safari for Windows cf. Safari for Mac

        * platform/graphics/win/FontCacheWin.cpp:
        (WebCore::FontCache::getFontDataForCharacters): To ensure that font
        linking gives consistent results for characters that are exclusive to
        the simplified Chinese code page and characters that belong to that
        code page and other code pages, always ask to map to simplified Chinese
        alone first.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@28810 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 809e7a79
2007-12-17 Dan Bernstein <mitz@apple.com>
Reviewed by Maciej Stachowiak.
- fix <rdar://problem/5333260> Some Chinese characters in Text Encoding menu are bold, others are not
and <rdar://problem/5280188> Chinese text looks worse on Safari for Windows cf. Safari for Mac
* platform/graphics/win/FontCacheWin.cpp:
(WebCore::FontCache::getFontDataForCharacters): To ensure that font
linking gives consistent results for characters that are exclusive to
the simplified Chinese code page and characters that belong to that
code page and other code pages, always ask to map to simplified Chinese
alone first.
2007-12-17 Christian Dywan <christian@twotoasts.de>
Reviewed by Alp Toker.
......
......@@ -92,7 +92,21 @@ const FontData* FontCache::getFontDataForCharacters(const Font& font, const UCha
long cchActual;
langFontLink->GetStrCodePages(characters, length, acpCodePages, &actualCodePages, &cchActual);
if (cchActual) {
// If simplified Chinese is one of the actual code pages, make one call to MapFont() asking for
// simplified Chinese only (and ignore the result). This ensures that we get consistent answers
// for characters that are in the simplified Chinese code page as well as other code pages and
// characters that are exclusively in the simplified Chinese code page.
// FIXME: This needs to be done only once per primary font. We could set a bit in the FontPlatformData
// indicating that we have done this.
const UINT simplifiedChineseCP = 936;
UINT codePage;
HFONT result;
if (SUCCEEDED(langFontLink->CodePagesToCodePage(actualCodePages, simplifiedChineseCP, &codePage)) && codePage == simplifiedChineseCP) {
DWORD simplifiedChineseCodePages;
langFontLink->CodePageToCodePages(simplifiedChineseCP, &simplifiedChineseCodePages);
langFontLink->MapFont(hdc, simplifiedChineseCodePages, characters[0], &result);
langFontLink->ReleaseFont(result);
}
if (langFontLink->MapFont(hdc, actualCodePages, characters[0], &result) == S_OK) {
// Fill in a log font with the returned font from MLang, and then use that to create a new font.
LOGFONT lf;
......
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