Setting font fallback in YAML header using bslib

Is there a proper way to set the fallback font in the YAML header when a Google font is the desired one? In bs_theme(), it can be supplied to font_collection(), but it is not clear how a plain string name of a font family can be supplied in the YAML when a key:value entry is present for setting the Google font.

I think you can use any suffix of face_* as YAML field, then need to pass as value what is expected by the function.

I think something like this should work

output: 
  html_document:
    theme:
      version: 4
      base_font: 
        collection: 
          - !expr bslib::font_google("Pacifico", local = FALSE)
          - "Roboto"
          - "sans-serif"

I think the !expr is required here. I don't know if this is supported or just working with current implementation. You could open an issue in bslib to ask on how to provide a font collection with R Markdown documents.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.