Add Braille support (with generator)#1980
Conversation
|
I'm glad I could help you. [NOTE]I seem to have forgotten to update the version of |
I'm not entirely sure about this, because the reason I'm doing this work is that I myself am a victim of non-equidistant Braille fonts. Therefore, classic round ‘dots’ represent my original requirement. And I suspect most users feel the same way. Perhaps we could introduce command-line arguments for customization, or allow both styles to coexist. However, if adding octants style is desired, I don't think it would be difficult. Based on the existing code, we could reuse most of it—basically just adjust the If you feel it's truly necessary, I could give it a try. But I might not have much free time recently, so it might not get done quickly. What do you think?🤔 |
:-D I'm not sure I understand this:
If the 'dots' are circular or rectangles does not change the equidistance? Of course they can not / should not be square. And yes, your code design is nice where the circles can easily be exchanged for rectangles. In the other thread "the people" seemed to like octants more, so I wanted to know your preference / reasoning.
I had the impression most would prefer rectangular 'dots'. Equidistant of course. Or even gapless (but I know from experience that gapless is always hard to achieve over different clients that render the glyphs differently).
The problem is that only ONE style could be the default; and most of the time people use the prepatched fonts (which use the defaults of course). Edit: Add last parenthesised sentence to better explain what I mean |
Finii
left a comment
There was a problem hiding this comment.
Again: Nice work
This is not a full review, just listing the things that crossed my mind when reading your code.
I'm sorry for my confusing expression. I've now re-evaluated the two options. Although I've generated rectangles as squares, it doesn't significantly impact the outcome. We can make a simple adjustment later. Now my opinion seems to have changed—rectangles do appear to work better (may more rich and full). |
|
I fixed the Rectangle font .it's no longer square ,although it doesn't seem particularly noticeable in this font. And I generated a nearly gapless font. Here's the result: Below are the various fonts generated. You may use them for local testing. I hope this helps you. And if you need, I can also upload the code to branchs in my repository for your reference. |
e38b1b3 to
fd3e776
Compare
That would be nice! |
Ok, it's now on support-braille-style I set rectangle as the default because I conducted a quick survey among my friends, and the results showed that 10 people chose rectangle, 7 chose gapless, and 3 chose circle. |
|
Great!
Gapless is always a problem depending on the client the user uses. To circumvent them we usually overlap the cell with its neighbor by some percent; and still we get colored lines sometimes. Search for colored vertical lines if interested. So that would be a specialty anyhow.
I tried to clean up the PR (remove the two first-attempt commits not-by-you, and rebase on current `master`. But it seems I can't force push to your branch (you removed the maintainers may modify PR checkmark, I assume).
Additionally I wanted to add a commit that adds the braille/ file to the two font-patcher releases and increase the font-patcher script version.
There might come up other small things that I would "just fix" normally. If you are comfortable with me messing inside your repo/PR branch maybe you can allow that (there's a tick mark on the PR page I believe, on the right hand sidebar).
Thank you so much for the contribution!
|
|
Here a commit that can be added via From 5584bdece502c84dcd4be4220e846882afcc111f Mon Sep 17 00:00:00 2001
From: Fini Jastrow <ulf.fini.jastrow@desy.de>
Date: Mon, 26 Jan 2026 15:24:56 +0100
Subject: [PATCH] Include Braille generator in release variants
Releases of the font-patcher script:
* Docker release
* Zip release
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
---
.dockerignore | 1 +
.github/workflows/docker-release.yml | 1 +
bin/scripts/archive-font-patcher.sh | 3 ++-
font-patcher | 2 +-
4 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/.dockerignore b/.dockerignore
index 0283a0b24..37f3c20e8 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -4,5 +4,6 @@
!font-patcher
!glyphnames.json
!bin/scripts/name_parser/Fontname*.py
+!bin/scripts/braille/Braille.py
!bin/scripts/docker-entrypoint.sh
!.codeclimate.yml
diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml
index 9d6765db9..46ef5889c 100644
--- a/.github/workflows/docker-release.yml
+++ b/.github/workflows/docker-release.yml
@@ -8,6 +8,7 @@ on:
# Keep this in line with .dockerignore
- bin/scripts/docker-entrypoint.sh
- bin/scripts/name_parser/Fontname*.py
+ - bin/scripts/braille/Braille.py
- src/glyphs/**
- .dockerignore
- Dockerfile
diff --git a/bin/scripts/archive-font-patcher.sh b/bin/scripts/archive-font-patcher.sh
index e650c4986..5d224687d 100755
--- a/bin/scripts/archive-font-patcher.sh
+++ b/bin/scripts/archive-font-patcher.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Nerd Fonts Version: 3.4.0
-# Script Version: 1.1.0
+# Script Version: 1.2.0
# Archives the font patcher script and the required source files
# If some (any) argument is given this is though of as intermediate version
# used for debugging
@@ -28,6 +28,7 @@ find "${outputdir:?}" -name "FontPatcher.zip" -type f -delete
cd -- "$scripts_root_dir/../../" || exit 1
find "src/glyphs" | zip -9 "$outputdir/FontPatcher" -@
+find "bin/scripts/braille" -name "Braille.py" | zip -9 "$outputdir/FontPatcher" -@
find "bin/scripts/name_parser" -name "Fontname*.py" | zip -9 "$outputdir/FontPatcher" -@
find "glyphnames.json" | zip -9 "$outputdir/FontPatcher" -@
find "font-patcher" | zip -9 "$outputdir/FontPatcher" -@
diff --git a/font-patcher b/font-patcher
index 8fb3550a9..a37d03692 100755
--- a/font-patcher
+++ b/font-patcher
@@ -6,7 +6,7 @@
from __future__ import absolute_import, print_function, unicode_literals
# Change the script version when you edit this script:
-script_version = "4.21.0"
+script_version = "4.22.0"
version = "3.4.0"
projectName = "Nerd Fonts"
--
2.48.1
|
fd3e776 to
637eed8
Compare
[why] Sometimes we need to perform complex dynamic adjustments/generation based on the sourceFont, such as when handling braille (more details in PR#837). [how] Add a new "font" parameter to `patch_set` for passing hook function that generates font.
637eed8 to
406a696
Compare
406a696 to
54eea6d
Compare
Dynamically generate the required Braille fonts directly at runtime to avoid complex scaling.
- Set ascent/descent_add for typo and hhea - Set glyphName - Remove download link for UBraille
Set a arg to switch. Optional: rectangle(default), circle, gapless
Releases of the font-patcher script: * Docker release * Zip release Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
54eea6d to
ba46f71
Compare
|
Sorry for the frequent force-pushes, I was not concentrated enough :-( Thanks again! |
Finii
left a comment
There was a problem hiding this comment.
Fast review, still not in depth ;)
[why] When the Braille module is missing (e.g. a person downloaded just the font-patcher script and not the release zip - this is still out there in the wild) the script fails only after patching already started with some sets. Would be better to fail fast, i.e. when starting. [how] Check the existince of the module on startup and then check for the module when the options are processed. 1. Abort when Braille has been explicitely requested 2. Warn if Braille comes in through --complete Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why] We already create the 'perfect' glyphs for Braille matching the to-be-patched font, so there is no need to scale (which is already disabled) or shift the glyphs. The examination of all Braille glyphs takes time that is not needed. [how] Drop all scaling and shifting of the generated Braille glyphs. Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Just comments and whitespace... and the name of the glyphs to 'uniXXXX'. Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why] It will not be used by many. Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Finii
left a comment
There was a problem hiding this comment.
I did not find any other items to discuss.
This looks excellent! Thank you so much!
From my side we could pull this now; please tell me if you like all my changes or if we need to tweak something more.
Ah the only thing is if we want
font-patcher --braille --braile-style circle xxx.ttf
font-patcher --braille circle xxx.ttf
I'm not certain. The more options there are, the more complicated it looks, better maybe to have one a bit more complicated option instead of two, where one is just also complicated?
On the other hand, all glyph sets options so fare are booleans. That would be the first which needs a parameter.
But then, people usually use --complete anyhow.
I think all in all I would drop --braille-style and merge into --braille but I did not want to do that without first consulting with you, as that is a "bigger" change of your ideas.
I think everything is nice now.🎉
I think this is a good idea. In fact, that's exactly what I had in mind from the start, but just as you said:
Therefore, I did't do it, as I'm afraid it might cause some unexpected issues since I'm not familiar enough with the complete code. However, I believe you can be able to handle it well.👍 And Here's one potential point I thought of that might require attention(may this could help you): args.braille = TrueThis line is set when However, if we continue to store style using |
|
I attempted the second approach. Below is the commit (on the Merge I added the Braille suffix. It seems to have been accidentally deleted while organizing the commit history. Below is the commit: font-patcher: Add Braille Suffix They are on the same branch. You can merge them directly or make modifications before merging. |
|
Ah, thank you!
In fact I dropped it willingly, as I doubt the usefullness of the suffix. Further up the commnet says: if not self.args.complete:
# NOTE not all symbol fonts have appended their suffix here
if self.args.fontawesome:
additionalFontNameSuffix += " A"
verboseAdditionalFontNameSuffix += " Plus Font Awesome"Lets see if the comment is correct Ah, the Powerline and PowerlineExtension have no suffix. I do not really care, the resulting name will be too long anyhow and most circumstances. I consider the not So whatever you like, we can have the suffix.
Here I have two comments. First I would just get rid of Two, you use the $ fontforge font-patcher --braille Arimo-Regular.ttf
font-patcher: error: argument --braille: invalid choice: 'Arimo-Regular.ttf' (choose from rectangle, circle, gapless)
works:
$ fontforge font-patcher Arimo-Regular.ttf --braille
$ fontforge font-patcher --braille --weather Arimo-Regular.ttfHmm, not very intuitive. In fact usually you NEED to add a specific option anyhow (or reorder to have the font name in the beginning, but I guess a lot of people go the ordinary way: first options, than filename). Also congruent with how the usage is reported... first options, last is fontfile: DetailsI know, it is already there for (With So I would probably drop Edit: I mean "drop What do you think :-D Edit: Well, add some details and examples |
[why] The more options there are, the more complicated it looks, better to have one a bit more complicated option instead of two. [how] When `--braille` is set, assign its style value to `args.brailleStyle` and set `args.braille` to True to keep the convention for boolean values.
Also add 'missing' type specifier. Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why] The code uses two variables, one holds the style (as string) and the other holds True or False depending on 'has the first variable a valid string'. [how] Just store the string in a variable, and if there is no string (i.e. the variable is None) the option is obviously turned off. Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Ok, I think this is no problem.
I think this is a right choice. |
|
Hmm, we have
which have on optional argument. Maybe just keep I guess this can be merged now from my side. Anything you want to add/change before? |
Hmm, perhaps when faced with complexity and potential mistakes, I'd choose complexity. So I think things are just fine as they are now.
I don't think anything needs to be added or changed now. This can be merged now from my side, too. |
|
This looks awesome. I've read both chains and everything looks great! |
|
Thanks a lot @GoldPigg for the work, the discussions, and the patience. Very nice feature, indeed! Edit: Typo |
|
@allcontributors please add @GoldPigg for code |






Description
Add Braille Glyphs that are generated on the fly to exactly match the 'cell' size of the patched font.
Just scaling is not really possible for circular dots. When they are expected to be circular in the patched font.
Created this PR in @GoldPigg's stead.
I believe it is easier to discuss details in this/a separate PR.
Thanks for preparing the code extension!
Requirements / Checklist
Issue number where discussion took place: #xxx
What does this Pull Request (PR) do?
How should this be manually tested?
Any background context you can provide?
See discussion in 'parent' PR
What are the relevant tickets (if any)?
Closes #482
Screenshots (if appropriate or helpful)