library(grid)
library(Gmisc)
grid.newpage()
gp <- gpar(fill = "lightgrey")
(total <- boxGrob("some text doesnt fit",
x=0.55, y=.6, box_gp = gp,just = "center",width = 0.1,height = 0.1))
using the above code I want to reduce the text size to fit inside the box. is there an easy way with cex or auto sizing call? Any help would be appreciated.

There is no autosizing call. What you need to specify is the
txt_gpargument, e.g.:You could experiment with calculating the width and adjusting it accordingly. Currently the width is calculated using:
Just experiment with different sizes and see if it is within your limits. The grobWidth is part of the
gridpackage.