-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Add Braille support #837
base: master
Are you sure you want to change the base?
Add Braille support #837
Conversation
Great work creating this PR 👍 Source of the glyphs mentioned in commit: ✔️ As this is not in a PUA, I think maybe it should be |
Additional note If you edit the commit, maybe you could add to the commit message the |
Same font packaged here: https://aur.archlinux.org/packages/ttf-ubraille The font contains this copyright notice Same font is mentioned here https://fontforge.org/archive/sfds/index.html as 'GNU licensed' Note that GNU FreeFont uses a Braille set by Steve White link. |
For me this looks good to merge now; playing the ball to @ryanoasis |
It's a whole lot more involved than I initially thought. Split that up into individual commits that introduce the changes step by step. The changes are (mostly) only active when patching in the Braille font. Also noticed that one glyph in the source font is missing: Although it should have dot 6 (2nd colum, 3rd from top) and dot 7 (1st column, lowest row) active - as the tiny |
1df21b6
to
faf7503
Compare
Rebase on master, force push |
faf7503
to
c8bd64c
Compare
All the readmes need an update for the new parameter 🛑 |
Can this potentially fix the issue of gaps between the top and bottom of braille glyphs? Some terminals custom render them to make sure the gaps are filled, but can this issue be solved from the font level? I noticed the commit regarding padding, so I tried out the PR out of curiosity to see what differences does it make, but it seems that this patch just makes the gaps even bigger. (Tested on |
Ah, what you would like is a stretch-x-y glyph rescale (like the powerline glyphs). That would be nice in graphic scenarios like above, but look funny in normal (i.e. displaying actual braille text) ones, because the dots will get distorted. Hmm. I can try a bit with that image above, but ... ping me if it takes too long, I might have forgotten to do it :-} |
Cool, looking forward to it :) And the PR implementing this: wez/wezterm#919 |
Well, the 'cells' of some fonts are rectangular, more high than wide, like your cursor in the image above. |
Ah, they do not patch in a scaled source, they create the glyphs on the fly from circles drawn in the 'cell'. |
@musjj Could you copy & paste that image into a comment here, so that I could try it? I tried with this image, but that looks a bit fuzzy:
(I created that with https://image2ascii.com/) Here is the source image, with very smooth borders: |
Here you go:
|
c8bd64c
to
ec695c7
Compare
Rebase on master, actually rebase on the code added by #916 which has the same problems. |
Well, I do not know if this is really useful. The braille glyphs are designed to always have one row of dots empty, so that one can distinguish between 'letters'. Dots have the blue diameter. This is in direct contradiction to the image shown above, where there are no visible vertical gaps from the columns of not-existing points. Here you see the 'empty columns of dots' (arrows), and that they are missing in Wezterm: This just talks about the vertical gaps, not the horizontal (line to line) ones. Braille rendered with a font without char-to-char gaps will be unreadable. |
Lets assume we do not care if Braille is readable, because ... we are Nerds and Braille is not read from a screen but from a Braille line reader. To get the padding right... Horizontally we have This is not working if horizontal and vertical padding is the same; which is how it is currently with the patcher. And for that we would still scale the glyphs not preserving aspect ratio, thereby ending up with ellipsis. I guess the only good solution (for a graphical display) would be to generate the glyphs while patching the font with adapted gaps. This would also be possible but a totally different approach, rather like Wezterm. |
That seems like an interesting approach. Not really sure how fonts work, but thinking about it again, is it actually possible to get rid of the horizontal space between the lines? Aren't they rendered and controlled by the terminal instead of the fonts? |
@clort81 Interesting design. |
The future of this is unclear. This PR heads in the direction to re-assign the codepoints to 'some graphics glyphs', what is not exactly right in Unicode context. So probably this will be only a self-patch option or something. Moving this to parallel Universe to get it out of the mainstream development. |
If you're interested, Unicode accepted another block of octants for 2×4 pseudo-pixels. U+1CD00 to U+1CDE5 (it isn't the complete 256 semigraphic characters because some patterns already exist as quadrants or half-blocks). Updating apps using braille to use the new octants should be easy, it should even be possible to write a small conversion utility that can be piped to that switches existing Braille to the new Octants without touching existing utilities that use Braille. |
@PhMajerus Thanks for the update. That certainly looks interesting. |
@Finii I wanted to revive some old fonts by adding Nerd Fonts and, as it turns out, Braille. I have taken the relevant parts from this patch, updated them and applied them to I've successfully patched the fonts I wanted 🙂 Would you like me to submit an updated pull request here? |
@flexiondotorg Thanks for the work on this. I would rather keep this 'the' PR about Braille, instead of having two PRs with diverging discussions. I will pull your commit in a minute. Also wanted to mention, after skimming the comments above, that this PR's problems are not technical (anymore, as the needed algorithm changes are already merged) but conceptual. Just some issues
When simply patching like you proposed, depending on target font we will get extraordinary width vertical gaps in graph renderings, i.e. when the font's cell is more square than oblong-tall, see for example Arimo: And another example LiterationMono, comparison how the box drawing glyphs work that introduce a bit of overlap. SummaryI guess this works for some fonts but not in general, depending on cell aspect ratio. Possibly easier would be to autogenerate the glyphs with the right proportions instead of scaling an existing font (for the Braille glyphs), as then we can have dots but avoid big gaps and non-circular dots independent of cell aspect ratio. |
Thanks for the summary @Finii 👍 It looks like I got lucky, as the font I most wanted patching (Fixedsys Excelsior) seems to have the ideal aspect ratio for Braille glyphs, and Fixedsys Core is pretty close. The following are from Blackbox, which doesn't have built-in glyphs and uses vte-gtk4 0.76.3. Fixedsys ExcelsiorFixedsys Core |
There is an alternative Braille font I found that I have not tested yet. Is CC0 licensed acceptable? |
Sure. But I just exchanged the Also removed the mentioning of "GPL" because |
Original statement (in Russian, autotranslated) of UBraille creator Vyacheslav
Source: https://fontforge.org/archive/sfds/UBraille.tar.bz2 So is it GPL? Probably not strictly. GPL would impose some restrictions on us. 🤔 But to be safe, the CC0 font is certainly the better choice if we do not self-autogen the glyphs later on. |
[why] To be on the safe side we use a font with a well defined license that puts no restrictions upon us and our users from GGbotnet. Suggested-by: Martin Wimpress <@flexiondotorg> Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Waaaah 😭 UBraille is even more broken?!? Comparsion of UBraille and BrailleCC0: Braille 3478
https://en.wikipedia.org/wiki/Braille_pattern_dots-34#Plus_dots_7_and_8 Good that we dropped UBraille! Edit: For explanation, the simple 6 dots are positioned like this:
and the extended 8 dot sets add the other dots below
|
I think Braille should not be the same as the 2×4 pseudo-pixels / octants that will be standardized in Unicode 16.0. With Unicode 16, we'll have separated quadrants (2×2), which are mosaics like the standard quadrants, but in a grid with gaps between pseudo-pixels, as well as both sextants (2×3) and separated sextants, following the same gap concept. You can probably see where I'm going here… to me, Braille could be the separated octants, using the same design as separated quadrants and sextants (grid-compatible with them). Here are some examples of that idea with Cascadia:Braille with the Separated Octants style: Note how they follow the styles of Sextants vs Separated Sextants below. |
I am inclined to implement it in this way, as also pointed out by musjj's and flexiondotorg's images. I know I will regret that if we get numerous But in principle I guess for a Nerd Font it makes most sense to have the glyphs serve as 'generic graphic elements' (i.e. separated octants). Ah, and further I do not see the Unicode 16 graphics building blocks added here soonish. Edit: Somehow one sentence was a mix of two sentences |
Genuine legally blind person here who has learned and used actual printed Braille on cardstock pages (and a few sheets of magazine stuffed into Braillewriter or slate in a pinch when cardstock wasn't handy!) We actually use Braille for dot graphics and character cell patterns ourselves. Braille dots are a context-dependent code system, not a language nor even necessarily an alphabet. Yeah, to read text encoded in Braille, the character spacing is important. It's even important that cell spacing be such that ⣿⣿ be clearly two cells consisting of dots 12345678 and NOT three cells consisting of 4568, 12345678, and 1237. Meaning that the space between cells on a line needs to be less than a "missing" column of dots would be, and the space between lines should be slightly more than a missing row (which helps for tracking lines…) That said, I've actually got some limited vision and I ended up looking at this discussion because I was looking for a font with dots that didn't have those spaces because I wanted them for graphics purposes. I'd say that's a valid use of the symbols, if folks want to use them that way because, like I said, we do ourselves. If you're going to include Braille glyphs, though, I suggest using OTF features to provide two variants—one with "proper" spacing for reading Braille, and one with uniform dot spacing for graphics. Optionally generate two fonts since some things maybe won't let you specify a preference for the alt glyphs? |
Description
Adds braille support to render pixelart (e.g. in terminal applications) requested in #482.
Thanks @Chaz6 for the implementation idea!
Requirements / Checklist
What does this Pull Request (PR) do?
Adds UBraille.ttf to glyph sources and updates font-patcher so that it copies symbols from 0x2800 to 0x28FF.
How should this be manually tested?
Check that fonts are created correctly.
Any background context you can provide?
What are the relevant tickets (if any)?
Closes #482.
Screenshots (if appropriate or helpful)
Screenshot by dominikheinz from the related issue.