Description
Please provide all mandatory information!
Describe the bug (mandatory)
It seems that insert_textbox doesn't handle different fonts properly. Even when i add a default font, the text fits not always perfectly within the textbox. However, with a different font, there's either too much whitespace or the text overflows beyond the textbox.
The while loop will stop because the rc value is usually greater than 0, ( it is the "left white space value" right?) often around 2. However, with some fonts (like Allura), the textbox has almost half of its space left as whitespace.
So the rc value should be much higher.
To Reproduce (mandatory)
Explain the steps to reproduce the behavior, For example, include a minimal code snippet, example files, etc.
newdoc[r_frame["page"]-1].insert_font(fontname="Text_font", fontfile="Files/Fonts/" + order["font"])
font="Text_font"
text_color = (0/255, 38/255, 145/255)
size=order["min-font-size"]
rc= -1
while rc < 0 :#or (0 < rc < 10):
#print(size)
size=size-1
rc = newdoc[r_frame["page"]-1].insert_textbox(rect, text,
fontsize=size,
fontname=font,
rotate = 0,
color=text_color)
print(rc)
Expected behavior (optional)
Describe what you expected to happen (if not obvious).
The text should fit neatly within the rectangle, especially at the bottom. Some whitespace is expected due to varying fonts, but the text shouldn't extend outside the rectangle.
Screenshots (optional)
If applicable, add screenshots to help explain your problem.
See screenshot, for outcome off different fonts.