ESC/P 2: Exact paper sizes, 1/36" margins

This commit is contained in:
Lili1228
2026-02-06 22:32:46 +01:00
parent 50b961e0b6
commit c3094d022d
2 changed files with 14 additions and 14 deletions

View File

@@ -28,27 +28,27 @@
#define LEDGER_PAGE_HEIGHT 17.0
/* Standard A0 */
#define A0_PAGE_WIDTH 33.125
#define A0_PAGE_HEIGHT 46.75
#define A0_PAGE_WIDTH 33.110236
#define A0_PAGE_HEIGHT 46.811023
/* Standard A1 */
#define A1_PAGE_WIDTH 23.375
#define A1_PAGE_HEIGHT 33.125
#define A1_PAGE_WIDTH 23.385826
#define A1_PAGE_HEIGHT 33.110236
/* Standard A2 */
#define A2_PAGE_WIDTH 16.5
#define A2_PAGE_HEIGHT 23.375
#define A2_PAGE_WIDTH 16.535433
#define A2_PAGE_HEIGHT 23.385826
/* Standard A3 */
#define A3_PAGE_WIDTH 11.75
#define A3_PAGE_HEIGHT 16.5
#define A3_PAGE_WIDTH 11.692913
#define A3_PAGE_HEIGHT 16.535433
/* Standard A4 */
#define A4_PAGE_WIDTH 8.25
#define A4_PAGE_HEIGHT 11.75
#define A4_PAGE_WIDTH 8.267716
#define A4_PAGE_HEIGHT 11.692913
/* Standard B4 */
#define B4_PAGE_WIDTH 9.875
#define B4_PAGE_HEIGHT 13.875
#define B4_PAGE_WIDTH 9.8425197
#define B4_PAGE_HEIGHT 13.897637
#endif /*EMU_PLAT_FALLTHROUGH_H*/

View File

@@ -542,7 +542,7 @@ init_codepage(escp_t *dev, uint16_t num)
static void
reset_printer(escp_t *dev)
{
dev->top_margin = dev->left_margin = 0.0;
dev->top_margin = dev->left_margin = 1.0 / 36.0;
dev->right_margin = dev->page_width;
switch (dev->paper_size) {
case PAPER_A4:
@@ -558,7 +558,7 @@ reset_printer(escp_t *dev)
default:
dev->page_height = LETTER_PAGE_HEIGHT;
}
dev->bottom_margin = dev->page_height;
dev->bottom_margin = dev->page_height - 1.0 / 36.0;
/* TODO: these should be configurable. */
dev->color = COLOR_BLACK;
dev->curr_x = dev->curr_y = 0.0;