Render box characters ourselves (don't use font glyphs) #198

Closed
opened 12 months ago by dnkl · 2 comments
dnkl commented 12 months ago
Owner

Several other terminal emulators (not all) render box characters themselves, rather than using font glyphs.

In a perfect world, all terminal fonts would have box characters glyphs, and we wouldn't have to do anything special at all.

That however is not the case. Many fonts lack these characters, causing foot to use glyphs from fallback fonts instead. Often, these don't match the primary font's dimensions exactly, which is a problem in this case since they need to be pixel perfect to look good.

Foot currently uses font glyphs. If we are to render the glyphs ourselves, the following things need to be considered:

  • We should probably generate the glyphs on-demand
  • We should probably cache the glyphs once generated
  • Caching could be done in foot, but then all regular characters would go through two cache lookups: foot's box character cache, and fcft's glyph cache.
  • Or, we could add an API to fcft to insert a glyph into its cache.
  • There are a lot of glyphs to render...
Several other terminal emulators (not all) render box characters themselves, rather than using font glyphs. In a perfect world, all terminal fonts would have box characters glyphs, and we wouldn't have to do anything special at all. That however is not the case. Many fonts lack these characters, causing foot to use glyphs from fallback fonts instead. Often, these don't match the primary font's dimensions exactly, which is a problem in this case since they need to be pixel perfect to look good. Foot currently uses font glyphs. If we are to render the glyphs ourselves, the following things need to be considered: * We should probably generate the glyphs on-demand * We should probably cache the glyphs once generated * Caching could be done in foot, but then all regular characters would go through two cache lookups: foot's box character cache, and fcft's glyph cache. * Or, we could add an API to fcft to insert a glyph into its cache. * There are a lot of glyphs to render...
dnkl added the
enhancement
label 12 months ago

If I may voice an opinion, please consider the attached screenshot.
Foot on the left, VTE-based xfce4-terminal on the right, both configured to use Hack font 15 pt under void linux sway.

The vertical gaps in foot are most likely not going to go away even if there is an adjustable line-height, since some anti-aliasing will render the vertical line end as a blurred end, whilst the harfbuzz magic will only treat the horizontal glyphs as continuation glyphs.

If I may voice an opinion, please consider the attached screenshot. Foot on the left, VTE-based xfce4-terminal on the right, both configured to use Hack font 15 pt under void linux sway. The vertical gaps in foot are most likely not going to go away even if there is an adjustable line-height, since some anti-aliasing will render the vertical line end as a blurred end, whilst the harfbuzz magic will only treat the horizontal glyphs as continuation glyphs.
Poster
Owner

If I may voice an opinion

Of course you may :)

The title of this issue doesn't really reflect its status; I made up my mind some time ago that this is no longer a question of doing or not doing: we're doing it.

The antialiasing issue was brought up on IRC a while ago. I personally use bitmap fonts and hadn't noticed that one before.

Antialiasing and line hight issues aside, there is still the problem with fallback fonts; far too many fonts lack these glyphs (especially the new Unicode 13 sextant characters...), making rendering these glyphs unpredictable - some characters may be from the primary font, or fallback font A, while others are from fallback font B.

At this point, we just need to decide on how to glyph caching. After that, glyphs can be added iteratively.

> If I may voice an opinion Of course you may :) The title of this issue doesn't really reflect its status; I made up my mind some time ago that this is no longer a question of doing or not doing: we're doing it. The antialiasing issue was brought up on IRC a while ago. I personally use bitmap fonts and hadn't noticed that one before. Antialiasing and line hight issues aside, there is still the problem with fallback fonts; far too many fonts lack these glyphs (especially the new Unicode 13 sextant characters...), making rendering these glyphs unpredictable - some characters may be from the primary font, or fallback font A, while others are from fallback font B. At this point, we just need to decide on how to glyph caching. After that, glyphs can be added iteratively.
dnkl changed title from Box characters: use font glyphs or render glyph ourselves? to Render box characters ourselves (don't use font glyphs) 10 months ago
dnkl referenced this issue from a commit 10 months ago
dnkl closed this issue 10 months ago
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.