As this code,we can visualize the "Test text"

Graphics[Text[Style["Test text",20],{0,0}],Axes->True,AxesOrigin->{0,0}]

I try to use DiscretizeGraphics to get the width and length of "Test text".

Abs[Subtract@@@RegionBounds[DiscretizeGraphics[Text[Style["Test text",20],{0,0}],_Text]]]


The result is unexpected obviously.


  1. Is this a bug of DiscretizeGraphics?
  2. Can any solution get the width and length of "Test text"?
  • $\begingroup$ Isn't the problem that the RegionBounds aren't set? If you inscribe the text in a Circle[{0, 0}, {i, j}], within the same Graphics[], the text doesn't change in size if you change the radii of the circle. $\endgroup$
    – Feyre
    Commented Jul 1, 2016 at 11:57
  • $\begingroup$ @Feyre I think this isn't the problem of RegionBounds,If your click <kbd>.</kbd> then move your cusor to right bottom of the "Test text",you can see the coordinate like this. $\endgroup$
    – yode
    Commented Jul 1, 2016 at 12:06
  • $\begingroup$ But those are the bounds of the meshregion you've created. $\endgroup$
    – Feyre
    Commented Jul 1, 2016 at 12:10

1 Answer 1


Text does not scale with the ImageSize. Try to manually resize graphics containing text (by dragging the handle). The text will not change size. Text size is given in absolute units.

To get the dimension of text in absolute units (which is distinct from the Graphics coordinate system), use Rasterize[..., "RasterSize"]. If you use "BoundingBox" instead of "RasterSize", it will also give you the baseline position.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.