added styles
This commit is contained in:
parent
e127efa0aa
commit
0d18ab2651
@ -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<byte[]> 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<byte[]> setStyles(){
|
||||
var e = new EPSON();
|
||||
var commands = new List<byte[]>();
|
||||
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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user