-
Notifications
You must be signed in to change notification settings - Fork 64
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
Unicode 16.0 support #201
Comments
Well - Chafa is kind of two-pronged. On one hand (and by default) it does straight MSE minimization to code points that look similar across terminals and fonts. On the other, it also supports alternative symbol sets and escape sequences for more traditional/artistic flavors, e.g. ASCII, some CJK, and custom fonts. I'd like to push further in both directions. There's a lot of interesting research on structural character art rendering - see #150 for examples and ideas. Some of those could benefit from a greater selection of "imperfect" connective glyphs.
Brilliant - definitely adding support for these! |
Yes - I kept the door open to this in the API, so when implemented, you will be able to add multicolor glyphs while remaining backwards compatible. See |
@PhMajerus I've tried doing that before. The main problem is different emoji fonts use slightly different colors for the emoji. So it's almost impossible to get a consistent shade. Also Emoji hearts get the terminal really confused because the red one is traditionally half width while the rest are traditionally full width. Though this isn't a problem with modern font rendering. Though I guess the same problem exists with the 8 and 16 bit colors as shown here https://en.wikipedia.org/wiki/ANSI_escape_code#3-bit_and_4-bit. Still at least the colors are way closer in ANSI then they are with emoji. |
Of course images using colored hearts will not be exact, but a red stays a red and a yellow stays a yellow. It still provides some color information: Of course, that is at the expense of resolution, as we can show 4×4 pseudo-pixels for each colored heart if we use octants:
I don't know of a 16-bit color ANSI, AFAIK there are the 16 base colors (4-bit), 256 colors (8-bit), and RGB (24-bit). |
Even worse - many TEs have configurable presets for these. A common one on Linux is Tango (GNOME default): And here's Solarized (dark): |
At least 16 color ANSI has an ad-hoc standard that has the 16 colors specified. Most people who do chafa style stuff won't have their terminal set to a funky color scheme. Meanwhile with emoji a quick glance at emojipedia will tell you how unspecified emoji actually are. Especially green, blue and purple. This issue is somewhat solvable by either targeting a specific font, having the font selectable and having a table of all different colors or create an emoji font with well specified colors specifically for those purposes. But this feels beyond the scope of chafa. The way I solved it was to first clamp all the colors to 3 level rgb and then use a lookup table to approximate the right color. This is far from an ideal or even good solution. |
I think the point is that color matching for 16-color ANSI and emojis (if/when implemented) are both approximate. Yes - emoji (and other colored glyph) output would target a specific font, cf. I hope everyone is having a great day :-) |
I want to share @mafik 's ansi-art as it uses the font to generate "24-bit, Unicode-capable" for terminal output. See this reddit post: https://www.reddit.com/r/unixporn/comments/wgpxu3/oc_ive_been_working_on_extending_ansiart_with/ and mafik's website where he has an interactive version hosted: https://mrogalski.eu/ansi-art/ It is the highest quality terminal art I've seen (excluding sixels) |
That's pretty sweet! At a glance, we use the same algorithm at That said, I had a branch at one point where I experimented with 16x16 bitmaps, but didn't see enough of an improvement to justify the added complexity of multiple glyph resolutions -- and variable glyph resolution is a big performance hit, since iteration counts wouldn't be known at compile time anymore, and you couldn't fit the bitmaps into an exact multiple of CPU registers. Maybe I'm wrong about the quality gap; I'd love to look at side-by-side comparisons using |
I added support for octants in c23d8bc . Haven't decided what to do about the rest yet. Edit: Actually, I did decide to include the sedecimants and eights. Just gotta do it. |
I went over the remaining block symbols just now and added those we were missing. Had to skip some of the sedecimants, because VTE (and thus likely other common TEs) is confused as to their halfwidth/fullwidth status. See 2af2e04 and 5290444. I'll address multicolor glyphs in a separate issue. Thanks again! |
We need to add support for new Unicode 16.0 legacy symbols, chiefly:
Large type builtins will probably require manual definitions, but those for octants can be generated at runtime. We need new tags
CHAFA_SYMBOL_TAG_OCTANT
/octant
andCHAFA_SYMBOL_TAG_LARGETYPE
/largetype
.We may want to extend the coverage of the
legacy
tag, but it may be wise to hold off on this until terminal/font support is more widespread.It'd also be a good idea to test our total coverage with Cascadia Code and look for any obvious gaps.
The text was updated successfully, but these errors were encountered: