Support Text Auto-formatting
Closed this issue · 1 comments
Figuring out where line breaks in text should occur is an annoying tedious process. It would be handy if Poryscript could automatically insert line breaks. There are some complications with this, since there are three types of line breaks:
- Next line (
\n
) - Scroll down (
\l
) - New Paragraph (
\p
)
The formatter should keep track of any manual line breaks used, so it knows whether to insert \l
or \n
at any given point. The formatter should never insert a paragraph break (\p
)--the user should have full control over that by manually placing \p
characters.
format("Hello, this is some text that should be autoformatted.")
# should become
"Hello, this is some text that should\n"
"be autoformatted.$")
format("Hello.\nThis is some text that should be autoformatted.")
# should become
"Hello.\n"
"This is some text that should be\l"
"autoformatted.$"
format()
should take an optional second argument fontId
, so the user can specify which font to format with. Rather than parsing any font-width files from the decomp projects, require the user to provide a config file. There is more nonsense and engine differences involved than I'd be willing to put up with, otherwise. The config file can could a JSON file with a format like this:
{
"font1": {
"a": 5,
"b": 5,
"c": 6,
...
"{PKMN}": 16,
"{PLAYER}": 56,
},
"font2": {
...
}
}