Skip to content

Commit

Permalink
Changed vjust in textGrob to 0.5 to fix over-and-under spacing of tex…
Browse files Browse the repository at this point in the history
…t on curves
  • Loading branch information
AllanCameron committed Nov 26, 2021
1 parent 67fe212 commit 9f59f2e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions R/geometry_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@

letters <- measure_text(label, gp = gp, vjust = vjust[1], halign = halign)

letters$ymin <- letters$ymin - measure_text("x", gp = gp, vjust = 0.5)$ymin[1]

y_pos <- unique(c(0, letters$ymin))

offset <- .get_offset(path$x, path$y, d = y_pos)
Expand Down
2 changes: 1 addition & 1 deletion R/grob_textpath.R
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ makeContent.textpath <- function(x) {
x, textGrob(
label = text$label,
x = text$x, y = text$y, rot = text$angle,
vjust = 0, hjust = 0.5, gp = gp_text,
vjust = 0.5, hjust = 0.5, gp = gp_text,
default.units = "inches"
)
)
Expand Down

0 comments on commit 9f59f2e

Please sign in to comment.