diff options
Diffstat (limited to 'win32/PlatWin.cxx')
| -rw-r--r-- | win32/PlatWin.cxx | 22 | 
1 files changed, 21 insertions, 1 deletions
| diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index aa1a4d656..9943471bd 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -133,7 +133,6 @@ static void SetLogFont(LOGFONT &lf, const char *faceName, int characterSet, int  	lf.lfItalic = static_cast<BYTE>(italic ? 1 : 0);  	lf.lfCharSet = static_cast<BYTE>(characterSet);  	strncpy(lf.lfFaceName, faceName, sizeof(lf.lfFaceName)); -	lf.lfQuality = NONANTIALIASED_QUALITY;  }  /** @@ -308,6 +307,7 @@ public:  	void DrawTextNoClip(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back);  	void DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back); +	void DrawTextTransparent(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore);  	void MeasureWidths(Font &font_, const char *s, int len, int *positions);  	int WidthText(Font &font_, const char *s, int len);  	int WidthChar(Font &font_, char ch); @@ -547,6 +547,26 @@ void SurfaceImpl::DrawTextClipped(PRectangle rc, Font &font_, int ybase, const c  	}  } +void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font_, int ybase, const char *s, int len, +	ColourAllocated fore) { +	SetFont(font_); +	::SetTextColor(hdc, fore.AsLong()); +	::SetBkMode(hdc, TRANSPARENT); +	RECT rcw = RectFromPRectangle(rc); +	if (unicodeMode) { +		wchar_t tbuf[MAX_US_LEN]; +		int tlen = UCS2FromUTF8(s, len, tbuf, sizeof(tbuf)/sizeof(wchar_t)-1); +		tbuf[tlen] = L'\0'; +		::ExtTextOutW(hdc, rc.left, ybase, 0, &rcw, tbuf, tlen, NULL); +	} else { +		// There appears to be a 16 bit string length limit in GDI +		if (len > 65535) +			len = 65535; +		::ExtTextOut(hdc, rc.left, ybase, 0, &rcw, s, len, NULL); +	} +	::SetBkMode(hdc, OPAQUE); +} +  int SurfaceImpl::WidthText(Font &font_, const char *s, int len) {  	SetFont(font_);  	SIZE sz={0,0}; | 
