I've this rough idea:
* have one string of a subparagraph, this is the string in which you can type/modify directly. Your whole text is made out of multiple subparagraphs put after each other.
* format the string, wrap words, and output each visual line to an array. So if your subparagraph spans 5 lines, then you'll have 5 arrays. You store these 5 arrays in a the same object as your subparagraph string.
* Now you have the input string, and a formatted version in a format you can browse through, while you never need to adjust the formatting on-the-fly.
As a result, the text is roughly twice in memory, but in today's machines it hardly matters, esp. as you didn't intend to write a whole novel in that game screen.
* have one string of a subparagraph, this is the string in which you can type/modify directly. Your whole text is made out of multiple subparagraphs put after each other.
* format the string, wrap words, and output each visual line to an array. So if your subparagraph spans 5 lines, then you'll have 5 arrays. You store these 5 arrays in a the same object as your subparagraph string.
* Now you have the input string, and a formatted version in a format you can browse through, while you never need to adjust the formatting on-the-fly.
As a result, the text is roughly twice in memory, but in today's machines it hardly matters, esp. as you didn't intend to write a whole novel in that game screen.