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