Skip to content

Commit 4067cec

Browse files
Update to match changes in Fonts
1 parent b328565 commit 4067cec

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/ImageSharp.Drawing/Processing/Processors/Text/RichTextGlyphRenderer.Brushes.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ private static ColorStop[] ToColorStops(ReadOnlySpan<GradientStop> stops, float
189189
/// <returns>The ImageSharp color.</returns>
190190
private static Color ToColor(in GlyphColor c, float opacity)
191191
{
192-
float a = Math.Clamp(c.Alpha / 255f * Math.Clamp(opacity, 0f, 1f), 0f, 1f);
192+
float a = Math.Clamp(c.A / 255f * Math.Clamp(opacity, 0f, 1f), 0f, 1f);
193193
byte aa = (byte)MathF.Round(a * 255f);
194-
return Color.FromPixel(new Rgba32(c.Red, c.Green, c.Blue, aa));
194+
return Color.FromPixel(new Rgba32(c.R, c.G, c.B, aa));
195195
}
196196
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,18 +278,19 @@ void IGlyphRenderer.SetDecoration(TextDecorations textDecorations, Vector2 start
278278
}
279279

280280
// Align the new line with the previous one if they are close enough.
281+
// Use a 2 pixel threshold to account for anti-aliasing gaps.
281282
if (rotated)
282283
{
283284
if (thickness == prevThickness
284-
&& prevEnd.Y + 1 >= start.Y
285+
&& prevEnd.Y + 2 >= start.Y
285286
&& prevEnd.X == start.X)
286287
{
287288
start = prevEnd;
288289
}
289290
}
290291
else if (thickness == prevThickness
291292
&& prevEnd.Y == start.Y
292-
&& prevEnd.X + 1 >= start.X)
293+
&& prevEnd.X + 2 >= start.X)
293294
{
294295
start = prevEnd;
295296
}

0 commit comments

Comments
 (0)