Skip to content

Esoteric bug with specific text #193

@teunbrand

Description

@teunbrand

Hi Thomas,

This is a transfer of tidyverse/ggplot2#6539. Essentially, when trying to render the text 'Sr' and 'Fe', it renders 'Sr' twice instead of each once. In the reprex below, this is why we only see 'Sr' and not 'Fe' on top per the instructions. Other graphics device do not show this problem and so far the only text for which this bug observed is exactly 'Sr' and 'Fe'.

library(grid)

# Render as text grobs
vals <- c("Sr", "Fe")
grobs <- lapply(vals, textGrob)

# Confirm label is correct
grobs[[1]]$label
#> [1] "Sr"
grobs[[2]]$label
#> [1] "Fe"

# Create device for temp file
tmp <- tempfile(fileext = ".png")
ragg::agg_png(tmp)

# Draw the grobs
grid.newpage()
grid.draw(grobs[[1]])
grid.draw(grobs[[2]])

dev.off()
#> png 
#>   2
knitr::include_graphics(tmp)

Created on 2025-07-02 with reprex v2.1.1

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