From de70bd696156d78e7132ca9dedf35f462c01d68d Mon Sep 17 00:00:00 2001 From: "kmcclusk%netscape.com" Date: Wed, 15 Mar 2000 01:18:34 +0000 Subject: [PATCH] Changed call nsFontMetricsWin::GetFontWeightTable from ToCString to WideCharToMultiByte to support multibyte font names. b=28399 r=rods@netscape.com git-svn-id: svn://10.0.0.236/trunk@62957 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/gfx/src/windows/nsFontMetricsWin.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mozilla/gfx/src/windows/nsFontMetricsWin.cpp b/mozilla/gfx/src/windows/nsFontMetricsWin.cpp index be6d796fe0a..19d5c128b5b 100644 --- a/mozilla/gfx/src/windows/nsFontMetricsWin.cpp +++ b/mozilla/gfx/src/windows/nsFontMetricsWin.cpp @@ -1910,13 +1910,17 @@ static int CALLBACK nsFontWeightCallback(const LOGFONT* logFont, const TEXTMETRI return TRUE; // Keep looking for more weights. } + PRUint16 nsFontMetricsWin::GetFontWeightTable(HDC aDC, nsString* aFontName) { // Look for all of the weights for a given font. LOGFONT logFont; logFont.lfCharSet = DEFAULT_CHARSET; - aFontName->ToCString(logFont.lfFaceName, LF_FACESIZE); + + WideCharToMultiByte(CP_ACP, 0, aFontName->GetUnicode(), aFontName->Length() + 1, + logFont.lfFaceName, sizeof(logFont.lfFaceName), nsnull, nsnull); + logFont.lfPitchAndFamily = 0; PRUint16 weights = 0; @@ -1926,6 +1930,7 @@ nsFontMetricsWin::GetFontWeightTable(HDC aDC, nsString* aFontName) { } + // Calculate the closest font weight. This is necessary because we need to // control the mapping of logical font weight to available weight to handle both CSS2 // default algorithm + the case where a font weight is choosen which is not available then made