-
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
Fira code glyphs size reduced #731
Comments
You mean the symbols versus the letters comparing 5.2 with 6.x? |
(I ask specifically because at the moment I work on the glyph rescaling ;) I guess 5.2 and 6.x are Fira Code version numbers. So you self-patch? I will download 5.2 and 6.2 from https://github.com/tonsky/FiraCode/releases and try to reproduce. |
$ fontforge --script ~/git/nerd-fonts/font-patcher --complete Fira_Code_v5.2/ttf/FiraCode-Regular.ttf
$ mv 'Fira Code Regular Nerd Font Complete.ttf' 'Fira Code Regular Nerd Font Complete 5.2.ttf'
$ fontforge --script ~/git/nerd-fonts/font-patcher --complete Fira_Code_v6.2/ttf/FiraCode-Regular.ttf
$ mv 'Fira Code Regular Nerd Font Complete.ttf' 'Fira Code Regular Nerd Font Complete 6.2.ttf'
$ fontforge Fira\ Code\ Regular\ Nerd\ Font\ Complete\ *ttf ( Windows is the only glyph I could find. Hope it is the correct Windows. So to proceed we need the information I asked above. (My hunch is that 5.2 is Nerd Font non-mono while 6.x is Nerd Font Mono, but you specifically say you use the non-Mono version *ponder* Maybe give exact file name.) |
@Finii Sorry been busy with a release today. You mean the symbols versus the letters comparing 5.2 with 6.x? Yes, the symbols are too small |
I used the font here in this repo, |
Another thing I noticed is in Windows Terminal Settings font drop down v5.2 FiraCode NF appears directly but the v6.2 FiraCode NF doen't show unless I select Show all fonts. |
Same issue present in Caskaydia Cove latest also. Older one looks fine. |
Hmm, checked Fira Code. The font in the repo I can not even use with 'all fonts'. But when I patch Fira anew with all on HEAD with and install that font on Windows, and use it like this (note: 'all fonts' checked) I get this: Which looks ok for me. But you are right, the font in the repo is not working. But it will be fixed (at least to some degree) if the all fonts are updated with the current |
Ah, with #732 even the 'all fonts' is not needed ... we see So I deem this is already fixed but not updated. If you tell me which font exactly you need I can prepare it for you. Mind, that because of the naming bug (will be fixed with #717 eventually) you can not install Edit: Change the 'question' to bold |
@Finii I'm currently on Caskaydia Cove Semilight complete. If I can have it it'll be great. Thanks for your time and effort mate, really appreciated. |
Please try these fonts, they have all the pending fixes to https://github.com/Finii/nerd-fonts/tree/feature/cascadia-2111.01/patched-fonts/CascadiaCode |
@Finii I downloaded Also I need to select all fonts to choose this font. And it looks tall compared to Cascadia Code Semilight. |
Ok, thanks for the feedback. |
I did not change anything relevant here 😅 All the scaling in only done when So the only question for me is... why is fox-thing scaled down. Same font file works on non-monospaced terminals: |
So you think it's something to do with Windows Terminal misbehaving... Regarding the font I used is static or variable, I don't have a clue. 🦊 feels embarrassed.. 😂 Edit: Found this issue in terminal but can't really understand. Edit again: I'll try my pwsh away from Windows Terminal and see if the glyphs are sized correctly. Edited again: if it's terminal, why old version of fonts sized correctly? 🤔 Fira and Caskaydia both old version sized okay. |
Terminal is not misbehaving. The problem is that from a terminal people expect that the text is on a grid, like 80 chars wide and 24 rows. Each char has one allotted space (one 'monospace' as they are all the same). So iii
If one uses a Nerd Font Mono variant, this is what is in the font. But they are wider than one space... How is an application expected to handle that? There are several possibilities:
So what Terminal does is rather reasonable. It even 'warns' you, it lists only 'monospaced' fonts unless you tick 'all fonts'; then possibly problematic fonts can be selected ;) It also seems that Terminal sometimes at least detects that glyphs are too wide and then puts them into an artifical two-spaces-wide slot. This happenes with the radar glyph. And that raises the question why radar is detected as double width glyph and Foxy is not. I never test(ed) Terminal on Windows, just for the sole reason that it bundles Cascadia with it and that I'm too stupid to remove the font effortlessly. I want to be in control over the fonts that are installed and Terminal takes that from me. So for me the question is still: |
Ah. Terminal has a function that determines the width of the glyph. Codepoint Width Detector https://github.com/microsoft/terminal/blob/main/src/types/CodepointWidthDetector.cpp Radar icon is U_F936 ... according to table UnicodeRange{ 0xe000, 0xf8ff, CodepointWidth::Ambiguous },
UnicodeRange{ 0xf900, 0xfaff, CodepointWidth::Wide },
*cough* Okay. That leaves the question why old fonts work? Checking. |
Maybe here: 978f3b1, trying |
When I use Examining the script... It is this commit 59c45ba that breaks it:
Hmm. Here is the relevant sub-part of the commit: --- ../font-patcher-5.2-B7 2021-12-30 12:46:58.915031689 +0100
+++ font-patcher 2021-12-30 12:49:32.063374743 +0100
@@ -807,17 +807,16 @@
align_matrix = psMat.translate(x_align_distance, y_align_distance)
self.sourceFont[currentSourceFontGlyph].transform(align_matrix)
- # Ensure after horizontal adjustments and centering that the glyph
- # does not overlap the bearings (edges)
- self.remove_glyph_neg_bearings(self.sourceFont[currentSourceFontGlyph])
-
# Needed for setting 'advance width' on each glyph so they do not overlap,
# also ensures the font is considered monospaced on Windows by setting the
# same width for all character glyphs. This needs to be done for all glyphs,
# even the ones that are empty and didn't go through the scaling operations.
- # it should come after setting the glyph bearings
self.set_glyph_width_mono(self.sourceFont[currentSourceFontGlyph])
+ # Ensure after horizontal adjustments and centering that the glyph
+ # does not overlap the bearings (edges)
+ self.remove_glyph_neg_bearings(self.sourceFont[currentSourceFontGlyph])
+
# end for
if self.args.quiet is False or self.args.progressbars: Note that the explicit statement that it shall come after the bearings correction is ignored and removed 😬 |
This is what the code is about:
We want the advance width to be the same for all glyphs. ✔️ The bounding-box width and the three values above always (have to) sum up. We do not change the bounding box, because ... we do not touch the glyph itself. We start with a glyph that is wider than one advance width. The width of the glyph is given by its bounding box, which is unchanged).
That is wrong. I guess that is the reason for the very strange looking Ubuntu font, for this issue, for others possibly. Need to dig deeper WHY this has been changed. |
That's the place |
Okay, the reason for the change is most likely this (I even stated it above) Bisected an overlap issue in status bars to ...Before that commit (59c45ba) we had
After that commit we have now
The reason for the overlap issue (that I did not find (search for)) is most likely as follows. People have a non-strictly-monospaced application like Note the X overlapping Foxy. Or in Someone will have complained. With the change the font is not monospaced anymore (i.e. has not equal advance width for all stuff), but it renders more nicely in proportional font aware contexts: Note that the Tilix on the other hand ignores it and looks the same as above, it forces all glyphs to be the same width. Windows Terminal handles it in another, different way etc. |
This is the current code: align_matrix = psMat.translate(x_align_distance, y_align_distance)
self.sourceFont[currentSourceFontGlyph].transform(align_matrix)
# Needed for setting 'advance width' on each glyph so they do not overlap,
# also ensures the font is considered monospaced on Windows by setting the
# same width for all character glyphs. This needs to be done for all glyphs,
# even the ones that are empty and didn't go through the scaling operations.
self.set_glyph_width_mono(self.sourceFont[currentSourceFontGlyph])
# Ensure after horizontal adjustments and centering that the glyph
# does not overlap the bearings (edges)
self.remove_glyph_neg_bearings(self.sourceFont[currentSourceFontGlyph])
# end for First The question is what we want. At the moment there are two variants possible
But what some people would like to have is
This analysis just points out the facts. I have no clue what 'the users' want. I personally always used So typically, if you are in a monospaced environment (like Terminal) you want a strictly monospaced font (i.e. Nerd Font Mono). That font will be selectable without 'all fonts' ticked. But then, I have seen many issues regarding too small icons and ppl seem to expect big icons. I think this is the point where @ryanoasis needs to say something :-> Maybe at some point one can drop the 'for Windows' variants, and instead add the third alternative from above. |
This seems to be the original Issue report and it is exactly this... people who expect icon-adwance-width to be the full bbox-width. Which is contrary to people who expect monospaced stuff. |
I think this depends on the font as well. For example, Iosevka is 8px wide at 12pt (as opposed to 10px like most other fonts), and shrinking an icon that small makes it very hard to read, even on a hidpi screen. |
The glyph showing as two-wide is F936 which is a CJK compatibility character, so terminal thinks it's two wide. |
I think there might be another problem at play here. On Windows, the family name is the same for the mono and regular variants. And at least for me in Neovide neovide/neovide#1135, that was the actual problem. And I solved it by just not installing any mono variants. But the issue is still there in the Windows Terminal, and probably in a lot of other terminal emulators as well. At least in the Neovim community the double width glyphs are the standard. And almost all plugins adds an extra space after the glyph by default or it's at least configurable. It's usually also configurable in other terminal programs like
So I would say that the issue is a polybar issue, not a Nerd fonts issue, and the changes should be reverted. |
[why] The commit 59c45ba Remove negative bearings on 2048-em glyphs has been introduced to fix some problems with the symbols only font, at least from the commit message. That font is intended to be used in font-fallback situations, and so we do not know the advance width of the current font anyhow. It does not make sense to enforce an advance width with these. [how] Create the NerdFontsSymbolsOnly as if 59c45ba would be still in effect, i.e. with variable advance width. [note] There have been a lot discussions about the reverted commit, some can be found here: * #900 * #764 * #731 Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why] The commit 59c45ba Remove negative bearings on 2048-em glyphs has been introduced to fix some problems with the symbols only font, at least from the commit message. That font is intended to be used in font-fallback situations, and so we do not know the advance width of the current font anyhow. It does not make sense to enforce an advance width with these. [how] Create the NerdFontsSymbolsOnly as if 59c45ba would be still in effect, i.e. with variable advance width. [note] There have been a lot discussions about the reverted commit, some can be found here: * #900 * #764 * #731 Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a new issue, complete the issue template with all the details necessary to reproduce, and mention this issue as reference. |
🎯 Subject of the issue
The glyph size of Fira Code patched font is reduced
🔧 Your Setup
Fira Code Regular Nerd Font Complete
Windows Terminal
v1.11.3471.0★ Screenshots (Optional)
The text was updated successfully, but these errors were encountered: