浏览代码

Dynamic: improved TextStyle handling

MarcinZiabek 3 年之前
父节点
当前提交
152304b467

+ 1 - 1
QuestPDF/Drawing/DocumentGenerator.cs

@@ -187,7 +187,7 @@ namespace QuestPDF.Drawing
             }
 
             if (content is DynamicHost dynamicHost)
-                dynamicHost.TextStyle = documentDefaultTextStyle;
+                dynamicHost.TextStyle.ApplyGlobalStyle(documentDefaultTextStyle);
             
             var targetTextStyle = documentDefaultTextStyle;
             

+ 1 - 1
QuestPDF/Elements/Dynamic.cs

@@ -9,7 +9,7 @@ namespace QuestPDF.Elements
     internal class DynamicHost : Element, IStateResettable
     {
         private IDynamicComponent Child { get; }
-        internal TextStyle TextStyle { get; set; }
+        internal TextStyle TextStyle { get; } = new();
 
         public DynamicHost(IDynamicComponent child)
         {

+ 1 - 1
QuestPDF/Elements/Text/Items/TextBlockSpan.cs

@@ -12,7 +12,7 @@ namespace QuestPDF.Elements.Text.Items
         private const char Space = ' ';
         
         public string Text { get; set; }
-        public TextStyle Style { get; set; } = new TextStyle();
+        public TextStyle Style { get; set; } = new();
 
         private Dictionary<(int startIndex, float availableWidth), TextMeasurementResult?> MeasureCache = new ();