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++ Library support » U++ Libraries and TheIDE: i18n, Unicode and Internationalization » It's suspected to be an issue with Font.
Re: It's suspected to be an issue with Font. [message #32006 is a reply to message #32005] Sat, 16 April 2011 21:02 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
#include <CtrlLib/CtrlLib.h>

using namespace Upp;

struct MyApp : TopWindow {
	virtual void Paint(Draw& w) {
		w.DrawRect(GetSize(), White);
		w.DrawText(10, 10, "ultimate++是一个性能优良的C++GUI库");
	}
};

GUI_APP_MAIN
{
	MyApp().Run();
}



And this DDUMP

bool Replace(Font fnt, int chr, Font& rfnt)
{
	static Vector<int> rface;
	static Vector<dword> l, h;
	ONCELOCK {
		for(int i = 0; i < __countof(sFontReplacements) && rface.GetCount() < 20; i++) {
			int q = Font::FindFaceNameIndex(sFontReplacements[i].name);
			if(q > 0) {
				rface.Add(q);
				l.Add(sFontReplacements[i].l);
				h.Add(sFontReplacements[i].h);
			}
		}
	}

	Font f = fnt;
	dword tl = chr < 4096 ? 0x80000000 >> (chr >> 7) : 0;
	dword th = 0x8000000 >> ((dword)chr >> 11);
//	DDUMP(FormatIntHex(chr));
//	DDUMP(FormatIntHex(th));
	for(int i = 0; i < rface.GetCount(); i++) {
//		DDUMP(Font(rface[i], 10));
//		DDUMP(FormatIntHex(h[i]));
//		DDUMP(FormatIntHex(h[i] & th));
		if(((l[i] & tl) || (h[i] & th)) && IsNormal(f.Face(rface[i]), chr)) {
			int a = fnt.GetAscent();
			int d = fnt.GetDescent();
			if(f.GetAscent() > a || f.GetDescent() > d) {
				static sFontMetricsReplacement cache[256];
				int q = CombineHash(fnt, f) & 255;
				if(cache[q].src != fnt || cache[q].dst != f) {
					cache[q].src = fnt;
					cache[q].dst = f;
					while((f.GetAscent() > a || f.GetDescent() > d) && f.GetHeight() > 1) {
						f.Height(max(1, min(f.GetHeight() - 1, f.GetHeight() * 9 / 10)));
					}
					cache[q].mdst = f;
				}
				else
					f = cache[q].mdst;
			}
			rfnt = f;
			DDUMP(rfnt.GetFaceName()); // <<- HERE
			return true;
		}
	}
	return false;
}

[Updated on: Sat, 16 April 2011 21:03]

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
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
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: There are too short lines after synchronization. t files.
Next Topic: A proposal: Adding a Translation & Localization GUI to TheIDE
Goto Forum:
  


Current Time: Sat Apr 27 18:06:26 CEST 2024

Total time taken to generate the page: 0.03054 seconds