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 » Basic character set analyzer
Re: Basic character set analyzer [message #19997 is a reply to message #19996] Sun, 08 February 2009 12:55 Go to previous messageGo to previous message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
A little info about the second and final change I need to Draw.

I've added some fields to CharMetrics and some methods to FontInfo. These changes are ad-hoc hacks, and I really need a better integrated solution with proper names.
struct CharMetrics : Moveable<CharMetrics> {
		int  width;
		int  lspc;
		int  rspc;
		int  y;
		int  height;
		int  x;
		int  ew;
	
		bool operator==(const CharMetrics& b) const
		     { return width == b.width && lspc == b.lspc && rspc == b.rspc; }
	};

int        GetY(int c) const                  { return GetCM(c).y; }
	int        GetX(int c) const                  { return GetCM(c).x; }
	int        GetH(int c) const                  { return GetCM(c).height; }
	int        GetW(int c) const                  { return GetCM(c).ew; }	

These methods are used to determine the exact glyph bounding box, using this method:
inline Rect GetCharRect(int x, int y, int buff, const FontInfo& fi)
{
	return Rect(x - fi.GetX(buff), y - fi.GetY(buff) + fi.GetAscent(), x - fi.GetX(buff) + fi.GetW(buff), y - fi.GetY(buff) + fi.GetAscent() + fi.GetH(buff));
}

Also:
void FontInfo::Data::GetMetrics(CharMetrics *t, int from, int count)
{
	DrawLock __;
	LTIMING("GetMetrics");
	LLOG("GetMetrics " << font << " " << from << ", " << count);
	if(xftfont) {
		for(int i = 0; i < count; i++) {
			LTIMING("XftTextExtents16");
			wchar h = from + i;
			XGlyphInfo info;
			XftTextExtents16(Xdisplay, xftfont0, &h, 1, &info);
			t[i].width = info.xOff;
			t[i].lspc = -info.x;
			t[i].rspc = info.xOff - info.width + info.x;
			t[i].y = info.y;
			t[i].height = info.height;
			t[i].x = info.x;
			t[i].ew = info.width;
		}
	}
}

I don't know if we should cache this.

I'm posting this to show what I need, but before we apply it I really need to clean this up.
 
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: GetNativeLangName returns English for non-english languages
Next Topic: Improvements to several Lang.cpp functions
Goto Forum:
  


Current Time: Wed May 15 05:52:01 CEST 2024

Total time taken to generate the page: 0.02675 seconds