Skip to content
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

Icons are rendered small and low on Windows Terminal and iTerm (have bisect) #634

Closed
tomKPZ opened this issue Jun 10, 2021 · 5 comments
Closed

Comments

@tomKPZ
Copy link

tomKPZ commented Jun 10, 2021

nf-small-icons

Repro steps:

  • Run font-patcher -lwc src/unpatched-fonts/FiraCode/Retina/FiraCode-Retina.ttf
  • Install the font and enable it in Windows Terminal

I've bisected the issue to this commit:
d0bf73a

Reverting the changes to font-patcher fixes the issue in Windows Terminal (I haven't tested in iTerm):

diff --git a/font-patcher b/font-patcher
index b904c409..d3b419ba 100755
--- a/font-patcher
+++ b/font-patcher
@@ -773,16 +773,17 @@ class font_patcher:
             align_matrix = psMat.translate(x_align_distance, y_align_distance)
             self.sourceFont.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])
-
             # reset selection so iteration works properly @TODO fix? rookie misunderstanding?
             # This is likely needed because the selection was changed when the glyph was copy/pasted
             if symbolFontStart == 0:
@gmr458
Copy link

gmr458 commented Jun 17, 2021

I use Windows Terminal and the same thing happens to me.

@Finii
Copy link
Collaborator

Finii commented Feb 23, 2022

#764 :-D

@Finii Finii mentioned this issue Apr 25, 2022
4 tasks
@buitrbao222
Copy link

i have the same issue on Windows Terminal version 1.12.10982.0 with the font FiraCode NF v6.2.

@Finii
Copy link
Collaborator

Finii commented Oct 21, 2022

The reason is (most likely) that the user uses a Font with 'bigger icons' and the client/terminal is scaling them down to fit into one cell. That scaling is not very sophisticated and thus they land 'low'.

Windows Terminal has very strong opinions on glyph widths and corrects fonts if they are not as expected, while other clients enable the fonts to have as much freedom as they could give.

The 'always correct' solution is to use a Nerd Font Mono variant (or NFM), where icons are NOT bigger than one slot. Here the placement has been done by us. If you want bigger icons, that would require a Nerd Font variant of version v2.2.2 or later.

See also

@Finii Finii closed this as completed Oct 21, 2022
@github-actions
Copy link
Contributor

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants