fix(barcode-print): restore Sofia certificate row pitch

This commit is contained in:
WuYongJie 2026-09-05 11:53:55 +08:00
parent 2dbb214006
commit 4a574041a9
2 changed files with 10 additions and 4 deletions

View File

@ -34,12 +34,12 @@ describe("Sofia certificate field positioning", () => {
expect(values.map((value) => value.style.top)).toEqual(
SOFIA_CERTIFICATE_FIELD_TOPS.map((top) => `${top}px`),
);
expect(SOFIA_CERTIFICATE_FIELD_LINE_TOPS).toEqual([260, 313, 366, 419, 472, 525]);
expect(SOFIA_CERTIFICATE_FIELD_LINE_TOPS).toEqual([260, 326, 392, 458, 524, 590]);
expect(
SOFIA_CERTIFICATE_FIELD_LINE_TOPS.slice(1).map(
(top, index) => top - SOFIA_CERTIFICATE_FIELD_LINE_TOPS[index],
),
).toEqual(Array(5).fill(53));
).toEqual(Array(5).fill(66));
expect(values.map((value) => value.style.left)).toEqual(Array(6).fill("310px"));
expect(values.map((value) => value.textContent)).toEqual([
"书架-经典北美黑胡桃色",

View File

@ -10,8 +10,14 @@ export const SOFIA_CERTIFICATE_FIELD_LEFT = 310 as const;
export const SOFIA_CERTIFICATE_FIELD_FONT_SIZE = 26 as const;
export const SOFIA_CERTIFICATE_FIELD_LINE_HEIGHT = 32 as const;
/** The y-coordinate of each pre-printed underline in canvas pixels. */
export const SOFIA_CERTIFICATE_FIELD_LINE_TOPS = [260, 313, 366, 419, 472, 525] as const;
/**
* The y-coordinate of each pre-printed underline in canvas pixels.
*
* Warehouse print feedback confirmed the first row at 260px and a 66px
* physical row pitch. Keep the pitch intact so later values do not drift
* progressively above their pre-printed labels.
*/
export const SOFIA_CERTIFICATE_FIELD_LINE_TOPS = [260, 326, 392, 458, 524, 590] as const;
/**
* Dynamic values sit above the underline. The line-height is the text box