adamhsparks / ChickpeaAscoDispersal

Chickpea _Ascochyta rabiei_ Spore Dispersal Modelling
https://adamhsparks.github.io/ChickpeaAscoDispersal/
3 stars 1 forks source link

Font not loading on Windows machine #6

Closed PaulMelloy closed 4 years ago

PaulMelloy commented 4 years ago

https://github.com/adamhsparks/ChickpeaAscoDispersal/blob/c348e2837c86c319a244cf120afb1490c9549a3e/vignettes/a03_Visualise_data.Rmd#L35

I think the problem here is that it should be written 'arial' not 'Arial' i.e. font_import(pattern = "arial")

The later code worked for me on my windows machine Can you test this on your mac Adam

adamhsparks commented 4 years ago

Here's a good rundown of why this is an issue for us: https://stackoverflow.com/questions/59949572/i-cannot-import-fonts-using-font-import

On Wed, 6 May 2020 at 11:01, Paul Melloy notifications@github.com wrote:

Assigned #6 https://github.com/adamhsparks/ChickpeaAscoDispersal/issues/6 to @adamhsparks https://github.com/adamhsparks.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/adamhsparks/ChickpeaAscoDispersal/issues/6#event-3306540332, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYMIAQPZOVEW3UQ72HKPIDRQCZFHANCNFSM4M2A5GBA .

-- Dr Adam H. Sparks http://adamhsparks.com/ Associate Professor of Field Crops Pathology | Centre for Crop Health | Office C313

Phone (+61) 07 46311948 | Mobile 0415 489 422 | Twitter @adamhsparks https://twitter.com/adamhsparks

Institute for Life Sciences and the Environment | Research and Innovation Division University of Southern Queensland | Toowoomba, Queensland | 4350 | Australia

PaulMelloy commented 4 years ago

Groan* How about we add a comment at the end of the line specifying If this fails on a windows machine change pattern = "Arial" to pattern = "arial"

adamhsparks commented 4 years ago

Try the latest commit, see if it works locally on Windows for you now.

# run only if knitting on new computer
# this is necessary to embed fonts in .eps files for EJPP
library("extrafont")

if (.Platform$OS.type == "windows") {
   font_import(pattern = "arial", prompt = FALSE)
   loadfonts(device = "postscript", quiet = TRUE)
} else {
   font_import(pattern = "Arial", prompt = FALSE)
   loadfonts(device = "postscript", quiet = TRUE)
}
PaulMelloy commented 4 years ago

Nice fix! - Works well without errors