Skip to content

Add Braille support (with generator)#1980

Merged
Finii merged 13 commits intoryanoasis:masterfrom
GoldPigg:braille-support
Feb 7, 2026
Merged

Add Braille support (with generator)#1980
Finii merged 13 commits intoryanoasis:masterfrom
GoldPigg:braille-support

Conversation

@Finii
Copy link
Collaborator

@Finii Finii commented Jan 22, 2026

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

  • Read the Contributing Guidelines
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan.
    Issue number where discussion took place: #xxx
  • If this contains a font/glyph add its origin as background info below (e.g. URL)
  • Verified the license of any newly added font, glyph, or glyph set. License is: 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)

@Finii Finii changed the title Braille support Add Braille support (with generator) Jan 22, 2026
@GoldPigg
Copy link
Contributor

I'm glad I could help you.

[NOTE]

I seem to have forgotten to update the version of font-patcher. You might need to update it.

@GoldPigg
Copy link
Contributor

You create the classic round 'dots', what do you think about the octants style proposed above?

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 draw function.

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?🤔

@Finii
Copy link
Collaborator Author

Finii commented Jan 22, 2026

@Finii
Copy link
Collaborator Author

Finii commented Jan 22, 2026

what do you think about

What do you think?🤔

:-D

I'm not sure I understand this:

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.

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.
Maybe you want to try rectangular dots with your "image"?

And I suspect most users feel the same way.

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).

command-line arguments for customization

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

Copy link
Collaborator Author

@Finii Finii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again: Nice work

This is not a full review, just listing the things that crossed my mind when reading your code.

@GoldPigg
Copy link
Contributor

I'm not sure I understand this

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.

circular:
circular

rectangles:
rectangles

Now my opinion seems to have changed—rectangles do appear to work better (may more rich and full).

@GoldPigg
Copy link
Contributor

GoldPigg commented Jan 24, 2026

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:

  • rectangle
    rectangle

  • gapless:
    gapless

Below are the various fonts generated. You may use them for local testing.

BrailleFonts.zip

I hope this helps you.

And if you need, I can also upload the code to branchs in my repository for your reference.

@Finii
Copy link
Collaborator Author

Finii commented Jan 26, 2026

And if you need, I can also upload the code to branchs in my repository for your reference.

That would be nice!

@GoldPigg
Copy link
Contributor

GoldPigg commented Jan 26, 2026

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.

@Finii
Copy link
Collaborator Author

Finii commented Jan 26, 2026 via email

@Finii
Copy link
Collaborator Author

Finii commented Jan 27, 2026

Here a commit that can be added via git am ...
This is after a git rebase origin/master.
And later pushed via git push --force-with-lease.

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

@GoldPigg
Copy link
Contributor

there's a tick mark on the PR page I believe, on the right hand sidebar

The option doesn't seem to be available on the right side. I suspect this might be because you initiated this PR, so I added you to the Collaborators list. This may solve the poblem.
screenshot

[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.
@Finii
Copy link
Collaborator Author

Finii commented Jan 28, 2026

Removed the first two commits (that were from the other PR / first try) unrelated to this PR.

That needed of course a force push, make sure to - for example - git fetch && git reset --hard origin/master.

image

@Finii
Copy link
Collaborator Author

Finii commented Jan 28, 2026

I broke it 😬 ... fixing

image

GoldPigg and others added 4 commits January 28, 2026 16:25
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>
@Finii
Copy link
Collaborator Author

Finii commented Jan 28, 2026

Sorry for the frequent force-pushes, I was not concentrated enough :-(
Should not work on this while at-work 😬 but wanted to show some progress.
Will only add and not force-push from now on 👼

Thanks again!

Copy link
Collaborator Author

@Finii Finii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fast review, still not in depth ;)

Finii added 2 commits January 29, 2026 06:56
[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>
Finii added 2 commits January 29, 2026 07:26
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 Finii marked this pull request as ready for review January 29, 2026 06:39
Copy link
Collaborator Author

@Finii Finii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Finii Finii mentioned this pull request Jan 29, 2026
2 tasks
@GoldPigg
Copy link
Contributor

GoldPigg commented Jan 29, 2026

please tell me if you like all my changes or if we need to tweak something more

I think everything is nice now.🎉


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 this is a good idea. In fact, that's exactly what I had in mind from the start, but just as you said:

On the other hand, all glyph sets options so fare are booleans. That would be the first which needs a parameter.

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 = True

This line is set when --complete is enabled. When modifying it, we cannot directly assign a value. We must first check whether --braille has been set. If not, then assign the value. Otherwise, --braille will become inactive when --complete is used.

However, if we continue to store style using args.brailleStyle but assign it via --braille, this issue seems unlikely to occur, and it may require minimal code changes.

@GoldPigg
Copy link
Contributor

I attempted the second approach. Below is the commit (on the merge-two-args branch):

Merge --braille-style into --braille

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.

@Finii
Copy link
Collaborator Author

Finii commented Feb 2, 2026

Ah, thank you!

Braille suffix. It seems to have been accidentally deleted

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

    sym_font_group.add_argument('--braille',
    sym_font_group.add_argument('--complete',
    sym_font_group.add_argument('--codicons',
    sym_font_group.add_argument('--fontawesome',
    sym_font_group.add_argument('--fontawesomeext',
    sym_font_group.add_argument('--fontlogos',
    sym_font_group.add_argument('--material',
    sym_font_group.add_argument('--octicons',
    sym_font_group.add_argument('--pomicons',
    sym_font_group.add_argument('--powerline',
    sym_font_group.add_argument('--powerlineextra',
    sym_font_group.add_argument('--powersymbols',  
    sym_font_group.add_argument('--weather',
        if not self.args.complete:
            # NOTE not all symbol fonts have appended their suffix here
            if self.args.braille:    
            if self.args.codicons:
            if self.args.fontawesome:
            if self.args.fontawesomeextension:
            if self.args.fontlogos:
            if self.args.material:
            if self.args.octicons: 
            if self.args.pomicons:
            if self.args.powersymbols:
            if self.args.weather:

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 --complete fonts to be special purpose and 'unsupported' ;-)

So whatever you like, we can have the suffix.

Merge --braille-style into --braille

Here I have two comments.

First I would just get rid of brailleStyle and just put the style falvor into the braille argument, which is also un-surprising as the option will be stored there, and only by your code move to another variable later. I added a commit with a proposition of mine, please have a look.

Two, you use the nargs='?' to allow a stand alone --braille for the default and --braille circle for specifics.
I dread that ambiguity a bit, the parser is also not very smart. Take for example

$ 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.ttf

Hmm, 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:

Details
Nerd Fonts Patcher v3.4.0-86 (4.22.0) (ff 20230101)
usage: font-patcher [--careful] [--debug [{0,1,2,3}]] [--extension EXTENSION] [--help] [--makegroups [{-1,0,1,2,3,4,5,6}]] [--mono] [--outputdir OUTPUTDIR]
                    [--quiet] [--single-width-glyphs] [--variable-width-glyphs] [--version] [--braille [{rectangle,circle,gapless}]] [--complete]
                    [--codicons] [--fontawesome] [--fontawesomeext] [--fontlogos] [--material] [--octicons] [--pomicons] [--powerline] [--powerlineextra]
                    [--powersymbols] [--weather] [--adjust-line-height] [--boxdrawing] [--cell CELLOPT] [--configfile CONFIGFILE] [--custom CUSTOM] [--dry]
                    [--glyphdir GLYPHDIR] [--has-no-italic] [--metrics {HHEA,TYPO,WIN}] [--name FORCE_NAME] [--postprocess POSTPROCESS] [--removeligs]
                    [--xavgcharwidth [XAVGWIDTH]] [--progressbars | --no-progressbars]
                    font

I know, it is already there for --debug and --makegroups (and --xavg_whatever), but that means the position of the option is important now, which for me is unexpected, and I would rather remove the default values. I believe I first introduced it for --makegroups to keep compatible with previous versions (that had no number argument), and then modeled --debug and --xavg in the same way, unaware of the possible problems. But then we had issues of people ordering the options in arbitrary ways, and ... I believe it is a bad idea. It just does not work well together with a positional argument (i.e. the font name). Or maybe there is a way to make the parser more smart; I didn't find any solution.

(With --xavg there is no way around this nargs='?', at least not trivially; but that option is a very special expert option anyhow)

So I would probably drop --braille (with default). Hmmm.

Edit: I mean "drop --braille" but "keep --braille circle, --braille rectangle", making patching without -c but with Braille more complicated 🤔

What do you think :-D

Edit: Well, add some details and examples

GoldPigg and others added 4 commits February 2, 2026 11:02
[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>
@GoldPigg
Copy link
Contributor

GoldPigg commented Feb 2, 2026

First I would just get rid of brailleStyle and just put the style falvor into the braille argument

Ok, I think this is no problem.

So I would probably drop --braille (with default).

I think this is a right choice.
After all, it doesn't seem like many people need to use --braille only, so making it a bit more complex (without a default) is acceptable.

@Finii
Copy link
Collaborator Author

Finii commented Feb 5, 2026

Hmm, we have

  • --braille
  • --xavgcharwidth
  • --debug
  • --makegroups

which have on optional argument. Maybe just keep --braille with it, as you programmed it 🤔

I guess this can be merged now from my side. Anything you want to add/change before?

@GoldPigg
Copy link
Contributor

GoldPigg commented Feb 5, 2026

which have on optional argument. Maybe just keep --braille with it, as you programmed it 🤔

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 guess this can be merged now from my side. Anything you want to add/change before?

I don't think anything needs to be added or changed now. This can be merged now from my side, too.

@panda667
Copy link

panda667 commented Feb 6, 2026

This looks awesome. I've read both chains and everything looks great!

@Finii
Copy link
Collaborator Author

Finii commented Feb 7, 2026

Thanks a lot @GoldPigg for the work, the discussions, and the patience.

Very nice feature, indeed!

Edit: Typo

@Finii Finii merged commit 20612ba into ryanoasis:master Feb 7, 2026
5 checks passed
@Finii
Copy link
Collaborator Author

Finii commented Feb 7, 2026

@allcontributors please add @GoldPigg for code

@allcontributors
Copy link
Contributor

@Finii

@GoldPigg already contributed before to code

@Finii
Copy link
Collaborator Author

Finii commented Feb 7, 2026

Added 3 commits with the forgotten things, as always ;-)

d7c5c11 doc: Update font-patcher params
1fe4fc2 font-patcher: Do not automatically add Braille in some cases
a66c673 font-patcher: Always force all Braille glyphs in

🤷‍♀️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for Braille Characters?

3 participants