Skip to content

Commit

Permalink
fix: allow passing partial options to resolveFont
Browse files Browse the repository at this point in the history
resolves #28
  • Loading branch information
danielroe committed Oct 6, 2024
1 parent 6440670 commit a3a9d44
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,15 @@ export async function createUnifont(providers: Provider[], options?: UnifontOpti

const allProviders = Object.keys(stack)

async function resolveFont(fontFamily: string, options = defaultResolveOptions, providers = allProviders) {
async function resolveFont(fontFamily: string, options?: Partial<ResolveFontOptions>, providers = allProviders) {
const mergedOptions = { ...defaultResolveOptions, ...options }
for (const id of providers) {
const provider = stack[id]
if (!provider?.resolveFont)
continue

try {
const result = await provider.resolveFont(fontFamily, options)
const result = await provider.resolveFont(fontFamily, mergedOptions)
if (result) {
return {
provider: id,
Expand Down

0 comments on commit a3a9d44

Please sign in to comment.