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 » Draw, Display, Images, Bitmaps, Icons » Painter Text Underline/Strikeout not working
Re: Painter Text Underline/Strikeout not working [message #47435 is a reply to message #47285] Mon, 16 January 2017 10:38 Go to previous messageGo to previous message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Hi,

Here's one more fix for the Painter::TextOp() in Painter.cpp:

void Painter::TextOp(const Pointf& p, const wchar *text, Font fnt, int n, const double *dx)
{
	if(n == 0) {
		Move(0, 0);
		return;
	}
	FontInfo fi = fnt.Info();
	double x = p.x;
	while(n) {
		int ch = *text++;
		Character(x, p.y, ch, fnt);
		Div();
		if(dx)
			x += *dx++;
		else
			x += fi[ch];
		n--;
	}
	if(fnt.IsUnderline() || fnt.IsStrikeout()) {
		int a = fnt.GetAscent();
		int cy = max(a / 16, 1);
		if(fnt.IsUnderline())
			Rectangle(p.x, p.y + a + cy, x, cy);
		if(fnt.IsStrikeout())
			Rectangle(p.x, p.y + 2 * a / 3, x, cy);
	}
}


The underline and strikeout did not follow the Pointf &p parameter, which they obviously should have. This is fixed now above. Please commit.

Best regards,

Tom
 
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: Assertion fails in BufferPainter::TransformOp() with rotated text
Next Topic: Painter Fill with Image MSC14x64 performance issue
Goto Forum:
  


Current Time: Tue May 07 21:32:11 CEST 2024

Total time taken to generate the page: 0.02732 seconds