duskmoon314 / typst-fontawesome

A Typst library for Font Awesome icons through the desktop fonts.
https://typst.app/universe/package/fontawesome
MIT License
12 stars 0 forks source link

Package should not rely on font fallback #6

Closed Enivex closed 2 months ago

Enivex commented 2 months ago

Currently, the package breaks if I use #set text(fallback: false).

The issue is that it relies on implicit fallback in order to do its thing. As an example

#fontawesome.fa-orcid()
#fontawesome.fa-phone()

displays tofus. If I do #fontawesome.FA_SET.update("Brands"), then fa-orcid() does work, while if I do #fontawesome.FA_SET.update("Free Solid") then fa-phone() works. Both cannot work simultaneously.

Instead of what it's currently doing, the package should specify an explicit list of fonts, and not just a single font.

Enivex commented 2 months ago

For the time being I just changed the definition of fa-icon to

#let fa-icon(
  name,
  solid: true,
) = {
  text(
    font: (
      "Font Awesome 6 Brands",
      "Font Awesome 6 Free" + if solid {
        " solid"
      },
    ),
    name,
  )
}

Which works sufficiently well for the time being.

duskmoon314 commented 2 months ago

Wow, I didn't notice that I can use an array of fonts as the parameter.

Cool, I will fix this ASAP.

duskmoon314 commented 2 months ago

Thanks! I think this is fixed now.