-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve word wrap #37
Comments
Are you doing hyphenation? Might be better to save your time if you are. As far as I'm aware hyphenation is avoided in scripts (I think because it'd make for stilted line readings). |
Yes and no. Currently Wrap breaks lines by a greedy algorithm (at some point I might look at something similar to TeX's algorithm but screenplays are very constrained so I'm guessing that wouldn't give much better results). First we collect cells (which are parts of the source text with certain markup, and are already grouped into lines as in the source file) until the line is full. If there are too many characters on the line we search for a breakpoint in the last cell. A breakpoint is a Unicode space or a hyphen. If we don't find a breakpoint we break at the upper limit the line length allows. If there are two letters here we insert a hyphen (most likely in a place where we shoudn't), otherwise we don't (but we probably broke a number in two). There's a number of issues here:
A similar set of issues exist for page breaks. Although we don't do anything wrong there, there are only better selection criteria which would try harder to avoid page breaks which break within an element, etc. (see #38) |
Thanks, that’s an impressively comprehensive overview! |
Started working on this on the linewrap branch. As of now only 3. is fixed. |
The current word wrap algorithm works for most cases, however it's fairly clunky code and in some very rare cases it inserts a hyphen where it probably shouldn't or does something else weird.
The text was updated successfully, but these errors were encountered: