Browse Source

Fixed text rendering (spacing corner case)

Marcin Ziąbek 4 years ago
parent
commit
3bb46ecc42

+ 1 - 1
QuestPDF.Examples/TextBenchmark.cs

@@ -181,7 +181,7 @@ namespace QuestPDF.Examples
   
                     stack.Item().Text(text =>
                     {
-                        text.ParagraphSpacing(10);
+                        text.ParagraphSpacing(5);
                         text.Span(content, normalStyle);
                     });
                     

+ 1 - 1
QuestPDF/Elements/Stack.cs

@@ -74,7 +74,7 @@ namespace QuestPDF.Elements
                 return;
 
             var firstHeight = firstSize?.Height ?? 0;
-            var spaceForSecond = new Size(availableSpace.Width, availableSpace.Height - firstHeight + Size.Epsilon);
+            var spaceForSecond = new Size(availableSpace.Width, availableSpace.Height - firstHeight);
             var secondMeasurement = Second?.Measure(spaceForSecond) as Size;
 
             if (secondMeasurement == null)

+ 1 - 1
QuestPDF/Elements/Text/TextBlock.cs

@@ -34,7 +34,7 @@ namespace QuestPDF.Elements.Text
             var width = lines.Max(x => x.Width);
             var height = lines.Sum(x => x.LineHeight);
 
-            if (width > availableSpace.Width || height > availableSpace.Height)
+            if (width > availableSpace.Width + Size.Epsilon || height > availableSpace.Height + Size.Epsilon)
                 return new Wrap();
 
             var fullyRenderedItemsCount = lines