diff options
Diffstat (limited to 'win32/PlatWin.cxx')
| -rw-r--r-- | win32/PlatWin.cxx | 20 | 
1 files changed, 12 insertions, 8 deletions
| diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 4becdc507..7407d64f0 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -275,15 +275,15 @@ static D2D1_TEXT_ANTIALIAS_MODE DWriteMapFontQuality(int extraFontFlag) {  }  #endif -static void SetLogFont(LOGFONTA &lf, const char *faceName, int characterSet, float size, int weight, bool italic, int extraFontFlag) { -	lf = LOGFONTA(); +static void SetLogFont(LOGFONTW &lf, const char *faceName, int characterSet, float size, int weight, bool italic, int extraFontFlag) { +	lf = LOGFONTW();  	// The negative is to allow for leading  	lf.lfHeight = -(abs(static_cast<int>(size + 0.5)));  	lf.lfWeight = weight;  	lf.lfItalic = static_cast<BYTE>(italic ? 1 : 0);  	lf.lfCharSet = static_cast<BYTE>(characterSet);  	lf.lfQuality = Win32MapFontQuality(extraFontFlag); -	StringCopy(lf.lfFaceName, faceName); +	UTF16FromUTF8(faceName, strlen(faceName)+1, lf.lfFaceName, LF_FACESIZE);  }  /** @@ -306,7 +306,7 @@ class FontCached : Font {  	FontCached *next;  	int usage;  	float size; -	LOGFONTA lf; +	LOGFONTW lf;  	int technology;  	int hash;  	explicit FontCached(const FontParameters &fp); @@ -329,7 +329,7 @@ FontCached::FontCached(const FontParameters &fp) :  	hash = HashFont(fp);  	fid = 0;  	if (technology == SCWIN_TECH_GDI) { -		HFONT hfont = ::CreateFontIndirectA(&lf); +		HFONT hfont = ::CreateFontIndirectW(&lf);  		fid = reinterpret_cast<void *>(new FormatAndMetrics(hfont, fp.extraFontFlag, fp.characterSet));  	} else {  #if defined(USE_D2D) @@ -378,14 +378,18 @@ FontCached::FontCached(const FontParameters &fp) :  }  bool FontCached::SameAs(const FontParameters &fp) { -	return +	if (  		(size == fp.size) &&  		(lf.lfWeight == fp.weight) &&  		(lf.lfItalic == static_cast<BYTE>(fp.italic ? 1 : 0)) &&  		(lf.lfCharSet == fp.characterSet) &&  		(lf.lfQuality == Win32MapFontQuality(fp.extraFontFlag)) && -		(technology == fp.technology) && -		0 == strcmp(lf.lfFaceName,fp.faceName); +		(technology == fp.technology)) { +			wchar_t wszFace[LF_FACESIZE]; +			UTF16FromUTF8(fp.faceName, strlen(fp.faceName)+1, wszFace, LF_FACESIZE); +			return 0 == wcscmp(lf.lfFaceName,wszFace); +	} +	return false;  }  void FontCached::Release() { | 
