gadenbuie / xaringanthemer

😎 Give your xaringan slides some style

Home Page:https://pkg.garrickadenbuie.com/xaringanthemer/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Header font fallback in style_xaringan

mattwarkentin opened this issue · comments

Hi Garrick,

Should there be a header_font_family_fallback parameter in style_xaringan() similar to text_font_family_fallback and code_font_family_fallback? Or does it just default to using the fallback defined for text?

Hmmm, yeah if the others have it... The primary use case for the _fallback args would be to specify the font used if font loading from Google Fonts fails (i.e. you're offline).

If you're using header_font_family_google,

style_xaringan(
  header_font_google = google_font("Josefin Slab", "600")
)

you might want to have headers use Helvetica if Josefin Slab isn't available.

h1, h2, h3 {
  font-family: 'Josefin Slab',Helvetica,sans-serif;
}

Currently, without the header_font_family_fallback, if you use a google_font() for the header, you can't specify the ,Helvetica,sans-serif part of the font-family declaration.

(Actually the work around would be to use extra_fonts = google_font("Josefin Slab", "600") and set header_font_family = "'Josefin Slab',Helvetica,sans-serif", but that's not ideal.)

So short of rewriting the font argument handling, then yes this seems like a decent idea 😄

For sure, the fallbacks are just a safety net. I just wasn't sure if a header fallback was purposefully omitted.

So short of rewriting the font argument handling, then yes this seems like a decent idea 😄

Sounds good!