Closed mgageo closed 4 days ago
The PDF export does not use exactly the same font as the R graphic device (you can see that with the "-"). It can probably be set with some options but it is not specific to mapsf
.
For a vector format export an SVG export is more accurate.
For a PNG export you can set the width and height of the figure.
library(mapsf)
m <- mf_get_mtq()
mf_map(m)
mf_title("Test--Tiret")
# device size
w <- dev.size("in")[1]
h <- dev.size("in")[2]
# export pdf
(dsn <- paste0(tempdir(), "/mapsf_devcopy.pdf"))
dev.copy(pdf, dsn, width = w, height = h)
dev.off()
# export svg
(dsn <- paste0(tempdir(), "/mapsf_devcopy.svg"))
dev.copy(svg, dsn, width = w, height = h)
dev.off()
# export png
(dsn <- paste0(tempdir(), "/mapsf_devcopy.png"))
dev.copy(png, dsn, width = w*72, height = h*72, type = "cairo")
dev.off()
PDF : mapsf_devcopy.pdf
SVG :
PNG :
The prefered way to export maps with mapsf
is with the mf_export()
function. See https://riatelab.github.io/mapsf/articles/web_only/how_to_export_maps.html
Merci pour votre recherche de l'origine du problème, je contourne en ajoutant une espace à la fin du texte.
Je sauvegarde en pdf ou en png la fenêtre graphique avec dev.copy. Alors qu'à l'écran le titre s'affiche complètement, le caractère de droite n'est pas visible sur les copies. à l'écran en png, perte du "1" final
Le script : https://github.com/mgageo/issues/blob/main/issue_mapsf4.R