Our plugin can help and offers a few functions related to fonts. For example Font.CalculateTextWidth can calculate the length of a text in points, so you know whether text will fit.
MBS( "Font.CalculateTextWidth"; "Hello World"; "Arial"; 12 )
Your calculation may for example detect that the whole name doesn't fit. But maybe "Mr. Zimmermann" fits and then you may use that one.
Now if you like to know whether text will fit in height, you can use Font.CalculateTextHeight functions.
MBS( "Font.CalculateTextHeight"; "Hello World. Just a test."; 100; "Arial"; 12 )
This would use 100 points as wrap limit, so we get a second row of text. The height returned here should be something like 36 points. The actual numbers are not identical for macOS and Windows since both OS have their own way of anti aliasing and get different sizes for various letters, even for the same font.
The third function Font.CalculateTextFits will take a text and return the number of characters, that fit in a given space.
MBS( "Font.CalculateTextFits"; "Hello World"; 50; "Arial"; 12)
This may return 8 here as 50 points don't fit the full text "Hello World", but only "Hello Wo". Your script may then decide to cut two more characters and put in three dots.
A specialty is that the font parameter can be a font name specifying the exact font if needed on macOS. Since Arial bold has a separate font file called Arial-BoldMT, you can specify that to pick the bold font.