Fixed space removal

This commit is contained in:
Marcin Ziąbek
2021-09-12 20:15:41 +02:00
parent df5c5524ee
commit 3dfe7a59e0
2 changed files with 34 additions and 6 deletions
+27 -2
View File
@@ -89,9 +89,34 @@ namespace QuestPDF.Examples
});
}
T MyFunc<T>(T arg)
[Test]
public void PageNumber()
{
return arg;
RenderingTest
.Create()
.PageSize(500, 400)
.FileName()
.ProduceImages()
.ShowResults()
.Render(container =>
{
container
.Padding(10)
.Box()
.Border(1)
.Padding(10)
.Text(text =>
{
text.DefaultTextStyle(TextStyle.Default);
text.AlignLeft();
text.ParagraphSpacing(10);
text.Span("This is page number ");
text.CurrentPageNumber();
text.Span(" out of ");
text.TotalPages();
});
});
}
}
}
@@ -32,10 +32,13 @@ namespace QuestPDF.Elements.Text.Items
var fontMetrics = Style.ToFontMetrics();
var startIndex = request.StartIndex;
while (startIndex + 1 < Text.Length && Text[startIndex] == space)
startIndex++;
if (request.IsFirstLineElement)
{
while (startIndex + 1 < Text.Length && Text[startIndex] == space)
startIndex++;
}
if (Text.Length == 0)
{
return new TextMeasurementResult