Skip to content

Commit 16c34fa

Browse files
Revert "Update BaseGlyphBuilder.cs"
This reverts commit b6f3040.
1 parent b6f3040 commit 16c34fa

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

src/ImageSharp.Drawing/Shapes/Text/BaseGlyphBuilder.cs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ namespace SixLabors.ImageSharp.Drawing.Text
1313
internal class BaseGlyphBuilder : IGlyphRenderer
1414
{
1515
private readonly List<IPath> paths = new();
16+
private Vector2 currentPoint;
1617

1718
/// <summary>
1819
/// Initializes a new instance of the <see cref="BaseGlyphBuilder"/> class.
@@ -57,7 +58,10 @@ bool IGlyphRenderer.BeginGlyph(FontRectangle bounds, GlyphRendererParameters par
5758
/// <param name="thirdControlPoint">The third control point.</param>
5859
/// <param name="point">The point.</param>
5960
void IGlyphRenderer.CubicBezierTo(Vector2 secondControlPoint, Vector2 thirdControlPoint, Vector2 point)
60-
=> this.Builder.CubicBezierTo(secondControlPoint, thirdControlPoint, point);
61+
{
62+
this.Builder.AddBezier(this.currentPoint, secondControlPoint, thirdControlPoint, point);
63+
this.currentPoint = point;
64+
}
6165

6266
/// <summary>
6367
/// Ends the glyph.
@@ -73,21 +77,32 @@ void IGlyphRenderer.CubicBezierTo(Vector2 secondControlPoint, Vector2 thirdContr
7377
/// Draws a line from the current point to the <paramref name="point"/>.
7478
/// </summary>
7579
/// <param name="point">The point.</param>
76-
void IGlyphRenderer.LineTo(Vector2 point) => this.Builder.LineTo(point);
80+
void IGlyphRenderer.LineTo(Vector2 point)
81+
{
82+
this.Builder.AddLine(this.currentPoint, point);
83+
this.currentPoint = point;
84+
}
7785

7886
/// <summary>
7987
/// Moves to current point to the supplied vector.
8088
/// </summary>
8189
/// <param name="point">The point.</param>
82-
void IGlyphRenderer.MoveTo(Vector2 point) => this.Builder.MoveTo(point);
90+
void IGlyphRenderer.MoveTo(Vector2 point)
91+
{
92+
this.Builder.StartFigure();
93+
this.currentPoint = point;
94+
}
8395

8496
/// <summary>
8597
/// Draws a quadratics bezier from the current point to the <paramref name="point"/>
8698
/// </summary>
8799
/// <param name="secondControlPoint">The second control point.</param>
88100
/// <param name="point">The point.</param>
89101
void IGlyphRenderer.QuadraticBezierTo(Vector2 secondControlPoint, Vector2 point)
90-
=> this.Builder.QuadraticBezierTo(secondControlPoint, point);
102+
{
103+
this.Builder.AddBezier(this.currentPoint, secondControlPoint, point);
104+
this.currentPoint = point;
105+
}
91106

92107
/// <summary>Called before any glyphs have been rendered.</summary>
93108
/// <param name="bounds">The bounds the text will be rendered at and at what size.</param>

0 commit comments

Comments
 (0)