Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Uses Knuth/Liang hyphenation algorithm, which prioritises prevention of incorrect hyphens over perfect output (which is not practical -- dictionary size has to be limited). It's never going to be completely correct, the trade-off for having a few weird hyphenations is that overall it's generally ok, and yes, the alternative is ragged right. By default minimum length is two, and I assume the output is using that (haven't checked).

Edit: found the overview from the docs -- https://docs.racket-lang.org/hyphenate/index.html

And Liang's thesis (PDF): https://tug.org/docs/liang/liang-thesis.pdf

Edit edit: from memory (and it's been about 9 years since I last worked in print so a bit foggy), for print it's generally best to set either 2 or 3 as a minimum: 4 is pushing it and tends to cause issues. With print, set using the hyphenation algo then worked forward from the start of the book fixing any spacing issues. With web can't do latter and width is changeable, so there are always going to be issues with justification. I can't imagine any situation where the browser could operate fast enough to render accurately hyphenated text without using a huge amount of resource.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: