skyjake / lagrange

A Beautiful Gemini Client
https://gmi.skyjake.fi/lagrange/
BSD 2-Clause "Simplified" License
1.21k stars 64 forks source link

Support hyphenation #552

Open antanst opened 2 years ago

antanst commented 2 years ago

Since Gemini is all about text, I believe readability would be greatly enhanced if Lagrange supported hyphenation for paragraph text. I am not sure how much work this is though.

skyjake commented 2 years ago

Hyphenation is not an easy feature to implement, as it depends on reliably knowing the language of the text and there also needs to be a database of hyphenated words or an algorithm that determines where to put the hyphens. One could require the lang MIME attribute to be set, but unfortunately that is not extremely widely used.

There are probably existing open source libraries that handle some or all of this. Adding one as an optional build dependency might be doable.

In the meantime, it is possible to use the MIME hooks feature to filter text through an external tool that inserts Unicode invisible hyphen characters in appropriate places. (Although I'm not sure if they are currently used correctly by the HarfBuzz-based text renderer.)