import { R as RenderOptions } from '../render-BhplWt64.cjs';

/**
 * PDFKit adapter (`bidi-shaper/pdfkit`).
 *
 * PDFKit's font engine (fontkit) applies OpenType shaping but performs NO
 * BiDi reordering — Arabic comes out joined but in backwards order. Feeding
 * it reordered-but-unshaped text doesn't work either: fontkit would then
 * shape with a mirrored joining context.
 *
 * {@link textBidi} therefore does both passes here (visual order + explicit
 * presentation forms) and disables fontkit's own substitutions for the call
 * by passing `features: []`, unless you supply your own feature list.
 */

/** PDFKit text options, as far as this adapter cares (everything else passes through). */
interface PdfKitTextOptions {
    /** OpenType features for fontkit. Defaults to [] so pre-shaped text isn't re-shaped. */
    features?: string[];
    /** Options for the shaping/reordering pass (this adapter's own key). */
    bidi?: RenderOptions;
    [key: string]: unknown;
}
/** The slice of a PDFDocument this adapter touches (structurally typed). */
interface PdfKitDocLike {
    text(text: string, xOrOptions?: number | PdfKitTextOptions, y?: number, options?: PdfKitTextOptions): unknown;
}
/** Shape + reorder one string for a manual doc.text() call. */
declare function rtlText(text: string, options?: RenderOptions): string;
/**
 * Drop-in replacement for doc.text() that shapes and reorders first.
 *
 *   import PDFDocument from 'pdfkit';
 *   import { textBidi } from 'bidi-shaper/pdfkit';
 *
 *   textBidi(doc, 'مرحبا بالعالم', 72, 80, { align: 'right' });
 *   textBidi(doc, 'سلام', { align: 'right', bidi: { direction: 'rtl' } });
 *
 * Returns whatever doc.text() returns (the doc, for chaining).
 */
declare function textBidi(doc: PdfKitDocLike, text: string, x?: number | PdfKitTextOptions, y?: number, options?: PdfKitTextOptions): unknown;

export { type PdfKitDocLike, type PdfKitTextOptions, RenderOptions, rtlText, textBidi };
