-
-
Notifications
You must be signed in to change notification settings - Fork 46
Closed
Description
Hi.
It'd be greatly appreciated if this bug can be fixed, please see the original post is discussions for a workaround and an explanation to why the outlining is misplaced.
Thanks,
Johan
Discussed in #329
Originally posted by johantiger May 9, 2024
Hi,
I have a problem when drawing text with both a brush and a pen.
As you can see, the brush and the pen seem to be misaligned and the white brush can be seen outside the black pen, and in some places the background is visible between the white and the black.
I draw text using this code:
FontCollection fontCollection = new();
FontFamily fontFamily = fontCollection.Add(Path.Combine(functionDirectory, "Assets", "Fonts",
"OpenSans-ExtraBold.ttf"));
Font bibfont = fontFamily.CreateFont(600, FontStyle.Bold);
Font namefont = fontFamily.CreateFont(140, FontStyle.Bold);
RichTextOptions options = new RichTextOptions(bibfont)
{
VerticalAlignment = VerticalAlignment.Center,
HorizontalAlignment = HorizontalAlignment.Center,
TextAlignment = TextAlignment.Center,
TextDirection = TextDirection.LeftToRight,
Origin = new Point(1156,1024),
};
image.Mutate(x => x.DrawText(options, "9999", Brushes.Solid(Color.White), Pens.Solid(Color.Black, 25)));
options.Font = namefont;
options.Origin = new Point(1156, 713);
image.Mutate(x => x.DrawText(options, "JOHAN", Brushes.Solid(Color.White), Pens.Solid(Color.Black, 12)));
options.Origin = new Point(1156, 1381);
image.Mutate(x => x.DrawText(options, "TIGERTECH", Brushes.Solid(Color.White), Pens.Solid(Color.Black, 12)));
How can I get these to align correctly? What am I doing wrong?
I'm using OpenSans from Google Fonts, but I've tried with other fonts too.
I'm using Fonts 2.0.2, ImageSharp 3.1.3, Drawing 2.1.2
Metadata
Metadata
Assignees
Labels
No labels