Context:
I am looking for a way get the size of a text strip.
In the BA thread above, @testure kindly pointed me at blf.dimensions
, which works but requires a fontid
. Since I have not loaded the font myself via blf, I do not have a fontid†. The suggestion was to add 3 to the index of the font in bpy.data.fonts
, but I found that in my case the offset is bigger (24-26) and not consistent even within the same blend file (via writing an operator to walk text strips and fontids and output results in text form).
I’ve looked at the python API docs but I don’t see anything that links existing fontids and fonts. However, since I am relatively unfamiliar with the API it is possible I have overlooked a convenience function, perhaps an operator or in another module.
Q: is there anything in the API that lets me figure out a (blf) fontid from a TextSequence.font / blf.data.fonts; or conversely figure out a font’s identity (.name) from a fontid? Does such a thing exist, or would the API have to be extended to match one to the other?
This seemed like the more appropriate place than BA to ask about in-depth API usage; thanks in advance for your time!
†: It works in the sense that if I figure out the fontid that represents the text strip’s font manually, I can call blf.size()
and blf.dimensions()
and get a result that exactly matches the text strip