tm220 print mode refactoring
This commit is contained in:
@@ -31,7 +31,8 @@ public class HtmlPrinter : IEpsonPrinter
|
||||
private bool _isEmphasized;
|
||||
private bool _isRedColor;
|
||||
private bool _isQuadrupleMode;
|
||||
private bool _isBiggerFontTM220;
|
||||
private bool _isBiggerFontWidthTM220;
|
||||
private bool _isBiggerFontHeightTM220;
|
||||
private int _lineSpacing = 14; // Default line spacing in pixels (scaled for screen)
|
||||
private int _absolutePosition; // Current X position offset
|
||||
|
||||
@@ -239,10 +240,13 @@ public class HtmlPrinter : IEpsonPrinter
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task SetBiggerFontTM220(bool enabled)
|
||||
public Task SetBiggerFontTM220(bool biggerWidth, bool biggerHeight = false, bool secondaryFont = true)
|
||||
{
|
||||
_logger?.LogInformation("HtmlPrinter: {Action} bigger font mode for TM-T20/220", enabled ? "Enabling" : "Disabling");
|
||||
_isBiggerFontTM220 = enabled;
|
||||
_logger?.LogInformation("HtmlPrinter: Setting bigger font mode: Width={BiggerWidth}, Height={BiggerHeight}, SecondaryFont={SecondaryFont}",
|
||||
biggerWidth, biggerHeight, secondaryFont);
|
||||
_isBiggerFontWidthTM220 = biggerWidth;
|
||||
_isBiggerFontHeightTM220 = biggerHeight;
|
||||
// Note: secondaryFont is ignored in HTML simulation as it only affects the physical printer's font selection
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
@@ -468,7 +472,8 @@ public class HtmlPrinter : IEpsonPrinter
|
||||
_isEmphasized = false;
|
||||
_isRedColor = false;
|
||||
_isQuadrupleMode = false;
|
||||
_isBiggerFontTM220 = false;
|
||||
_isBiggerFontWidthTM220 = false;
|
||||
_isBiggerFontHeightTM220 = false;
|
||||
_lineSpacing = 14;
|
||||
_absolutePosition = 0;
|
||||
}
|
||||
@@ -490,11 +495,16 @@ public class HtmlPrinter : IEpsonPrinter
|
||||
effectiveHeightMultiplier *= 2;
|
||||
}
|
||||
|
||||
if (_isBiggerFontTM220)
|
||||
if (_isBiggerFontWidthTM220)
|
||||
{
|
||||
effectiveWidthMultiplier *= 2;
|
||||
}
|
||||
|
||||
if (_isBiggerFontHeightTM220)
|
||||
{
|
||||
effectiveHeightMultiplier *= 2;
|
||||
}
|
||||
|
||||
int fontSize = baseHeight * effectiveHeightMultiplier;
|
||||
styles.Add($"font-size: {fontSize}px");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user