r-lib / marquee

Markdown Parser and Renderer for R Graphics
https://marquee.r-lib.org
Other
85 stars 1 forks source link

Blurry text when executing vignette example on MacOS #21

Closed markheckmann closed 6 months ago

markheckmann commented 6 months ago

Thanks for this package! :)

When trying out the first example from the vignette (code below), the text in the image is quite blurry (in RStudio viewer as well as when saved as png). Also, I get the following warning.

> grid.draw(grob)
Warning message:
In drawDetails.GridGroup(x, recording = FALSE) : Group definition failed

I am on MacOS (see sessionInfo() below)

image

Executed code

library(marquee)
library(grid)

md_text <-
  "# Lorem Ipsum
Lorem ipsum dolor sit amet, *consectetur* adipiscing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna **aliqua**. Ut enim ad minim veniam, quis nostrud exercitation ullamco
laboris nisi ut aliquip ex ea commodo _consequat_. Duis aute irure dolor in reprehenderit in
voluptate velit esse cillum dolore eu fugiat nulla ~pariatur~. Excepteur sint occaecat
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."

grob <- marquee_grob(md_text, classic_style())

grid.draw(grob)

png(filename="dev_local/05_test_marquee/img.png")
grid.draw(grob)
dev.off()

Session Info

> sessionInfo()
R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.5

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Europe/Berlin
tzcode source: internal

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] marquee_0.1.0

loaded via a namespace (and not attached):
[1] compiler_4.3.1    cli_3.6.2         tools_4.3.1       rstudioapi_0.15.0 vctrs_0.6.5       textshaping_0.4.0 lifecycle_1.0.4   systemfonts_1.1.0
[9] rlang_1.1.3   
thomasp85 commented 6 months ago

The warning message is from RStudio and out of my control - it's a bug that will be solved eventually, but I agree it's annoying.

The blurriness is because of the resolution you are plotting to and outside of the control of marquee. Increase the dpi and you'll get a sharper image