groucho86
7th February 2020, 13:43
Any idea how to calculate the width and height of sub.TextFile rendered text?
The goal is to crop the text to its used area only.
Myrsloik
7th February 2020, 19:03
Any idea how to calculate the width and height of sub.TextFile rendered text?
The goal is to crop the text to its used area only.
Maybe it could be exported as a frame property.
groucho86
8th February 2020, 00:03
Yes that could be useful!
I was playing around with "Wand" (http://docs.wand-py.org/en/0.5.8/) which is an ImageMagick binding for Python. It offers a "get_font_metrics" which returns something like:
FontMetrics(character_width=35.0, character_height=35.0, ascender=35.0, descender=-13.0, text_width=628.0, text_height=618.0,
maximum_horizontal_advance=35.0, x1=5.5, y1=16.671875, x2=12.671875, y2=25.0, x=628.0, y=0.0)
Probably overkill for subtitling needs, but it is helpful.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.