Browse Source

Library update

Marcin Ziąbek 4 years ago
parent
commit
2c11491d4e

+ 1 - 1
QuestPDF.Examples/QuestPDF.Examples.csproj

@@ -9,7 +9,7 @@
         <PackageReference Include="nunit" Version="3.12.0" />
         <PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
         <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
-        <PackageReference Include="SkiaSharp" Version="2.80.2" />
+        <PackageReference Include="SkiaSharp" Version="2.80.3" />
     </ItemGroup>
 
     <ItemGroup>

+ 33 - 2
QuestPDF.Examples/TextExamples.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Linq;
+using System.Text;
 using NUnit.Framework;
 using QuestPDF.Examples.Engine;
 using QuestPDF.Fluent;
@@ -34,9 +35,39 @@ namespace QuestPDF.Examples
                             text.AlignLeft();
                             text.ParagraphSpacing(10);
 
-                            text.Span(Placeholders.LoremIpsum());
+                            text.Line(Placeholders.LoremIpsum());
 
-                            text.Line($"This is target text that does not show up. {DateTime.UtcNow:T} > This is a short sentence that will be wrapped into second line hopefully, right? <");
+                            text.Span($"This is target text that does not show up. {DateTime.UtcNow:T} > This is a short sentence that will be wrapped into second line hopefully, right? <", TextStyle.Default.Underlined());
+                        });
+                });
+        }
+        
+        [Test]
+        public void TextStack()
+        {
+            RenderingTest
+                .Create()
+                .PageSize(PageSizes.A4)
+                .FileName()
+                .ProducePdf()
+                .ShowResults()
+                .Render(container =>
+                {
+                    container
+                        .Padding(20)
+                        .Padding(10)
+                        .Box()
+                        .Border(1)
+                        .Padding(5)
+                        .Padding(10)
+                        .Text(text =>
+                        {
+                            text.DefaultTextStyle(TextStyle.Default);
+                            text.AlignLeft();
+                            text.ParagraphSpacing(10);
+                            
+                            foreach (var i in Enumerable.Range(1, 100))
+                                text.Line($"{i}: {Placeholders.Paragraph()}");
                         });
                 });
         }

+ 1 - 1
QuestPDF.ReportSample/QuestPDF.ReportSample.csproj

@@ -12,7 +12,7 @@
         <PackageReference Include="nunit" Version="3.12.0" />
         <PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
         <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
-        <PackageReference Include="SkiaSharp" Version="2.80.2" />
+        <PackageReference Include="SkiaSharp" Version="2.80.3" />
     </ItemGroup>
 
     <ItemGroup>

+ 1 - 1
QuestPDF.UnitTests/QuestPDF.UnitTests.csproj

@@ -11,7 +11,7 @@
         <PackageReference Include="nunit" Version="3.13.1" />
         <PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
         <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.0" />
-        <PackageReference Include="SkiaSharp" Version="2.80.2" />
+        <PackageReference Include="SkiaSharp" Version="2.80.3" />
     </ItemGroup>
 
     <ItemGroup>

+ 10 - 2
QuestPDF/Elements/Text/Calculation/TextLine.cs

@@ -15,10 +15,18 @@ namespace QuestPDF.Elements.Text.Calculation
         public float Ascent { get; private set; }
         public float Descent { get; private set; }
 
-        public float Width { get; private set; } 
-
+        public float Width { get; private set; }
+        
         public static TextLine From(ICollection<TextLineElement> elements)
         {
+            if (elements.Count == 0)
+            {
+                return new TextLine
+                {
+                    Elements = elements
+                };
+            }
+            
             var textHeight = elements.Max(x => x.Measurement.Height);
             var lineHeight = elements.Max(x => x.Measurement.LineHeight * x.Measurement.Height);
             

+ 1 - 1
QuestPDF/Fluent/TextExtensions.cs

@@ -77,7 +77,7 @@ namespace QuestPDF.Fluent
 
         public void Line(string text)
         {
-            Span(Environment.NewLine + text);
+            Span(text + Environment.NewLine);
         }
         
         public void EmptyLine()

+ 1 - 1
QuestPDF/QuestPDF.csproj

@@ -22,7 +22,7 @@
     </PropertyGroup>
 
     <ItemGroup>
-      <PackageReference Include="SkiaSharp" Version="2.80.2" />
+      <PackageReference Include="SkiaSharp" Version="2.80.3" />
     </ItemGroup>
 
     <ItemGroup>