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 » Strange issue with text in Painter
Re: Strange issue with text in Painter [message #50854 is a reply to message #50852] Wed, 09 January 2019 13:38 Go to previous messageGo to previous message
Tom1
Messages: 693
Registered: March 2007
Contributor
Hi,

Here's some more. In this picture two of the letters have shrinked in the middle of a word:

index.php?t=getfile&id=5736&private=0

When zooming in, the text gets fixed:

index.php?t=getfile&id=5735&private=0

Instead of a testcase, here's a clip of the code I use for rendering the text with Painter:

			Font fnt(font);
			fnt.Height((int)floor(height_dp)).Bold(object.bold).Italic(object.italic==1).Underline(object.selected);
			
			Pointf p(project.Transform(object.x,object.y));
			double  rot=object.rotation+rotation;
			rot+=object.no_rotate?-GetViewRotation():0;

			painter.Begin();

			painter.Translate(p);
			if(rot) painter.Rotate(-rot*DEGR2RAD);
			switch(object.italic){
				case 2:
					painter.Transform(Xform2D::Sheer(-0.3));
					break;
				case 3:
					painter.Transform(Xform2D::Sheer(0.2));
					break;
			}
			
			Vector<String> lines=Split(text,10);
			
			for(int row=0;row<lines.GetCount();row++){
				Size sz=GetTextSize(lines[row],fnt);
				Pointf delta(0,0);
				switch(object.attpoint){
					case 1:	// 1 = Top left
						break;
					case 2: // Top Center
						delta.x=-sz.cx/2;
						break;
					case 3: // Top Right
						delta.x=-sz.cx;
						break;
					case 4: // Middle Left
						delta.y=-sz.cy/2;
						break;
					case 5: // Middle Center
						delta.y=-sz.cy/2;
						delta.x=-sz.cx/2;
						break;
					case 6: // Middle Right
						delta.y=-sz.cy/2;
						delta.x=-sz.cx;
						break;
					default:
					case 7: // Bottom Left
						delta.y=-sz.cy;
						break;
					case 8: // Bottom Center
						delta.y=-sz.cy;
						delta.x=-sz.cx/2;
						break;
					case 9: // Bottom Right
						delta.y=-sz.cy;
						delta.x=-sz.cx;
						break;
				}
				delta.y+=row*height_dp*1.5; // sz.cy
				painter.Text(delta,lines[row],fnt);
			}
			
			if(edgecolor.a) painter.Stroke(height_dp*0.1,edgecolor);
			painter.Fill(textcolor);
			painter.End();


Best regards,

Tom
  • Attachment: T4.png
    (Size: 80.69KB, Downloaded 231 times)
  • Attachment: T3.png
    (Size: 82.44KB, Downloaded 234 times)
 
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
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
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
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
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: MT + Subpixel appear incompatible in Painter
Next Topic: Painter: Excessive memory usage in PainterExamples moving window to edges of screen.
Goto Forum:
  


Current Time: Sat Mar 28 16:23:18 CET 2020

Total time taken to generate the page: 0.02265 seconds