-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #331 from SixLabors/issue330-offset-outline
Align font outline and fill while calling DrawText
- Loading branch information
Showing
9 changed files
with
103 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// Copyright (c) Six Labors. | ||
// Licensed under the Six Labors Split License. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using SixLabors.Fonts; | ||
using SixLabors.ImageSharp.Drawing.Processing; | ||
using SixLabors.ImageSharp.PixelFormats; | ||
|
||
namespace SixLabors.ImageSharp.Drawing.Tests.Issues; | ||
public class Issue_330 | ||
{ | ||
[Theory] | ||
[WithSolidFilledImages(2084, 2084, "BlueViolet", PixelTypes.Rgba32)] | ||
public void OffsetTextOutlines<TPixel>(TestImageProvider<TPixel> provider) | ||
where TPixel : unmanaged, IPixel<TPixel> | ||
{ | ||
FontFamily fontFamily = TestFontUtilities.GetFontFamily(TestFonts.OpenSans); | ||
|
||
Font bibfont = fontFamily.CreateFont(600, FontStyle.Bold); | ||
Font namefont = fontFamily.CreateFont(140, FontStyle.Bold); | ||
|
||
provider.RunValidatingProcessorTest(p => | ||
{ | ||
p.DrawText( | ||
new RichTextOptions(bibfont) | ||
{ | ||
VerticalAlignment = VerticalAlignment.Center, | ||
HorizontalAlignment = HorizontalAlignment.Center, | ||
TextAlignment = TextAlignment.Center, | ||
TextDirection = TextDirection.LeftToRight, | ||
Origin = new Point(1156, 1024), | ||
}, | ||
"9999", | ||
Brushes.Solid(Color.White), | ||
Pens.Solid(Color.Black, 20)); | ||
p.DrawText( | ||
new RichTextOptions(namefont) | ||
{ | ||
VerticalAlignment = VerticalAlignment.Center, | ||
HorizontalAlignment = HorizontalAlignment.Center, | ||
TextAlignment = TextAlignment.Center, | ||
TextDirection = TextDirection.LeftToRight, | ||
Origin = new Point(1156, 713), | ||
}, | ||
"JOHAN", | ||
Brushes.Solid(Color.White), | ||
Pens.Solid(Color.Black, 5)); | ||
p.DrawText( | ||
new RichTextOptions(namefont) | ||
{ | ||
VerticalAlignment = VerticalAlignment.Center, | ||
HorizontalAlignment = HorizontalAlignment.Center, | ||
TextAlignment = TextAlignment.Center, | ||
TextDirection = TextDirection.LeftToRight, | ||
Origin = new Point(1156, 1381), | ||
}, | ||
"TIGERTECH", | ||
Brushes.Solid(Color.White), | ||
Pens.Solid(Color.Black, 5)); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...d300x200_(255,255,255,255)_F(OpenSans-Regular.ttf)-S(40)-A(90)-STR(2)-Quic).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions
4
...d_Solid1100x200_(255,255,255,255)_pen_OpenSans-Regular.ttf-50-Sphi-(150,50).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions
4
...ned_Solid200x150_(255,255,255,255)_pen_SixLaborsSampleAB.woff-50-ABAB-(0,0).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions
4
...erned_Solid900x150_(255,255,255,255)_pen_OpenSans-Regular.ttf-50-Sphi-(0,0).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...eOutput/Issue_330/OffsetTextOutlines_Rgba32_Solid2084x2084_(138,43,226,255).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.