Add bundled TTF fonts, page geometry, column allocator and render model

Static TTF fonts (IBM Plex Sans/Mono, Noto Devanagari/Kannada) with a
fontkit-generated manifest, a verifier and OFL licences. Every family
registers a normal and italic source so fallback stacks cannot throw.
Adds A4/Letter geometry with margin presets, an exact column allocator,
deterministic Indian-grouping money and date formatting, text sanitising
and a pure buildRenderModel.
This commit is contained in:
2026-10-04 04:38:03 +05:30
parent fbed18a0bd
commit 92ba3d9590
40 changed files with 2162 additions and 49 deletions
+2 -17
View File
@@ -2,6 +2,7 @@ import { pdf } from "@react-pdf/renderer";
import { save } from "@tauri-apps/plugin-dialog";
import { registerPdfFonts } from "../pdf/fonts";
import { InvoiceDocument, type InvoicePdfProps } from "../pdf/InvoiceDocument";
import { bankFromSnapshot, vendorFromSnapshot } from "../pdf/model/vendor";
import { api } from "./api";
import type { BankAccount, Invoice, Settings } from "./types";
@@ -17,15 +18,6 @@ function blobToBase64(blob: Blob): Promise<string> {
});
}
function vendorFromSnapshot(snapshot: string | undefined, live: Settings): Settings {
if (!snapshot) return live;
try {
return { ...live, ...(JSON.parse(snapshot) as Partial<Settings>) };
} catch {
return live;
}
}
export async function buildPdfProps(
invoice: Invoice,
settings: Settings,
@@ -39,14 +31,7 @@ export async function buildPdfProps(
? await api.readAssetDataUri(invoice.signaturePath)
: null;
let resolvedBank = bank;
if (!resolvedBank && invoice.bankSnapshot) {
try {
resolvedBank = JSON.parse(invoice.bankSnapshot) as BankAccount;
} catch {
resolvedBank = null;
}
}
const resolvedBank = bankFromSnapshot(invoice.bankSnapshot, bank);
return {
vendor,