Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ TheIDE » U++ TheIDE: Installation, Compiling and Running of theide » About the automated build svn U++ 1469 on WinXP of Chinese version
Re: About the automated build svn U++ 1469 on WinXP of Chinese version [message #22707 is a reply to message #22671] Fri, 07 August 2009 13:03 Go to previous messageGo to previous message
kasome is currently offline  kasome
Messages: 78
Registered: July 2008
Location: Taiwan
Member
Sorry for the delay replying.

Now I add some DUMP and LOG in Font::FindFaceNameIndex of Font.cpp.

int  Font::FindFaceNameIndex(const String& name) {
	if(name == "STDFONT")
		return 0;
	DUMP(name);
	DUMP(name.GetLength());
	DUMP(GetFaceCount());
	for(int i = 1; i < GetFaceCount(); i++){
		LOG( "GetFaceName(" << i << ") = " << GetFaceName(i) );
		LOG( "GetFaceName(" << i << ").GetLength() = " << GetFaceName(i).GetLength() );
		if(GetFaceName(i) == name){
			return i;
		}
	}
	String n = Filter(name, FontFilter);
	for(int i = 1; i < GetFaceCount(); i++)
		if(Filter(GetFaceName(i), FontFilter) == n)
			return i;
	return 0;
}


i run the ide.exe and see the result log file as follows.
* c:\2009_08_10\MSC8.Debug.Debug_full.Gui\ide.exe 08.08.2009 18:39:20, user: kasome

name = 新細明體				==> the font we want to find ( it is encoded by "Big5",
					==> a local character encoding method used in Taiwan for
					==> Traditional Chinese characters )
name.GetLength() = 8			==> it's length is 8 (2 bytes for one Chinese character)
GetFaceCount() = 91
GetFaceName(1) = Times New Roman
GetFaceName(1).GetLength() = 15
GetFaceName(2) = Arial
GetFaceName(2).GetLength() = 5
GetFaceName(3) = Courier New
GetFaceName(3).GetLength() = 11
..........................
GetFaceName(44) = Sylfaen
GetFaceName(44).GetLength() = 7
GetFaceName(45) = 標楷體
GetFaceName(45).GetLength() = 9
GetFaceName(46) = 細明體
GetFaceName(46).GetLength() = 9
GetFaceName(47) = 新細明體		==> the matched font ( it is encoded by "UTF8" )
GetFaceName(47).GetLength() = 12	==> it's length is 12 (3 bytes for one Chinese character)
GetFaceName(48) = Microsoft Sans Serif
GetFaceName(48).GetLength() = 20
...........................

"新細明體" is a Chinese font name, which is stored in the variable "name" from the function "GetStdFontSys", and it is encoded by "Big5", and has the string length 8.

Also we can see the font name "新細明體" is matched from the string returned by GetFaceName(47), but it is encoded by UTF8, and has the string length 12.

So i guess all we have to do is just convert the big5 string to the utf8 string by the function "FromSystemCharset",and the matching will be successful.

Then I try to modify the code in FontWin32.cpp,
void GetStdFontSys(String& name, int& height)
{
#ifdef PLATFORM_WINCE
	name = "Arial";
	height = 10;
#else
	NONCLIENTMETRICS ncm;
	ncm.cbSize = sizeof(ncm);
	::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
//	name = ncm.lfMenuFont.lfFaceName;					==> original
	name = FromSystemCharset(ncm.lfMenuFont.lfFaceName);			==> modified
	height = abs((int)ncm.lfMenuFont.lfHeight);
#endif
}


Finally i recompile the modified code and run, it looks like perfect.
index.php?t=getfile&id=1876&private=0

Maybe there still some gently way to improve.
Thanks, Mirek. You are a nice teacher.
  • Attachment: final.jpg
    (Size: 31.70KB, Downloaded 575 times)

[Updated on: Sat, 08 August 2009 13:45]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Mingw/GCC 4.4.0 linker warnings
Next Topic: No texts rendered unless NOGTK flag is used
Goto Forum:
  


Current Time: Fri Jun 07 19:33:33 CEST 2024

Total time taken to generate the page: 0.02138 seconds