File tree Expand file tree Collapse file tree
tests/ImageSharp.Drawing.Tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020 </ItemGroup >
2121
2222 <ItemGroup >
23- <PackageReference Include =" SixLabors.Fonts" Version =" 1.0.0-beta15.20 " />
24- <PackageReference Include =" SixLabors.ImageSharp" Version =" 1 .0.4 " />
23+ <PackageReference Include =" SixLabors.Fonts" Version =" 1.0.0-beta15.23 " />
24+ <PackageReference Include =" SixLabors.ImageSharp" Version =" 2 .0.0-alpha.0.123 " />
2525 </ItemGroup >
2626
2727 <Import Project =" ..\..\shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.projitems" Label =" Shared" />
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ public static class TextBuilder
1919 /// <returns>The <see cref="IPathCollection"/></returns>
2020 public static IPathCollection GenerateGlyphs ( string text , TextOptions textOptions )
2121 {
22- GlyphBuilder glyphBuilder = new ( textOptions . Origin ) ;
22+ GlyphBuilder glyphBuilder = new ( ) ;
2323 TextRenderer renderer = new ( glyphBuilder ) ;
2424
2525 renderer . RenderText ( text , textOptions ) ;
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ public class ConfigurationTests
2020
2121 public Configuration DefaultConfiguration { get ; }
2222
23- private readonly int expectedDefaultConfigurationCount = 5 ;
23+ private readonly int expectedDefaultConfigurationCount = 7 ;
2424
2525 public ConfigurationTests ( )
2626 {
Original file line number Diff line number Diff line change 1+ // Copyright (c) Six Labors.
2+ // Licensed under the Apache License, Version 2.0.
3+
4+ using System . Numerics ;
5+ using SixLabors . Fonts ;
6+ using Xunit ;
7+
8+ namespace SixLabors . ImageSharp . Drawing . Tests . Shapes
9+ {
10+ public class TextBuilderTests
11+ {
12+ [ Fact ]
13+ public void TextBuilder_Bounds_AreCorrect ( )
14+ {
15+ Vector2 position = new ( 5 , 5 ) ;
16+ var options = new TextOptions ( TestFontUtilities . GetFont ( TestFonts . OpenSans , 16 ) )
17+ {
18+ Origin = position
19+ } ;
20+
21+ string text = "Hello World" ;
22+
23+ IPathCollection glyphs = TextBuilder . GenerateGlyphs ( text , options ) ;
24+
25+ RectangleF builderBounds = glyphs . Bounds ;
26+ FontRectangle measuredBounds = TextMeasurer . MeasureBounds ( text , options ) ;
27+
28+ Assert . Equal ( measuredBounds . X , builderBounds . X ) ;
29+ Assert . Equal ( measuredBounds . Y , builderBounds . Y ) ;
30+ Assert . Equal ( measuredBounds . Width , builderBounds . Width ) ;
31+ Assert . Equal ( measuredBounds . Height , builderBounds . Height ) ;
32+ }
33+ }
34+ }
You can’t perform that action at this time.
0 commit comments