added underline in text

This commit is contained in:
Djeeberjr 2022-02-18 18:48:03 +01:00
parent b9ef0c93e9
commit 2d7338aa76

View File

@ -10,6 +10,8 @@ public class TextInstruction : BaseInstruction
[JsonConverter(typeof(JsonStringEnumConverter))] [JsonConverter(typeof(JsonStringEnumConverter))]
public Alignment alignment {get; set; } = Alignment.Left; public Alignment alignment {get; set; } = Alignment.Left;
public bool underline {get; set; } = false;
public bool newLine { get; set; } = true; public bool newLine { get; set; } = true;
public override List<byte[]> GetInstructions() public override List<byte[]> GetInstructions()
{ {
@ -18,6 +20,10 @@ public class TextInstruction : BaseInstruction
commands.Add(alignmentCommand(alignment)); commands.Add(alignmentCommand(alignment));
if (underline){
commands.Add(e.SetStyles(PrintStyle.Underline));
}
if (newLine) if (newLine)
{ {
commands.Add(e.PrintLine(text)); commands.Add(e.PrintLine(text));
@ -27,6 +33,10 @@ public class TextInstruction : BaseInstruction
commands.Add(e.Print(text)); commands.Add(e.Print(text));
} }
if (underline){
commands.Add(e.SetStyles(PrintStyle.None));
}
return commands; return commands;
} }
} }