[fix:] fixed creation of empty lines

This commit is contained in:
Elias Fierke
2026-01-15 10:12:40 +01:00
parent af1c3ff8cc
commit 58964896ad
2 changed files with 11 additions and 12 deletions

View File

@@ -225,6 +225,7 @@ public class PdfBuilder
private void DrawLineWithMarkdown(XGraphics gfx, string line, double x, double y, double maxWidth)
{
if (string.IsNullOrWhiteSpace(line)) return;
var currentX = x;
var i = 0;
@@ -245,7 +246,7 @@ public class PdfBuilder
if (!string.IsNullOrEmpty(inner))
{
var measuredSmall = gfx.MeasureString(inner, _smallFont);
if (measuredSmall.Width > remainingWidth)
{
inner = TruncateTextToWidth(gfx, inner, _smallFont, remainingWidth);
@@ -272,7 +273,7 @@ public class PdfBuilder
{
var boldText = line.Substring(i + 2, endIndex - (i + 2));
var measured = gfx.MeasureString(boldText, _boldFont);
if (measured.Width > remainingWidth)
{
boldText = TruncateTextToWidth(gfx, boldText, _boldFont, remainingWidth);
@@ -297,7 +298,7 @@ public class PdfBuilder
if (!string.IsNullOrEmpty(regularText))
{
var measured = gfx.MeasureString(regularText, _regularFont);
if (measured.Width > remainingWidth)
{
regularText = TruncateTextToWidth(gfx, regularText, _regularFont, remainingWidth);
@@ -318,7 +319,7 @@ public class PdfBuilder
if (string.IsNullOrEmpty(text))
return text;
for (int len = text.Length; len > 0; len--)
for (var len = text.Length; len > 0; len--)
{
var truncated = text.Substring(0, len);
var measured = gfx.MeasureString(truncated, font);