feat(ocr,form-creator): Add comprehensive font support and TypeScript type definitions

- Add @pdf-lib/fontkit dependency for enhanced font rendering capabilities
- Create font-mappings.ts configuration with language-to-font-family mappings for 100+ languages
- Implement font-loader.ts utility for dynamic font loading from CDN sources
- Add TypeScript type definitions for form-creator, OCR, and general application types
- Create types/index.ts as centralized type exports
- Remove hidden-on-touch CSS class and update shortcuts button styling for better accessibility
- Update OCR text layer rendering to support multilingual font families
- Enhance form-creator with improved font handling for international text
- Update txt-to-pdf with font support for diverse character sets
- Migrate fileHandler to support new font loading workflow
- Update main.ts and ui.ts to integrate new type system and font utilities
- Update form-creator.html page with enhanced font configuration UI
This commit is contained in:
abdullahalam123
2025-12-03 23:13:14 +05:30
parent f213d9dc27
commit 649aec046d
16 changed files with 1220 additions and 241 deletions

View File

@@ -0,0 +1,40 @@
export interface FormField {
id: string
type: 'text' | 'checkbox' | 'radio' | 'dropdown' | 'optionlist' | 'button' | 'signature' | 'date' | 'image'
x: number
y: number
width: number
height: number
name: string
defaultValue: string
fontSize: number
alignment: 'left' | 'center' | 'right'
textColor: string
required: boolean
readOnly: boolean
tooltip: string
combCells: number
maxLength: number
options?: string[]
checked?: boolean
exportValue?: string
groupName?: string
label?: string
pageIndex: number
action?: 'none' | 'reset' | 'print' | 'url' | 'js' | 'showHide'
actionUrl?: string
jsScript?: string
targetFieldName?: string
visibilityAction?: 'show' | 'hide' | 'toggle'
dateFormat?: string
multiline?: boolean
borderColor?: string
hideBorder?: boolean
}
export interface PageData {
index: number
width: number
height: number
pdfPageData?: string
}

2
src/js/types/index.ts Normal file
View File

@@ -0,0 +1,2 @@
export * from './ocr.js';
export * from './form-creator.js';

10
src/js/types/ocr.ts Normal file
View File

@@ -0,0 +1,10 @@
export interface Word {
text: string;
bbox: {
x0: number;
y0: number;
x1: number;
y1: number;
};
confidence: number;
}