nerd-fonts icon indicating copy to clipboard operation
nerd-fonts copied to clipboard

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

Open tomKPZ opened this issue 3 years ago • 3 comments

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: https://github.com/ryanoasis/nerd-fonts/commit/d0bf73a19c3459aab39734a05159e2694911d7d6

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:

tomKPZ avatar Jun 10 '21 03:06 tomKPZ

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

gmr458 avatar Jun 17 '21 05:06 gmr458

#764 :-D

Finii avatar Feb 23 '22 07:02 Finii

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

buitrbao222 avatar May 29 '22 16:05 buitrbao222

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

  • #900
  • #969
  • #945
  • #764

Finii avatar Oct 21 '22 06:10 Finii

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[bot] avatar Apr 24 '23 00:04 github-actions[bot]