ggeasy icon indicating copy to clipboard operation
ggeasy copied to clipboard

Set custom fonts for layer or all text elements

Open geotheory opened this issue 5 years ago • 6 comments
trafficstars

Is the title sufficient? :)

geotheory avatar Aug 13 '20 09:08 geotheory

Cheers. Do you have an example of the "hard way"?

element_text(family = ?

jonocarroll avatar Aug 13 '20 10:08 jonocarroll

theme(text = element_text(family = "candara", size =24))

You would need to assume user is attaching {showtext} or {extra} to load fonts onto the machine and session

yonicd avatar Aug 13 '20 10:08 yonicd

Thanks @yonicd . I wonder whether there's an opportunity here to tap into Google Fonts, e.g. maybe with showtext if that looks appropriate.

geotheory avatar Aug 13 '20 10:08 geotheory

Keeping in mind that {ggeasy} is about shortcuts - we can support easy ways to achieve what was already possible, but I'm reluctant to add functionality not already available.

I'm fine with a message to remind the user to install or attach other packages, but we can only work with what is possible the "hard way".

Supporting any of these would be an out-of-the-box solution: https://stackoverflow.com/a/61775520/4168169

jonocarroll avatar Aug 13 '20 10:08 jonocarroll

Fair point. Maybe then just an example that show how e.g. easy_text_font() can complement an existing webfont method?

geotheory avatar Aug 13 '20 11:08 geotheory

there is also this way to set things globally, which I use more often than not:

theme_set(theme_gray(base_size = 20, base_family = 'Font Name' ))

yonicd avatar Aug 13 '20 14:08 yonicd