rspace-online/modules/pubs/formats.ts

62 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

export interface BookFormat {
id: string;
name: string;
widthMm: number;
heightMm: number;
description: string;
typstFormat: string; // filename in typst/formats/ without extension
minPages: number;
maxPages: number;
}
export const FORMATS: Record<string, BookFormat> = {
a7: {
id: "a7",
name: "A7 Pocket",
widthMm: 74,
heightMm: 105,
description: "Smallest pocket format — fits in a shirt pocket",
typstFormat: "a7",
minPages: 16,
maxPages: 48,
},
a6: {
id: "a6",
name: "A6 Booklet",
widthMm: 105,
heightMm: 148,
description: "Standard postcard-sized pocket book",
typstFormat: "a6",
minPages: 16,
maxPages: 64,
},
"quarter-letter": {
id: "quarter-letter",
name: "Quarter Letter",
widthMm: 108,
heightMm: 140,
description: "Quarter US Letter — easy to print at home",
typstFormat: "quarter-letter",
minPages: 16,
maxPages: 64,
},
digest: {
id: "digest",
name: 'Digest (5.5" × 8.5")',
widthMm: 140,
heightMm: 216,
description: "Half US Letter — most POD-friendly format",
typstFormat: "digest",
minPages: 16,
maxPages: 96,
},
};
export function getFormat(id: string): BookFormat | undefined {
return FORMATS[id];
}
export function listFormats(): BookFormat[] {
return Object.values(FORMATS);
}