diff options
| -rw-r--r-- | doc/ScintillaDoc.html | 12 | ||||
| -rw-r--r-- | doc/ScintillaHistory.html | 3 | ||||
| -rw-r--r-- | win32/PlatWin.cxx | 20 | ||||
| -rw-r--r-- | win32/ScintillaWin.cxx | 12 | 
4 files changed, 30 insertions, 17 deletions
| diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 1afc6d77e..ed66afa69 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -82,7 +82,7 @@      <h1>Scintilla Documentation</h1> -    <p>Last edited 24 November 2014 NH</p> +    <p>Last edited 10 January 2015 NH</p>      <p>There is <a class="jump" href="Design.html">an overview of the internal design of      Scintilla</a>.<br /> @@ -2577,11 +2577,15 @@ struct Sci_TextToFind {      <b id="SCI_STYLEGETITALIC">SCI_STYLEGETITALIC(int styleNumber)</b><br />       These messages (plus <a class="message"      href="#SCI_STYLESETCHARACTERSET"><code>SCI_STYLESETCHARACTERSET</code></a>) set the font -    attributes that are used to match the fonts you request to those available. The +    attributes that are used to match the fonts you request to those available.</p> +    <p>The      <code>fontName</code> is a zero terminated string holding the name of a font. Under Windows, -    only the first 32 characters of the name are used and the name is not case sensitive. For +    only the first 32 characters of the name are used, the name is decoded as UTF-8, and the name is not case sensitive. For      internal caching, Scintilla tracks fonts by name and does care about the casing of font names, -    so please be consistent. On GTK+, Pango is used to display text.</p> +    so please be consistent. +    On GTK+, Pango is used to display text and the name is sent directly to Pango without transformation. +    On Qt, the name is decoded as UTF-8. +    On Cocoa, the name is decoded as MacRoman.</p>      <p>Sizes can be set to a whole number of points with <code>SCI_STYLESETSIZE</code>      or to a fractional point size in hundredths of a point with <code>SCI_STYLESETSIZEFRACTIONAL</code>      by multiplying the size by 100 (<code>SC_FONT_SIZE_MULTIPLIER</code>). diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index c4d420452..b51dc04bd 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -510,6 +510,9 @@  	When a text margin is displayed, for annotation lines, use the background colour of the base line.  	</li>  	<li> +	On Windows GDI, assume font names are encoded in UTF-8. This matches the Direct2D code path. +	</li> +	<li>  	Fix paste for GTK+ on OS X.  	<a href="http://sourceforge.net/p/scintilla/bugs/1677/">Bug #1677</a>.  	</li> 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() { diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 070ab0fb2..0dd715d6d 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -2459,7 +2459,7 @@ void ScintillaWin::ImeStartComposition() {  			// Since the style creation code has been made platform independent,  			// The logfont for the IME is recreated here.  			int styleHere = (pdoc->StyleAt(sel.MainCaret())) & 31; -			LOGFONTA lf = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ""}; +			LOGFONTW lf = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, L""};  			int sizeZoomed = vs.styles[styleHere].size + vs.zoomLevel * SC_FONT_SIZE_MULTIPLIER;  			if (sizeZoomed <= 2 * SC_FONT_SIZE_MULTIPLIER)	// Hangs if sizeZoomed <= 1  				sizeZoomed = 2 * SC_FONT_SIZE_MULTIPLIER; @@ -2473,11 +2473,13 @@ void ScintillaWin::ImeStartComposition() {  			lf.lfWeight = vs.styles[styleHere].weight;  			lf.lfItalic = static_cast<BYTE>(vs.styles[styleHere].italic ? 1 : 0);  			lf.lfCharSet = DEFAULT_CHARSET; -			lf.lfFaceName[0] = '\0'; -			if (vs.styles[styleHere].fontName) -				StringCopy(lf.lfFaceName, vs.styles[styleHere].fontName); +			lf.lfFaceName[0] = L'\0'; +			if (vs.styles[styleHere].fontName) { +				const char* fontName = vs.styles[styleHere].fontName; +				UTF16FromUTF8(fontName, strlen(fontName)+1, lf.lfFaceName, LF_FACESIZE); +			} -			::ImmSetCompositionFontA(hIMC, &lf); +			::ImmSetCompositionFontW(hIMC, &lf);  		}  		::ImmReleaseContext(MainHWND(), hIMC);  		// Caret is displayed in IME window. So, caret in Scintilla is useless. | 
