skyjake / lagrange

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

Improved glyph coverage with system-provided fonts (v1.8 has downloadable fonts) #195

Open handicraftsman opened 3 years ago

handicraftsman commented 3 years ago

As you can see below, there are heavy issues with rendering Chinese characters and slightly less issues with Korean characters.

Снимок экрана от 2021-03-05 18-07-38

skyjake commented 3 years ago

Missing CJK glyphs is a known issue at the moment. It's happening because Lagrange only uses fonts from its own resources. For better CJK coverage, system-provided fonts should be used.

I'm hesistant to package a large number of CJK fonts with the app because font data is already taking 20+ MB in the distribution, which is a lot compared to the app itself.

bortzmeyer commented 3 years ago

What about arabic characters? Currently, Lagrange does not seem to display them at all, I get question marks (other programs on my system can do it, even xterm).

skyjake commented 3 years ago

Arabic is fundamentally the same problem, although there’s also the RTL text rendering challenge.

I’ve been thinking about this. When it comes to using system fonts, it is actually not a great solution for Lagrange. Font/text APIs either require platform-specific code or addition of new libraries like FreeType. While I may adopt FreeType at some point, this doesn’t solve the issue that the user may not have all the needed fonts installed on their system.

A better solution than bundling 50-100 MB of fonts with the app could be to add a mechanism to download additional fonts from a manually curated collection. The UI could offer to do this automatically when encountering missing glyphs.

This would work with any platform Lagrange runs on without additional dependencies.

handicraftsman commented 3 years ago

Technically FreeType can be bundled together with Lagrange, it's not that much of the effort.

Same comes to harfbuzz, which implements the text shaping engine missing in FreeType.

skyjake commented 3 years ago

Indeed, but my concern is the addition of new dependencies and therefore increased complexity, which need to be managed both in source code and in distribution over time, across all platforms. My goal is to keep things minimal in this regard, if at all possible.

handicraftsman commented 3 years ago

That's a nice goal actually for such a Unix-like app actually!

skyjake commented 3 years ago

4756b0a18d58560cc4023ed61d4940b127da63f3 is a small step forward here.

I've previously also added a Simplified Chinese variant of Noto Sans CJK.

skyjake commented 2 years ago

Version 1.8 now has full support for downloadable and local TrueType fonts (as long as they are single-color, non-bitmap, and unhinted).

The Noto fonts have quite good Unicode coverage for a wide selection of languages, and a more complete version of Noto Sans CJK is also available.