tm220 print mode refactoring

This commit is contained in:
EugeneTes
2026-01-21 09:19:24 +01:00
parent fe18db2642
commit cb231801f1
7 changed files with 64 additions and 30 deletions

View File

@@ -304,15 +304,27 @@ public class EpsonPrinter : IEpsonPrinter
_logger?.LogInformation("Selecting font: {Font}", font);
await SendRawAsync(command);
}
public async Task SetBiggerFontTM220(bool enabled)
/// <summary>
/// Change to bigger font mode for TM-T20/220 printers
/// </summary>
/// <param name="biggerWidth"></param>
/// <param name="biggerHeight"></param>
/// <param name="secondaryFont"></param>
/// <see cref="https://download4.epson.biz/sec_pubs/pos/reference_en/escpos/esc_exclamation.html"/>
public async Task SetBiggerFontTM220(bool biggerWidth, bool biggerHeight=false, bool secondaryFont=true)
{
_logger?.LogInformation("{Action} bigger font mode for TM-T20/220",
enabled ? "Enabling" : "Disabling");
if (enabled)
await SendRawCommandAsync([0x1b, 0x21, 0x20 + 0x01]);
else
await SendRawCommandAsync([0x1b, 0x21, 0x00]);
_logger?.LogInformation("Setting bigger font mode: Width={BiggerWidth}, Height={BiggerHeight}, SecondaryFont={SecondaryFont}",
biggerWidth, biggerHeight, secondaryFont);
byte value = 0x00;
if (biggerWidth)
value += 0x10;
if (biggerHeight)
value += 0x20;
if (secondaryFont)
value += 0x01;
await SendRawCommandAsync([0x1b, 0x21, value]);
}