basic wrapping

hi everyone
i just want to ask
how to use Textout() to achieve wrapping new line just like notepad format function
anyone can help me ? thank you very much
Are you asking about the old BGI textout() graphics function?

Give me a minute -- gotta get my daughter some cereal.


Okay, the most basic algorithm considers only a maximum line width -- in your case, in pixels.

You'll need the textwidth() function to find out how many pixels wide a specific string will display.

Break your text into words (break on spaces) and find the most words at the beginning of a line that has a text width less than or equal to your maximum line width. Write that, then increment your Y by the textheight() for that line.

Remove the stuff you just wrote from the beginning of the string and repeat while there is text to write.

Hope this helps.
Last edited on
Topic archived. No new replies allowed.