-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid trailing whitespace in kobo spans (#174)
# Implement long overdue TODO ## Description of change This seems like a small change but has huge implications for the way text is rendered with optimizeLegibilty and geometricPrecision. Really all it does is move the trailing whitespace to the front of the next group, just like the TODO note suggested ought to be done. I'm guessing at the exact mechanism, but for *unclear* reasons whatever justification program Kobo method uses it apparently does not expand or contract the last space in a kobo span. (unless using optimizeSpeed, maybe?) This can causes weird looking text, and in the worst case may even expand the space between letters just to stretch the text far enough. If this is correct it would fit the behaviour [observed by jackie_w](https://www.mobileread.com/forums/showpost.php?p=3812607&postcount=60) on the mobileRead forums This change may create a few pure-whitespace kobo spans when a sentence has some trailing whitespace, which I think could be ignored. ## Test results This seems to fix most issues with optimizeLegibilty. I'm still testing but the improvements I'm seeing are substantial enough that I think it might be best if other people try this out as well. Even if we can't fix everything it improves things *a lot*. Only niggle is that the regexp only works for proper sentences, there are still a couple of issues with things like *emphasis* where a span might end up with trailing whitespace. These occur when the text ends in whitespace mid sentence.
- Loading branch information
Showing
2 changed files
with
67 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters