Paragraph line break improvement #205
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm currently trying to improve line-breaking within narrow tables and was therefore working on the basic line-breaking code (in PdfFlattenVisitor).
There was a problem with soft-hyphens which I believe come from a problem with the encoding of the source file, so I replaced the constant used in Migradoc with a Unicode code-point (instead of a Latin-1-encoded SHY character), and I replaced the code that would break on a soft-hyphen to use that constant, rather than repeating the SHY character. This will now work independent of the actual encoding of the source files. Note that in the diff, it looks like I've replaced an empty string with the constant, but it is actually the SHY character that was replaced :)
The actual addition, however, is added support for zero-width spaces. This should allow us to fulfill most of our line-break needs from outside (by injecting zero-width spaces at appropriate positions). Since the whole purpose of this character is breaking at that point if required, I figured it would be good non-breaking (pun intended) change to PdfSharpCore.