> @pavelsr It's not possible to calculate the bounding box, because we don't have the paths for the text. All we know is that you have some text, we have no idea what it looks like, and therefore how big it is.
But it doesn't work if I have paths for the text. If I use text.get_path().shape_box() instead of text.shape_box() I got AttributeError: 'Path' object has no attribute 'shape_box'
If I make text.get_path().bounding_box() it returns None
How to get paths for text and then get bounding box for it ?
Official description of shape_box method looks like:
Why it's impossible to calculate width or height of text ?
That is maybe because it dynamically changes with the use of descender+ascender etc if this makes sense.
Is it possible to calculate width and height of text in Inkscape using other methods ?
By the way, I saw that there is standart getBBox() method at SVG 2.0 spec, doing same that I need from Inkscape:
If I change font size or style in example above - bbox var is changing and calculating fine.
If I do same in Python - result is not ok
Any chance to count bbox of text in Inkscape?
My versions:
Maybe try your query in the Chat: https://chat.inkscape.org/channel/inkscape_extensions
Good luck.
Response from chat:
> @pavelsr It's not possible to calculate the bounding box, because we don't have the paths for the text. All we know is that you have some text, we have no idea what it looks like, and therefore how big it is.
But it doesn't work if I have paths for the text. If I use
text.get_path().shape_box()
instead oftext.shape_box()
I gotAttributeError: 'Path' object has no attribute 'shape_box'
If I make
text.get_path().bounding_box()
it returnsNone
How to get paths for text and then get bounding box for it ?
That is what I was trying to say. Text object is dynamically updating and has probably too many variables like myriads of font types for instance.