* Resolve theme font placeholder references like "+mj-lt" or "+mn-lt".
(typeface: string, ctx: RenderContext)
| 382 | * Resolve theme font placeholder references like "+mj-lt" or "+mn-lt". |
| 383 | */ |
| 384 | function resolveThemeFont(typeface: string, ctx: RenderContext): string { |
| 385 | if (typeface === '+mj-lt' || typeface === '+mj-ea' || typeface === '+mj-cs') { |
| 386 | const key = typeface.slice(3) as 'lt' | 'ea' | 'cs' |
| 387 | const mapping: Record<string, 'latin' | 'ea' | 'cs'> = { lt: 'latin', ea: 'ea', cs: 'cs' } |
| 388 | return ctx.theme.majorFont[mapping[key] || 'latin'] || typeface |
| 389 | } |
| 390 | if (typeface === '+mn-lt' || typeface === '+mn-ea' || typeface === '+mn-cs') { |
| 391 | const key = typeface.slice(3) as 'lt' | 'ea' | 'cs' |
| 392 | const mapping: Record<string, 'latin' | 'ea' | 'cs'> = { lt: 'latin', ea: 'ea', cs: 'cs' } |
| 393 | return ctx.theme.minorFont[mapping[key] || 'latin'] || typeface |
| 394 | } |
| 395 | return typeface |
| 396 | } |
| 397 | |
| 398 | /** |
| 399 | * Resolve a gradient fill node into a CSS linear-gradient string. |