gedcom-ts
Version:
TypeScript GEDCOM toolkit for browser apps: import .ged/.zip, edit typed genealogy data, and export GEDCOM or GEDZIP.
25 lines (24 loc) • 1.36 kB
TypeScript
import type { PDFFont, PDFPage } from 'pdf-lib';
import { rgb } from 'pdf-lib';
import type { BookletLocale } from './booklet-locale';
import { type PdfTextOptions } from './booklet-pdf';
export interface PdfFontPair {
readonly latin: PDFFont;
readonly latinBold: PDFFont;
readonly script?: PDFFont;
}
export interface TextRun {
readonly text: string;
readonly script: boolean;
}
/** Split text into Latin (Helvetica / WinAnsi) vs script (Noto) runs. */
export declare function splitPdfTextRuns(text: string): TextRun[];
export declare function usesScriptFont(text: string): boolean;
export interface PdfDrawPart {
readonly text: string;
readonly script: boolean;
}
/** Bidi reorder (RTL locales), split fonts, shape Arabic — ready for pdf-lib drawText. */
export declare function preparePdfDrawParts(text: string, locale: BookletLocale | undefined, textOptions?: PdfTextOptions): PdfDrawPart[];
export declare function measureMixedTextWidth(text: string, fonts: PdfFontPair, size: number, bold?: boolean, textOptions?: PdfTextOptions, locale?: BookletLocale): number;
export declare function drawMixedTextLine(page: PDFPage, text: string, xStart: number, y: number, fonts: PdfFontPair, size: number, color: ReturnType<typeof rgb>, alignRtl: boolean, bold?: boolean, textOptions?: PdfTextOptions, locale?: BookletLocale): void;