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 #20012 is a reply to message #20005] Mon, 09 February 2009 18:38 Go to previous messageGo to previous message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
Quote:

Not really happy about it -> it makes CharMetrics too long.

I think we should read this directly, not to cache this.

OK. How about adding this to FontInfo::Data:
Rect FontInfo::Data::GetCharBoundsOffset(int c)
{
	Rect r;
	XGlyphInfo info;
	unsigned int h = static_cast<unsigned int>(c);
	XftTextExtents32(Xdisplay, xftfont0, &h, 1, &info);
	r.left = -info.x;
	r.top = -info.y + ascent;
	r.right = -info.x + info.width;
	r.bottom = -info.y + ascent + info.height;
	return r;
}

and this to FontInfo:
Rect       GetCharBoundsOffset(int c) const   { return ptr->GetCharBoundsOffset(c); }


It is much cleaner this way, plus I can rewrite:
inline Rect GetCharRect(int x, int y, int buff, const FontInfo& fi)
{
	return fi.GetCharBoundsOffset(buff).Offseted(x, y);
}


 
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 16:24:57 CEST 2024

Total time taken to generate the page: 0.03082 seconds