@@ -102,7 +102,7 @@ export function applyPatches() {
102102 replace (
103103 [ 'p5.d.ts' , 'global.d.ts' ] ,
104104 / l o a d F o n t \( ( .+ ) , s u c c e s s C a l l b a c k \? : F u n c t i o n , ( .+ ) \) : P r o m i s e \< ( [ p P ] 5 ) \. F o n t \> ; / g,
105- 'loadFont($1, successCallback: (font: $3.Font) => any, $2): Promise<$3.Font>;'
105+ 'loadFont($1, successCallback? : (font: $3.Font) => any, $2): Promise<$3.Font>;'
106106 ) ;
107107
108108 // Type returned objects
@@ -122,6 +122,39 @@ export function applyPatches() {
122122 'textBounds(str: string, x: number, y: number, width?: number, height?: number): { x: number; y: number; w: number; h: number };' ,
123123 ) ;
124124
125+ // Document Typr
126+ replace (
127+ 'p5.d.ts' ,
128+ 'class Font {' ,
129+ `class Font {
130+ /** The CSS name for the font. */
131+ name: string;
132+
133+ /** The CSS FontFace definition for the font. */
134+ face: FontFace;
135+
136+ /** Typr data for the font. */
137+ data?: {
138+ _data: Uint8Array;
139+ GSUB: Record<string, any>;
140+ 'OS/2': Record<string, any>;
141+ cmap: {
142+ ids: Record<string, any>;
143+ tables: Array<Record<string, any>>;
144+ off: number;
145+ };
146+ glyf: Array<any>;
147+ head: Record<string, any>;
148+ hhea: Record<string, any>;
149+ htmx: Record<string, any>;
150+ loca: Array<number>;
151+ maxp: Record<string, any>;
152+ name: Record<string, any>;
153+ post: Record<string, any>;
154+ };
155+ `
156+ ) ;
157+
125158 for ( const [ path , data ] of Object . entries ( patched ) ) {
126159 try {
127160 console . log ( `Patched ${ path } ` ) ;
0 commit comments