@@ -202,6 +202,11 @@ import {
202202} from "../../core/markdown-pipeline.ts" ;
203203import { getEnv } from "../../../package/src/util/utils.ts" ;
204204import { canonicalizeTitlePostprocessor } from "../../format/html/format-html-title.ts" ;
205+ import {
206+ BrandFontBunny ,
207+ BrandFontFile ,
208+ BrandFontGoogle ,
209+ } from "../../resources/types/schema-types.ts" ;
205210
206211// in case we are running multiple pandoc processes
207212// we need to make sure we capture all of the trace files
@@ -1359,18 +1364,25 @@ async function resolveExtras(
13591364 const ttf_urls = [ ] , woff_urls : Array < string > = [ ] ;
13601365 if ( brand ?. data . typography ) {
13611366 const fonts = brand . data . typography . fonts || [ ] ;
1362- for ( const font of fonts ) {
1363- if ( font . source === "file" ) {
1367+ for ( const _font of fonts ) {
1368+ // if font lacks a source, we assume google in typst output
1369+
1370+ // deno-lint-ignore no-explicit-any
1371+ const source : string = ( _font as any ) . source ?? "google" ;
1372+ if ( source === "file" ) {
1373+ const font = _font as BrandFontFile ;
13641374 for ( const file of font . files || [ ] ) {
13651375 const path = typeof file === "object" ? file . path : file ;
13661376 fontdirs . add ( dirname ( join ( brand . brandDir , path ) ) ) ;
13671377 }
1368- } else if ( font . source === "bunny" ) {
1378+ } else if ( source === "bunny" ) {
1379+ const font = _font as BrandFontBunny ;
13691380 console . log (
13701381 "Font bunny is not yet supported for Typst, skipping" ,
13711382 font . family ,
13721383 ) ;
1373- } else if ( font . source === "google" /* || font.source === "bunny" */ ) {
1384+ } else if ( source === "google" /* || font.source === "bunny" */ ) {
1385+ const font = _font as BrandFontGoogle ;
13741386 let { family, style, weight } = font ;
13751387 const parts = [ family ! ] ;
13761388 if ( style ) {
@@ -1382,7 +1394,7 @@ async function resolveExtras(
13821394 parts . push ( weight . join ( "," ) ) ;
13831395 }
13841396 const response = await fetch (
1385- `${ base_urls [ font . source ] } ?family=${ parts . join ( ":" ) } ` ,
1397+ `${ base_urls [ source ] } ?family=${ parts . join ( ":" ) } ` ,
13861398 ) ;
13871399 const lines = ( await response . text ( ) ) . split ( "\n" ) ;
13881400 for ( const line of lines ) {
0 commit comments