This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

Notification

Icon
Error

Options
Go to last post Go to first unread
Chris Jones  
#1 Posted : Wednesday, August 10, 2016 4:52:24 AM(UTC)
Chris Jones

Rank: Advanced Member

Groups: Guest
Joined: 6/9/2016(UTC)
Posts: 34

Thanks: 22 times
Due to requirements for our application regarding stretching text to fit a given area (more complicated than that) i'm using the approach of drawing the text to a path instead, calculating the x,y scaling to fit the target area and then drawing it on the bitmap.

This is working well except that i noticed that the letters i marked as bold using the formatting tags do not appear bold/thicker. However if i create the font as bold (or italic) it does affect the path that is drawn.

Is it by design that drawing text to a path ignores the formatting tags or is this a bug?

I'm hesitant to try to hack this feature together myself using multiple paths and fonts as i dont want to have to deal with the character spacing etc. properties that i'm also relying on.

Thanks

Fedor  
#2 Posted : Thursday, August 11, 2016 6:34:34 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Guest
Joined: 7/28/2003(UTC)
Posts: 1,660

Thanks: 5 times
Was thanked: 76 time(s) in 74 post(s)
Hi Chris,

Could you post code a code sample to reproduce the problem?

The following code successfully applies formatting to the specific part of text:

Code:
using (var bitmap = new Bitmap(400, 250, PixelFormat.Format24bppRgb, RgbColor.White))
using (var graphics = bitmap.GetAdvancedGraphics())
{
	var pathText = new PathText("Some <span style='bold:true;'>Bold</span> text", 
		graphics.CreateFont("Arial", 42));

	pathText.Path.MoveTo(26, 152);
	pathText.Path.CurveTo(121, 177, 183, 68, 368, 157);

	//Draw text on path
	var path = new Path();
	path.DrawText(pathText);

	//Draw path
	graphics.FillPath(new SolidBrush(RgbColor.Black), path);

	bitmap.Save("../../../result.png");
}
Fedor attached the following image(s):
result_bold.png
result_normal.png
Best regards,

Fedor Skvortsov

Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.