Skip to content

Character combination fails saving charts Error: Unable to merge embeddings of different levels #6497

Closed
@adisarid

Description

@adisarid

When trying to save charts with text combining Hebrew characters and English/Numeric characters, the saving process fails with an error message: Error: Unable to merge embeddings of different levels.

Here is the code to reproduce the bug:

plot_fails <- ggplot() + 
  ggtitle("טקסט בעברית עם מספר 7")
ggsave("tmp.png", plot_fails)

(You can replace '7' with any Latin character and it also fails).

Saving with only Hebrew characters (remove the '7') or only Latin characters works fine. The graphical device also works fine (the "Plots" pane in rstudio)

I've ran into this error message in various use cases that depend on ggplot2, e.g., when rendering ggplots in shiny apps, using officer to write presentations (makes sense...), etc.

Here is my sessionInfo():

R version 4.4.3 (2025-02-28)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 22.04.5 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0

locale:
 [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8        LC_COLLATE=C.UTF-8     LC_MONETARY=C.UTF-8   
 [6] LC_MESSAGES=C.UTF-8    LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C           LC_TELEPHONE=C        
[11] LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   

time zone: Etc/UTC
tzcode source: system (glibc)

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

other attached packages:
[1] ggplot2_3.5.2

loaded via a namespace (and not attached):
 [1] vctrs_0.6.5       cli_3.6.4         knitr_1.50        rlang_1.1.5       xfun_0.52         processx_3.8.6   
 [7] renv_1.1.4        generics_0.1.3    textshaping_1.0.0 glue_1.8.0        colorspace_2.1-1  htmltools_0.5.8.1
[13] ps_1.9.1          ragg_1.4.0        rmarkdown_2.29    scales_1.3.0      grid_4.4.3        evaluate_1.0.3   
[19] munsell_0.5.1     tibble_3.2.1      fastmap_1.2.0     yaml_2.3.10       lifecycle_1.0.4   compiler_4.4.3   
[25] dplyr_1.1.4       fs_1.6.5          pkgconfig_2.0.3   rstudioapi_0.17.1 digest_0.6.37     systemfonts_1.2.3
[31] R6_2.6.1          reprex_2.0.2      tidyselect_1.2.1  pillar_1.10.2     callr_3.7.6       magrittr_2.0.3   
[37] tools_4.4.3       withr_3.0.2       gtable_0.3.6     

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions