ggplot2 icon indicating copy to clipboard operation
ggplot2 copied to clipboard

Saving plot with latin1 text to PDF gives warning

Open hmalmedal opened this issue 10 years ago • 3 comments

I have tested the dev version on Windows and I have found that plots with latin1 text give a warning when I save them to PDF.

Here's an example which I think is cross platform.

library(ggplot2)
library(stringi)
p <- ggplot() + labs(x = stri_conv("å", to = "latin1"))
ggsave("test.pdf")
## Saving 7 x 5 in image

## Warning in grid.Call(L_stringMetric, as.graphicsAnnot(x$label)): font
## metrics unknown for character 0x1b

hmalmedal avatar Oct 07 '16 18:10 hmalmedal

@pmur002 any thoughts on this? Seems like a graphics device issue to me.

hadley avatar Oct 07 '16 18:10 hadley

It looks like a bug in the graphics engine - the calculation of string metrics is ignoring the encoding. I will look at a fix.

Paul

On 08/10/16 07:50, Hadley Wickham wrote:

@pmur002 https://github.com/pmur002 any thoughts on this? Seems like a graphics device issue to me.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hadley/ggplot2/issues/1841#issuecomment-252331913, or mute the thread https://github.com/notifications/unsubscribe-auth/AB8wlHO-Etd3zeeFR8C6r2NFE4j865-cks5qxpSSgaJpZM4KRUWP.

Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 [email protected] http://www.stat.auckland.ac.nz/~paul/

pmur002 avatar Oct 11 '16 02:10 pmur002

Hi

I have committed what I believe is a fix to r-devel (r71511).

It would be great to get confirmation of the fix from someone if possible.

Paul

On 11/10/16 15:13, Paul Murrell wrote:

It looks like a bug in the graphics engine - the calculation of string metrics is ignoring the encoding. I will look at a fix.

Paul

On 08/10/16 07:50, Hadley Wickham wrote:

@pmur002 https://github.com/pmur002 any thoughts on this? Seems like a graphics device issue to me.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hadley/ggplot2/issues/1841#issuecomment-252331913, or mute the thread https://github.com/notifications/unsubscribe-auth/AB8wlHO-Etd3zeeFR8C6r2NFE4j865-cks5qxpSSgaJpZM4KRUWP.

Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 [email protected] http://www.stat.auckland.ac.nz/~paul/

pmur002 avatar Oct 13 '16 02:10 pmur002