Stability improvements for text wrapping

This commit is contained in:
MarcinZiabek
2022-08-16 16:32:53 +02:00
parent 5bdb338996
commit 04da32e0e7
2 changed files with 4 additions and 1 deletions
+3
View File
@@ -129,6 +129,9 @@ namespace QuestPDF.Drawing
{
if (Glyphs.Length == 0)
return null;
if (startIndex > endIndex)
return null;
using var skTextBlobBuilder = new SKTextBlobBuilder();
@@ -66,7 +66,7 @@ namespace QuestPDF.Elements.Text.Items
// start breaking text from requested position
var endIndex = TextShapingResult.BreakText(startIndex, request.AvailableWidth);
if (endIndex < 0)
if (endIndex < startIndex)
return null;
// break text only on spaces