The two step projection makes this a bit more complicated. With the text position in data space and the textsize in pixel units you’d need
fig, ax, p = text("Test", position = Point2f(2))
scene = campixel(ax.scene);
bb = Rect2f(boundingbox(
p.plots[1][1][],
Makie.to_ndim(Point3f, Makie.project(ax.scene, p.plots[1].position[]), 0),
Makie.to_rotation(p.plots[1].rotation[])
))
mesh!(scene, bb, color = :yellow, shading = false)
lines!(scene, bb)
translate!(scene, 0, 0, -1)
fig
boundingbox(p)
seems to fall back on some default method that isn’t useful. boundingbox(p.plots[1])
does use the right method but assumes the text position and textsize to be in the same space. So you need to project position into pixel space first and use the boundingbox above. The result is in pixelspace so you need to plot in on a scene with a pixel camera.