Pragmata Pro liga shows unexpected symbols
🗹 Requirements
- [X] I have searched the issues for my issue and found nothing related and/or helpful
- [X] I have searched the FAQ for help
- [X] I have searched the Wiki for help
🎯 Subject of the issue
Experienced behavior:
I am running this:
./font-patcher \
~/.local/share/fonts/PragmataPro0.829/PragmataProR_liga_0829.ttf \
--outputdir ~/.local/share/fonts \
--careful \
--progressbars \
--variable-width-glyphs \
--adjust-line-height \
--complete
to patch my font.
This is what I get when running neovim:
Expected behavior:
This is what I have currently, on an older patched version of the fonts. Sadly, I cannot remember the exact command I used.
Example symbols:
🔧 Your Setup
-
Which font are you using (e.g.
Anonymice Powerline Nerd Font Complete.ttf)?-
PragmataPro0.829/PragmataProR_liga_0829.ttf
-
-
Where did you get the file from (download link, self patched, source downloaded from link...)
- Sadly, it is a paid for font so I cannot provide a link… :cry:
-
Which terminal emulator are you using (e.g.
iterm2,urxvt,gnome,konsole)?- Alacritty and neovim-qt.
-
Are you using OS X, Linux or Windows? And which specific version or distribution?
- Fedora 38.
Using font patcher from the latest master branch and v3.0.1 makes no difference.
★ Screenshots (Optional)
See Above.
The 'old' font has been patched with
./font-patcher \
~/.local/share/fonts/PragmataPro0.829/PragmataProR_liga_0829.ttf \
--outputdir ~/.local/share/fonts \
--careful \
--progressbars \
- --variable-width-glyphs \
+ --mono \
--adjust-line-height \
--complete
from the look of it.
This is the font with running the above. In neovim-qt, I get:
- Some weird
||-in the buffer line. - The chevron on the command line is cut.
These do not show in the old font. So, I tried via alacritty and got this:
Of course, I did not expect it to have ligatures in alacrity. So, I tried with wezterm:
I am confused…
Can you share the output of font-patcher after you added --debug 2 to the options?
This will tell us some properties of the to-be-patched font.
In all the images I see icons that are wider than "one cell". This is not possible for fonts generated with --mono.
Most probably they come from some other font via font fallback. Compare with your old font image, there only the yellow python is bigger than one cell.
In general, if the icon is cut it is too wide for one cell and the terminal does not know how to handle it. Or rather, someone decided to cut glyphs off that are too wide. For Widows (what you do not use) that even depends on font rendering engine selected.
Then I see some icons replaced by asian glyphs (Chinese, ... ?). These are most likely symbols at codepoints that have been dropped with Nerd Fonts v3.0.0. See the
The same seems to be the case with the strange ||- glyph. It seems to replace the x which I guess is also a Material Design Icon at the obsolete codepoint. Which is replaced by some glyph of another font.
I would suggest to have a look into the main tread for this: 1190
Also helpful maybe:
- Copy and paste (as text) a strange icon into a unicode to codepoint converter [1]
- search which font provides the glyph for that codepoint
$ fc-list :charset=xxxxwithxxxxbeing the 4 digit hexadecimal codepoint you found
Where is this "Cmdline" and stuff coming from? Maybe they have already updated their settings for v3 or maybe you need to raise an Issue there. If that is the problem, which it looks like, at least in part. Or use the excellent nerdfix.
[1] e.g. https://onlinetools.com/unicode/convert-unicode-to-code-points (set radix to hexadecimal)
Apologies, had to rush off yesterdayâ¦
Can you share the output of font-patcher after you added --debug 2 to the options? This will tell us some properties of the to-be-patched font.
Here it is: font-patcher.log
î©¶glyphâ¦
Yes, that is correct, it should be the X glyph. This comes from bufferline which gets fixed using:
buffer_close_icon = 'î',
Copy and paste (as text) a strange icon into a unicode to codepoint converter [1] search which font provides the glyph for that codepoint $ fc-list :charset=xxxx with xxxx being the 4 digit hexadecimal codepoint you found
 gives me 2020ea76⦠Which fc-list says Unable to parse the pattern. :sob: I have the feeling I am doing something wrong there⦠:thinking:
Where is this "Cmdline" and stuff coming from?
This from noice which gets fixed using:
cmdline = { icon = ">" },
In short, problem solved for me by hacking stuff⦠Not ideal, but at least we have an issue we can point people to.
Would it if I wrote a tiny Markdown doc/wiki entry to summarize the debugging steps? Would that be useful for newcomers?
@Finii Last, but definitely not least, thank you so much for all your help over the years. Seriously, you have been nothing but helpful and professional in all your dealings with me. It has been a pleasure. :1st_place_medal: :heart:
Here it is: font-patcher.log
Thanks. The output suggests that there are no problems. Also the 'cell' size seems reasonable:
DEBUG: Final font cell dimensions 1024 w x 2246 h
A lot of the problems encountered while patching would be output, when the script has to decide on conflicting data or makes any compromise. Nothing in that log.
Yes, that is correct, it should be the
Xglyph. This comes from bufferline which gets fixed using:
:+1:
gives me2020ea76… Whichfc-listsaysUnable to parse the pattern. sob I have the feeling I am doing something wrong there… thinking
Are there no blanks in your display? It should be 20 20 ea76, so 20 is the leading blanks, the code of your icon is ea76.
Because I have no Nerd Font installed right now, we can see it in this very comment also:
In short, problem solved for me by hacking stuff… Not ideal, but at least we have an issue we can point people to.
:+1: I'm not really familiar with nerdfix but that should also be very convenient to use (from the description I really recommend that).
But of course better to fix upstream.
Would it if I wrote a tiny Markdown doc/wiki entry to summarize the debugging steps? Would that be useful for newcomers?
I guess: Yes :+1: I believe anyone can edit the wiki, but I never tried?
thank you so much for all your help over the years
Thank you :heart:
logs
It is good that there are no errors there. :tada:
ea76
It is indeed the icon.
â ; fc-list :charset=ea76 | rg "PragmataPro Mono Liga Regular Nerd Font Complete"
/home/yann/.local/share/fonts/PragmataPro Mono Liga Regular Nerd Font Complete.ttf: PragmataProMonoLiga Nerd Font:style=Regular
â ; echo -e "\uea76"
î©¶ # What are the chances of this glyth rendering?
So, that icon is there but is not what I want. I wonder if bufferline has not updated to Nerd Fonts v3.
I guess: Yes +1 I believe anyone can edit the wiki, but I never tried?
I shall investigate.
Thank you.
@Finii A new wiki FAQ entry…
ea76 should be absolutely unproblematic and has nothing to do with v3.
Turning to your logfile:
Updating glyph: <Glyph close in font codicon> close putting at: EA76
DEBUG: Found essential Glyph at EA76. Skipping...
I guess they put (part of) a ligature on that codepoint, so the patcher script does not destroy your ligs, but that means you do not have that symbol :grimacing:
In other words: EA76 is used by some essential glyph probably through a reference or a ligature. If we change how EA76 looks like something other (that the script deems 'essential') would break, so it is not touched.
There are 'a lot' codepoints already taken in the EAxx range in your source-font...
Here the explanation in the sourcecode:
def get_essential_references(self):
"""Find glyphs that are needed for the basic glyphs"""
# Sometimes basic glyphs are constructed from multiple other glyphs.
# Find out which other glyphs are also needed to keep the basic
# glyphs intact.
# 0x0000-0x017f is the Latin Extended-A range
# 0xfb00-0xfb06 are 'fi' and other ligatures
basic_glyphs = set()
# Collect substitution destinations
for glyph in [*range(0x21, 0x17f + 1), *range(0xfb00, 0xfb06 + 1)]:
Some other glyphs are not patched in because you give --careful on the command line:
Updating glyph: <Glyph workflow in font OcticonsNerdFont-Regular> workflow putting at: F52E
DEBUG: Found existing Glyph at F52E. Skipping...
but 'essential' codepoints are never touched at all, there is no way to enforce it.
but 'essential' codepoints are never touched at all, there is no way to enforce it.
Well, of course you can comment it out, if you use a patcher in script form, but be prepared that something else is broken then.
diff --git a/font-patcher b/font-patcher
index 8119752b1..ccebec40b 100755
--- a/font-patcher
+++ b/font-patcher
@@ -333,7 +333,6 @@ class font_patcher:
def patch(self, font):
self.sourceFont = font
self.setup_version()
- self.get_essential_references()
self.setup_name_backup(font)
self.assert_monospace()
self.remove_ligatures()
Well, of course you can comment it out, if you use a patcher in script form, but be prepared that something else is broken then.
That does not sound like a safe thing to do! :scream:
Just searched for your font ...
That fits ;-D I'll have a look at the font's intestines :grin:
That fits ;-D I'll have a look at the font's intestines grin
Thank you! :heart: That is going beyond the call of duty. Much appreciated.
Hmm, that font IS ALREADY Nerd Font patched:
but with unknown settings, so if you want to have any control you need to not give --careful.
Fabian put all the ligs in the EA range...:
That looks like a three letter ligature for ||-. But why is that deemed 'essential'?
And when I patch that font, they are not 'essential', and will be replaced:
Hmm, when I use your options (including --careful) I get this (not 'essential' but 'existing'):
According to your logfile you use the patcher from a cloned repo:
Nerd Fonts Patcher v3.0.1-25 (4.3.4) (ff 20230101)
Despite the fact that I use v3.0.1-57 (4.3.4) there should be no difference, which means... The fonts are different files? :thinking:
Maybe that is an obscure difference in Python versions. I have 3.11.2 here.
I can not think of any reason why this should be different.
Different is the fontforge version, I have no 20230101 on my current machine.
You can use the following code to find out why it is deemed essential:
diff --git a/font-patcher b/font-patcher
index 8119752b1..4fbd6aa24 100755
--- a/font-patcher
+++ b/font-patcher
@@ -1102,6 +1102,8 @@ class font_patcher:
basic_glyphs.add(glyph)
for possub in self.sourceFont[glyph].getPosSub('*'):
if possub[1] == 'Substitution' or possub[1] == 'Ligature':
+ if self.sourceFont[possub[2]].unicode == 0xea76:
+ print("got {:X} for {} for {:X}".format(self.sourceFont[possub[2]].unicode, possub[2], glyph))
basic_glyphs.add(self.sourceFont[possub[2]].unicode)
basic_glyphs.discard(-1) # the .notdef glyph
for glyph in basic_glyphs:
Hmm, that font IS ALREADY Nerd Font patched
Wait… WHAT? :facepalm:
Some system details:
√ (master|✓); git log | head -3
commit 431b0aa8d70569c7ad921fa4ce87576cb9f0ac2a
Author: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
Date: Wed May 31 03:04:46 2023 +0000
√ (master|✓); python --version
Python 3.11.3
√ (master|✓); fontforge --version
Copyright (c) 2000-2023. See AUTHORS for Contributors.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
with many parts BSD <http://fontforge.org/license.html>. Please read LICENSE.
Version: 20230101
Based on sources from 2023-01-19 00:00 UTC-ML-D-GDK3.
fontforge 20230101
build date: 2023-01-19 00:00 UTC
The font patcher command:
./font-patcher \
~/.local/share/fonts/PragmataPro0.829/PragmataProR_liga_0829.ttf \
--outputdir ~/.local/share/fonts \
--no-progressbars \
--adjust-line-height \
--mono \
--debug 2 \
--complete | tee ~/font-patcher.log
And the log file: font-patcher.log where I think the only thing is got EA76 for uniEA76 for 2D.
Despite the fact that I use v3.0.1-57 (4.3.4) there should be no difference, which means... The fonts are different files? thinking
√ (master|+1); sha256sum ~/.local/share/fonts/PragmataPro0.829/PragmataProR_liga_0829.ttf
24881629d6c48c2167aaff68945de1d08b51081965b76d49514337189bb0b0ca /home/yann/.local/share/fonts/PragmataPro0.829/PragmataProR_liga_0829.ttf
That should tell us.
Man, we are going deep down the rabbit hole! :grin: :sunglasses: :rabbit:
√ (master|+1); sha256sum ~/.local/share/fonts/PragmataPro0.829/PragmataProR_liga_0829.ttf 24881629d6c48c2167aaff68945de1d08b51081965b76d49514337189bb0b0ca /home/yann/.local/share/fonts/PragmataPro0.829/PragmataProR_liga_0829.ttf
$ sha256sum ~/Downloads/PragmataProR_0829.ttf
06db2a37ddf4554b10fd0f7471503b88a2eef3596f0bacaf1d5abe54bb54fd9f /home/ujastrow/Downloads/PragmataProR_0829.ttf
Ah I see, that is no 'liga' font.
2D is the regular minus sign. If that is the case my algorithm has a bug.
√ (master|+1); sha256sum ~/.local/share/fonts/PragmataPro0.829/PragmataProR_0829.ttf
06db2a37ddf4554b10fd0f7471503b88a2eef3596f0bacaf1d5abe54bb54fd9f /home/yann/.local/share/fonts/PragmataPro0.829/PragmataProR_0829.ttf
That's the same font!
Ah, it is in the liga version only:
In principle you could apply this diff to ignore and remove the table entries
diff --git a/font-patcher b/font-patcher
index 8119752b1..9af0b5d3d 100755
--- a/font-patcher
+++ b/font-patcher
@@ -1101,7 +1101,7 @@ class font_patcher:
continue
basic_glyphs.add(glyph)
for possub in self.sourceFont[glyph].getPosSub('*'):
- if possub[1] == 'Substitution' or possub[1] == 'Ligature':
+ if possub[1] == 'Ligature':
basic_glyphs.add(self.sourceFont[possub[2]].unicode)
basic_glyphs.discard(-1) # the .notdef glyph
for glyph in basic_glyphs:
... And then there is also the fontforge bug that it does not remove rules in some cases. ....
not removed :grimacing: (but you see the patching did take place and the glyph names changed)
So you need additionally this config.json:
[Subtables]
ligatures: [
"Single Substitution lookup 208 subtable",
"Single Substitution lookup 199 subtable",
"Single Substitution lookup 197 subtable",
"Single Substitution lookup 195 subtable",
"Single Substitution lookup 88 subtable",
"Single Substitution lookup 67 subtable",
"Single Substitution lookup 66 subtable",
"Single Substitution lookup 60 subtable",
"Single Substitution lookup 59 subtable",
"Single Substitution lookup 58 subtable",
"Single Substitution lookup 57 subtable",
"Single Substitution lookup 56 subtable",
"Single Substitution lookup 55 subtable",
"Single Substitution lookup 54 subtable" ]
and
diff --git a/font-patcher b/font-patcher
index 8119752b1..9af0b5d3d 100755
--- a/font-patcher
+++ b/font-patcher
@@ -1101,7 +1101,7 @@ class font_patcher:
continue
basic_glyphs.add(glyph)
for possub in self.sourceFont[glyph].getPosSub('*'):
- if possub[1] == 'Substitution' or possub[1] == 'Ligature':
+ if possub[1] == 'Ligature':
basic_glyphs.add(self.sourceFont[possub[2]].unicode)
basic_glyphs.discard(-1) # the .notdef glyph
for glyph in basic_glyphs:
And call the patcher something like this:
fontforge font-patcher ~/Downloads/PragmataProR_liga_0829.otf --debug 2 --mono --complete --removeligs --configfile ./config.json
The config table is based on the otf, I could not find the ttf. Probably it will work with the ttf, hmm.
Of course that will remove the ligatures mentioned in the config.json, these are the ones related to
(starting with)/ : < = > _. If you want the ligs, you can not have the symbols in the same place :grimacing:
That can only be solved by careful moving of the ligatures, which I did not implement because ... that can be rather complicated.
I guess the prepatched fonts are not affected (but I will check).
Leaving this now, as we need 3.0.2 urgently I guess, and there is just one issue remaining.
At this point, it appears that we have two choices:
- Continue making numerous changes to cater to a few ligatures in a font few will use.
- Ask Fabian to move some of his fonts to cater to Nerd Font defaults.
I am leaning towards the later…
I guess the prepatched fonts are not affected (but I will check).
Well, Pragmata Pro is not in the release, thus there are no prepatched fonts.
So people who self-patch need to either add the config.json or use careful.
There is nothing we can or need to do here, I guess.
@allcontributors please add @kierun for bug