diff --git a/Instructions/TextInstruction.cs b/Instructions/TextInstruction.cs index a135d77..820ef1e 100644 --- a/Instructions/TextInstruction.cs +++ b/Instructions/TextInstruction.cs @@ -11,8 +11,14 @@ public class TextInstruction : BaseInstruction public Alignment alignment {get; set; } = Alignment.Left; public bool underline {get; set; } = false; + public bool bold {get; set; } = false; + public bool doubleHeight {get; set; } = false; + public bool doubleWidth {get; set; } = false; + public bool fontB {get; set; } = false; + public bool newLine { get; set; } = true; + public override List GetInstructions() { var e = new EPSON(); @@ -20,9 +26,7 @@ public class TextInstruction : BaseInstruction commands.Add(alignmentCommand(alignment)); - if (underline){ - commands.Add(e.SetStyles(PrintStyle.Underline)); - } + commands.AddRange(setStyles()); if (newLine) { @@ -33,10 +37,36 @@ public class TextInstruction : BaseInstruction commands.Add(e.Print(text)); } - if (underline){ + if (underline || bold || doubleHeight || doubleWidth || fontB){ commands.Add(e.SetStyles(PrintStyle.None)); } return commands; } + + private List setStyles(){ + var e = new EPSON(); + var commands = new List(); + if (underline){ + commands.Add(e.SetStyles(PrintStyle.Underline)); + } + + if (bold){ + commands.Add(e.SetStyles(PrintStyle.Bold)); + } + + if (doubleHeight){ + commands.Add(e.SetStyles(PrintStyle.DoubleHeight)); + } + + if (doubleWidth){ + commands.Add(e.SetStyles(PrintStyle.DoubleWidth)); + } + + if (fontB){ + commands.Add(e.SetStyles(PrintStyle.FontB)); + } + + return commands; + } } \ No newline at end of file