Unexpected behavior of DiscretizeGraphics

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]]]

{75.6577,8.49565}

The result is unexpected obviously.

Question

Is this a bug of DiscretizeGraphics?
Can any solution get the width and length of “Test text”?

=================

  

 

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.
– Feyre
Jul 1 at 11:57

  

 

@Feyre I think this isn’t the problem of RegionBounds,If your click . then move your cusor to right bottom of the “Test text”,you can see the coordinate like this.
– yode
Jul 1 at 12:06

  

 

But those are the bounds of the meshregion you’ve created.
– Feyre
Jul 1 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.