Just to round this off for anyone else who like me is looking for a way to get the size of a text sequence, the workaround I posted on devtalk:
This feels like an ugly workaround, as it relies on Blender caching / reusing fontids for the same font file; but it works.
The basic approach is:
- get
filepathproperty fromTextSequence.font(ref) - resolve that to the absolute path via Python’s
path.normpath()- just using Blender’spath.abspath()gives an ‘absolute path relative (??!) to the blend’; if you don’t and use the ‘absolute relative’ path you get a new fontid, which should still work for getting the size, but it feels better to have obvious side effects - use that path with
blf.load()to get thefontid - set size with
blf.size()and theTextSequence.font_sizeproperty - finally, get size via
blf.dimensions()and theTextSequence.textproperty
For actual code, you can look at the get_strip_text_size() function in my addon.