-
-
Notifications
You must be signed in to change notification settings - Fork 817
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
Support Unicode 16 octant characters #6502
base: main
Are you sure you want to change the base?
Conversation
Hello o/ Your PR is currently adding more than a thousand lines to draw a few squares, I feel like there's room for improvement and this can be much reduced 🤔 For example when I worked on adding Braille characters (which are also in a 2x4 grid), I managed to implement the drawing part in ~60 lines: wezterm/wezterm-gui/src/customglyph.rs Lines 5005 to 5064 in 6f375e2
The idea for braille chars was that I noticed that the sequencing of chars was mostly following a binary counting logic, which I then translated into drawing the correct dots. I didn't analyzed how the sequencing of blocks is done, but there's probably a way to reduce it in a similar logic once you find a logic in the sequence 🤔 |
Unfortunately there is no logic in the sequence. The existing half and quad characters are reused, and some other characters are taken from other ranges. Only the remaining ones are encoded in a sequence. It's not a nice as the Braille characters. The mapping from octants (represented as binary) to code points starts with [0020, 1CEA8, 1CEAB, 1FB82, 1CD00, 2598, 1CD01, 1CD02, ...] I can change the code to match on ranges of code points, and within that range look up a binary value in an array, and then map the binary bits to octants. It would still be longer than the Braille code. |
Alternatively I could add a new field to |
I have replaced the match statements by array lookups. The code has become smaller, but as I mentioned above, there is no pattern (unlike for the Braille characters). I've taken the liberty to apply the same change to the sextant blocks as well. |
// ├───┼───┤ | ||
// │ 4 │ 5 │ | ||
// ╰───┴───╯ | ||
const SEXTANT_PATTERNS: [u8; 60] = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello! Thanks for making the changes, this sextant sequences looks almost perfectly like a continuous sequence, only skipping 0b101010
.
In my opinion I'd just impl this as a perfect sequence, implementing even the one that is not defined in spec 🤔
I'm not the one who's going to review this in the end, that's @wez' thing, I'm just a 'pre-processor' here.
nice job anyway 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This array is the mapping from code points to sextant patterns. It's fixed by the standard – I couldn't just add the four missing ones.
The code that takes the bit pattern and draws the sextants is generic. It works for all 64 possible patterns although only 60 of them will ever be encountered.
Closes #6494.