-
Notifications
You must be signed in to change notification settings - Fork 45
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
Text: look for hyphenation in more words if needed #320
Merged
Conversation
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
When laying out lines and looking for wrap possibilities, we use the last breakable space found. But we also try to hyphenate the word that follows it to grab a bit of it. In the case where there are more words after that last breakable space (words separated by a non-breakable spaces, or where our AVOID_WRAP_BEFORE/AFTER checks decided that wrap is to be avoided at these spaces), we would only look at hyphenating the last word of this series of words: if that fails, we would not try to hyphenate previous words. We know check hyphenation in all these words. Sample test case: a french line ending with "pourqu'elle" overflowing max line width (wrap at ' is avoided): - if max line width ($) is met at "pourq$u'elle", "pour-qu" hyphenation would be found and used. - if max line width is met at "pourqu'el$le", only "elle" would be checked, and no hyphenation found and we would wrap before "pourqu" ; "pour-qu" would not be considered at all. It will be now.
Added a small commit to fix the fact that any of <p>die Eichhörnchen so, wie sie das tun?
Mit <span style="color: blue; hyphens: none">diesem Warum? begeben wir uns
zurück aud das ursprünglichkindlich Fragen</span></p> |
Might be useful with popup footnotes (the HTML snippet is given to MuPDF, even if its RTL support is currently limited).
poire-z
force-pushed
the
hyphen_rework
branch
from
November 28, 2019 12:25
b30ca9d
to
1720c04
Compare
Since we have those Arabic glyphs from FreeSerif (?) I guess that means the MuPDF patch needs a minor update. :-) |
Yes, they are in FreeSerif - but I dunno how many fallback fonts MuPDF supports (looks like it has one specific for CJK, and another for fallback, but dunno how that works in practice). |
This was referenced Nov 28, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When laying out lines and looking for wrap possibilities, we use the last breakable space found. But we also try to hyphenate the word that follows it to grab a bit of it.
In the case where there are more words after that last breakable space (words separated by a non-breakable spaces, or where our AVOID_WRAP_BEFORE/AFTER checks decided that wrap is to be avoided at these spaces), we would only look at hyphenating the last word of this series of words: if
that fails, we would not try to hyphenate previous words.
We know check hyphenation in all these words.
Sample test case: a french line ending with
pourqu'elle
overflowing max line width (wrap at'
is avoided):$
) is met atpourq$u'elle
,pour-qu
hyphenation would be found and used.pourqu'el$le
, onlyelle
would be checked, and no hyphenation found and we would wrap beforepourqu
;pour-qu
would not be considered at all. It will be now.Should solve the non-hyphenation issue of koreader/koreader#5645 (explanation in koreader/koreader#5645 (comment)).
With the example from this issue, with
Warum
made non-hyphenable by changing it toWzrzm
in the 2nd line - and the still-wrong avoid wrap cause by the quote/guillemet beforeWarum
, the possible wrap atdie-sem
was not considered before:Before:
After:
The real good behaviour would be to wrap between
diesem
and»Warum
- but this is another issue #307 (comment), yet to be fixed.This change is