-
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
Selectable kerning methods: disabled / freetype / harfbuzz #228
Conversation
Picked the only relevant changes (crengine/*) from upstream PRs: buggins/coolreader#24 buggins/coolreader#29 Fixed a single rejection due to our soft-hyphens support changes.
Make the kerning method selectable: - disabled - freetype (same as always) - harfbuzz (new method) Text shaping/kerning with HarfBuzz may be 2 times slower than previously with freetype only, so let's keep the fast method. Also, the auto-hinting with freetype is ugly with harfbuzz, but it still provides a pleasant airy rendering with freetype kerning.
It was wrong since we increased the number of gamma values from 30 to 56 (so the value 15 has uneeded processing, and the value 28 was ignored.)
Mostly comments, as HarfBuzz already deals correctly with soft-hyphens, and original PRs also did that correctly.
buggins/coolreader@195b53ee Avoids misplaced glyphs with large font sizes.
Just adding some notes I found for reference: https://lists.freedesktop.org/archives/harfbuzz/2015-December/005381.html
https://lists.freedesktop.org/archives/harfbuzz/2015-December/005387.html
https://lists.freedesktop.org/archives/harfbuzz/2015-August/005036.html |
Well, I guess I can just read a book whenever I was planning to look into this. Thanks! :-D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing strikes me as suspicious looking, but I didn't look in close detail because I assume it was already reviewed in the other repo as well and I imagine you also had a look at it. :-)
It's been disabled today in the other repo. |
MuPDF (in EPUB as well as PDF) already does that. Including literally. The NRC subscription includes downloadable PDFs of the articles. (Not that I stick them on the ereader… but I could.) |
This line
enable kerning feature. If you don't look difference maybe you font don't have any kerning table. |
Thanks @virxkane , and for your work on this HarfBuzz integration :) |
Maybe there? See HB_TAG |
Just mentionning that (no intent to investigate): |
Mentionning this Mobiread post, with some sample EPUB mixing english and persian words, and screenshots of how it should look: https://www.mobileread.com/forums/showthread.php?p=3828770#post3828770 |
See #224.
Includes from upstream:
Kerning methods made selectable:
Off / Freetype / Harfbuzz
as Harfbuzz shaping it a bit slower than pure-freetype, but it is perfectly usable on small books, and on big books once a cache has been built. It's just the rendering when toggling an other option that will take a bit longer to re-render the document.Anyway, it looks like harfbuzz does more than kerning by default, and does some Right-To-Left shaping of words in arabic (I can't read, but it looks like they are reversed :) , but only on the word level: in the sentence/line, they are in a Left-To-Right order (as they are in the HTML). I guess that would be lvtextfm.cpp work to do it on the line level.
Another thing I forgot to add as a comment, but did not investigate much: the lines like:
hb_feature_from_string("+kern", -1, &_hb_kern_feature);
do not seem to change harfbuzz behaviour. Even when not requesting
+kern
, we get ligatures (so, may be these are different features, and ligatures are enabled by default).For reference: https://www.preusstype.com/techdata/features.php (I tried to enable a few, got no change in my sample text).
Closes #224.