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++ Library : Other (not classified elsewhere) » [bug report]DrawTextEllipsis
[bug report]DrawTextEllipsis [message #37269] Fri, 14 September 2012 06:44 Go to next message
jinshiyi11 is currently offline  jinshiyi11
Messages: 7
Registered: October 2010
Location: CHINA
Promising Member
In DrawTextEllipsis,when calculate length of text,why convert text[i] to byte?

void DrawTextEllipsis(Draw& w, int x, int y, int cx, const wchar *text, const char *ellipsis,
				      Font font, Color ink, int n)
{
	...
	int l = 0;
	int i;
	for(i = 0; i < n; i++) {
		l += f[(byte) text[i]];
		if(l > cx) {
			while(l + dtl > cx && i > 0) {
				l -= f[(byte) text[i]];
				i--;
			}
			i++;
			break;
		}
	}
	...
}

[Updated on: Fri, 14 September 2012 06:47]

Report message to a moderator

Re: [bug report]DrawTextEllipsis [message #37270 is a reply to message #37269] Fri, 14 September 2012 08:07 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
jinshiyi11 wrote on Fri, 14 September 2012 00:44

In DrawTextEllipsis,when calculate length of text,why convert text[i] to byte?

void DrawTextEllipsis(Draw& w, int x, int y, int cx, const wchar *text, const char *ellipsis,
				      Font font, Color ink, int n)
{
	...
	int l = 0;
	int i;
	for(i = 0; i < n; i++) {
		l += f[(byte) text[i]];
		if(l > cx) {
			while(l + dtl > cx && i > 0) {
				l -= f[(byte) text[i]];
				i--;
			}
			i++;
			break;
		}
	}
	...
}



Thanks, you are right. Mush have been left from very old times, when Font operator[] did not supported unicode...

Should be now fixed.

Mirek
Re: [bug report]DrawTextEllipsis [message #37278 is a reply to message #37270] Fri, 14 September 2012 09:08 Go to previous message
jinshiyi11 is currently offline  jinshiyi11
Messages: 7
Registered: October 2010
Location: CHINA
Promising Member
Thanks for your quick reply Very Happy
Previous Topic: uppsrc/web directory
Next Topic: [bug report] EditField::StdBar Undo menu not checked and EditField::RightDown is reentrant
Goto Forum:
  


Current Time: Thu Mar 28 23:17:23 CET 2024

Total time taken to generate the page: 0.01485 seconds