Here a test text. I use a gray background to show how large the bounding box actually is.
t = Graphics[Text["Test", BaseStyle -> {128}, Background -> Gray]]
d = ImageDimensions[ImageCrop[t]];
Graphics[
{
FaceForm[], EdgeForm[Red],
Text["Test", {0, 0}, {-1, -1}, BaseStyle -> {128}],
Rectangle[{0, 0}, Offset[d, {0, 0}]],
PointSize[0.05], Point[{0, 0}]
}
]
If you want a closer cut for your bounding box, just remove the Background option and ImageCrop
again. However, note that offsets in the Text
function are with respect to the bounding box Mathematica uses (indicated by the gray box).
t = Graphics[Text["Test", BaseStyle -> {128}]];
d = ImageDimensions[ImageCrop[t]];
Graphics[
{
FaceForm[], EdgeForm[Red],
Text["Test", {0, 0}, {-.97, -0.6}, BaseStyle -> {128}],
Rectangle[{0, 0}, Offset[d, {0, 0}]],
PointSize[0.05], Point[{0, 0}]
}
]
Note the {-.97, -0.6}
offset?