Is there a way to determine the size of a text sequence?

This is technically possible, but the process is a bit convoluted- you can use the blf module (which is normally used for rendering text) to calculate the dimensions of a string. Here’s a minimal example that should give you some ideas- you will obviously need to take the sequence’s transform into consideration, render resolution, things like that.

# the first three font indices are built-in blender fonts, so if you have a single custom font 
# loaded the font_id to use here is 3. you basically just want to loop through bpy.data.fonts until
# you find seq.font, then add 3 to whatever index you found it at.
font_id = 3
blf.size(font_id, seq.font_size, 72)
width, height = blf.dimensions(font_id, text)
print(f"Text strip dimensions: {width} x {height}")

I’m not sure how accurate it is, so you might need to do a bit of experimenting, but I did a quick test where I loaded a super condensed font, and then a bold/book font and saw a notable difference in the width output. I didn’t actually take any screenshots and measure the pixels to compare- so ymmv. Anyway VSE is not my area of expertise, but I wanted to give you an idea of some things to try, since there weren’t any replies to your question yet.

1 Like