gadenbuie / xaringanthemer

😎 Give your xaringan slides some style
https://pkg.garrickadenbuie.com/xaringanthemer/
Other
445 stars 28 forks source link

Be more strict on what "extra_fonts" arg accepts #19

Closed pat-s closed 4 years ago

pat-s commented 4 years ago

Help page

A list of additional fonts to import, each list element can be either a URL as a character string or a call to google_font()

However, other font arguments such as "text_font_google" and friends accept a single font only (which makes sense). Though if one specifies a single font only for "extra_fonts", not

@import url(https://fonts.googleapis.com/css?family=Crimson+Text);

is parsed into the resulting CSS but only

@import url(Crimson Text);

The latter results in the font not being available.

Suggestion: Either support only a list for extra_fonts or also support single google_font() calls.

(I know these are the ugly details of a package that comes with functions that have so many args... :smile: )

gadenbuie commented 4 years ago

Thanks @pat-s ... You're right, a single google_font() wasn't handled properly by extra_fonts and I fixed this in xaringanthemer@dev. In that branch you should be able to use

I don't think I handled the edge case of accidentally concatenating a URL and a google_font() -- e.g. extra_fonts = c(font_url, google_font(font_name)) -- and I'll look into adding that.

pat-s commented 4 years ago

extra_fonts = c(font_url, google_font(font_name))

so many edge cases - I guess no one would expect that to work OOB. But great effort as always :rocket:

gadenbuie commented 4 years ago

so many edge cases

So true! So many that I realized I mistyped in my answer, google_font() only takes one font, but you can put multiple google fonts into a list().