import jsPDF from 'jspdf'

export const addFonts = async (doc: jsPDF) => {
  const fontModules = [
    import('./dmsans-bold'),
    import('./dmsans-normal'),
    import('./dmmono-normal')
  ]

  try {
    const modules = await Promise.all(fontModules)
    modules.forEach(module => {
      if (module && typeof module.addFont === 'function') {
        module.addFont(doc)
      }
    })
  } catch (error) {
    console.error('Error loading fonts:', error)
  }
}
