UNPKG

@pdfme/schemas

Version:

TypeScript base PDF generator and React base UI. Open source, developed by the community, and completely free to use under the MIT license!

54 lines (53 loc) 1.57 kB
import type { Schema } from '@pdfme/common'; import type { Font as FontKitFont } from 'fontkit'; import type { BoxDimension } from '../box.js'; export type ALIGNMENT = 'left' | 'center' | 'right' | 'justify'; export type VERTICAL_ALIGNMENT = 'top' | 'middle' | 'bottom'; export type DYNAMIC_FONT_SIZE_FIT = 'horizontal' | 'vertical'; export type TEXT_FORMAT = 'plain' | 'inline-markdown'; export type TEXT_OVERFLOW = 'visible' | 'expand'; export type FONT_VARIANT_FALLBACK = 'synthetic' | 'plain' | 'error'; export type FontVariants = { bold?: string; italic?: string; boldItalic?: string; code?: string; }; export type RichTextRun = { text: string; bold?: boolean; italic?: boolean; strikethrough?: boolean; code?: boolean; href?: string; }; export type FontWidthCalcValues = { font: FontKitFont; fontSize: number; characterSpacing: number; boxWidthInPt: number; }; export type TextSchema = Schema & { fontName?: string; textFormat?: TEXT_FORMAT; fontVariants?: FontVariants; fontVariantFallback?: FONT_VARIANT_FALLBACK; alignment: ALIGNMENT; verticalAlignment: VERTICAL_ALIGNMENT; fontSize: number; lineHeight: number; strikethrough?: boolean; underline?: boolean; characterSpacing: number; dynamicFontSize?: { min: number; max: number; fit: DYNAMIC_FONT_SIZE_FIT; }; overflow?: TEXT_OVERFLOW; fontColor: string; backgroundColor: string; borderColor?: string; borderWidth?: BoxDimension; padding?: BoxDimension; };