I am using the SFML library but my question may be more general.
Is there a way to set a fixed rectangle beforehand and then write text in it such that the line breaks are done automatically when I reach the right side of the rectangle?
If not, how is it possible to do this? thanks
I am using the SFML library but my question may be more general. Is
Share
Unless you can find a text widget that can break text lines, you will have to do this.
You will need to convert the text to drawing units, determine the amount of text occupied so far, find the amount of space remaining to the right edge and then calculate the number of characters that can be printed. The drawing units may differ depending on the font size, and whether it is a fixed or proportional font.
I suggest trying to find a widget or using a different framework.