Rank: Member
Groups: Guest
Joined: 3/21/2016(UTC) Posts: 23
Thanks: 1 times Was thanked: 1 time(s) in 1 post(s)
|
Hey guys & gals, I was wondering if there was a way to draw text on a path (in my case a circle) without the text becoming distorted. Here is an example of the distorted text on a path: Now here is how it looks when not on a path: Now, just for fun, here is an SVG representation of the same idea where the text is NOT distorted: Can this be done in graphicsmill without the nightmare scenario of having to manually rotate each character plus all the font measuring that would entail? Cheers :)
|
|
|
|
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)
|
You can use the PathText.Stretch property to specify whether the glyphes should be distorted. |
Best regards, Fedor Skvortsov
|
|
|
|
Rank: Member
Groups: Guest
Joined: 3/21/2016(UTC) Posts: 23
Thanks: 1 times Was thanked: 1 time(s) in 1 post(s)
|
Originally Posted by: Fedor You can use the PathText.Stretch property to specify whether the glyphes should be distorted. Sadly, this did not solve this issue. Quote:var pathText = new PathText(text, font, new SolidBrush(col), path, TextAlignment.Center); pathText.Stretch = false; graphics.DrawText(pathText); Quote:var pathText = new PathText(text, font, new SolidBrush(col), path, TextAlignment.Center); pathText.Stretch = true; graphics.DrawText(pathText); ... generate the same visible output (unless I am doing something wrong).
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 9/19/2006(UTC) Posts: 505
Was thanked: 41 time(s) in 41 post(s)
|
Hi, I just wrote a small code sample, and it gives me pretty different results. Could you post here your code? Code:using (var bitmap = new Bitmap(300, 300, PixelFormat.Format8bppGrayscale, RgbColor.White))
using (var gr = bitmap.GetAdvancedGraphics())
using (var path = new Path())
{
path.MoveTo(40, 300);
path.CurveTo(150, 100, 250, 300);
var pathText = new PathText("Text", gr.CreateFont("Arial", 60));
pathText.Path = path;
pathText.Alignment = TextAlignment.Center;
gr.DrawText(pathText);
pathText.Stretch = false;
path.Translate(0, -100);
gr.DrawText(pathText);
bitmap.Save("result.png");
}
Edited by user Thursday, July 13, 2017 6:52:32 PM(UTC)
| Reason: add an image |
Best regards, Eugene Kosmin The Aurigma Development Team
|
|
|
|
Rank: Member
Groups: Guest
Joined: 3/21/2016(UTC) Posts: 23
Thanks: 1 times Was thanked: 1 time(s) in 1 post(s)
|
Yep, I am an idiot... The problem was 100% my code. Sorry to waste your time :)
|
|
|
|
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.