kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
24.11k stars 972 forks source link

Regular style fonts not detected after 0.36.0 update #7759

Closed johnsonsu closed 1 month ago

johnsonsu commented 1 month ago

Describe the bug I use a patched nerd font (patched with nerd-font) and the Regular style fonts are not loaded after updating to 0.36.0. Italic style fonts are loaded. The same font files works with kitty 0.35.2.

# 0.36.0 --debug-font-fallback output
❯ kitty --debug-font-fallback
[0.200] Cell height calculation:
[0.200]     line height from line origins: 30.000000
[0.200]     line bounds: origin-y: -6.131836 height: 30.265625
[0.200]     line bounds-no-leading: origin-y: -6.131836 height: 30.265625
[0.200]     bounds metrics: ascent: 24.133789
[0.200]     line metrics: ascent: 24.133789 descent: 6.131836 leading: 0.000000
[0.200]     font metrics: ascent: 24.133789 descent: 6.131836 leading: 0.000000 underline_position: -1.650391
[0.200]     cell_height: 30 baseline: 24 underline_position: 26 strikethrough_position: 15
[0.257] Text fonts:
[0.257]   Normal: Menlo-Regular: /System/Library/Fonts/Menlo.ttc
[0.257]   Bold: Menlo-Bold: /System/Library/Fonts/Menlo.ttc
[0.257]   Italic: SFMonoNF-MediumItalic: /Users/johnsonsu/Library/Fonts/SFMonoNerdFont-MediumItalic.otf
[0.257]   Bold-Italic: SFMonoNF-BoldItalic: /Users/johnsonsu/Library/Fonts/SFMonoNerdFont-BoldItalic.otf
[3641.315] Cell height calculation:
[3641.316]  line height from line origins: 15.000000
[3641.316]  line bounds: origin-y: -3.065918 height: 15.132812
[3641.316]  line bounds-no-leading: origin-y: -3.065918 height: 15.132812
[3641.316]  bounds metrics: ascent: 12.066895
[3641.316]  line metrics: ascent: 12.066895 descent: 3.065918 leading: 0.000000
[3641.316]  font metrics: ascent: 12.066895 descent: 3.065918 leading: 0.000000 underline_position: -0.825195
[3641.316]  cell_height: 15 baseline: 12 underline_position: 13 strikethrough_position: 7

# 0.35.2 output
❯ kitty --debug-font-fallback
[0.241] Preloaded font faces:
[0.241] normal face: /Users/johnsonsu/Library/Fonts/SFMonoNerdFont-Medium.otf
[0.241] bold face: /Users/johnsonsu/Library/Fonts/SFMonoNerdFont-Bold.otf
[0.241] italic face: /Users/johnsonsu/Library/Fonts/SFMonoNerdFont-MediumItalic.otf
[0.241] bi face: /Users/johnsonsu/Library/Fonts/SFMonoNerdFont-BoldItalic.otf
[0.281] Cell height calculation:
[0.281]     line height from line origins: 31.000000
[0.281]     line bounds: origin-y: -6.271484 height: 31.027344
[0.281]     line bounds-no-leading: origin-y: -6.271484 height: 31.027344
[0.281]     bounds metrics: ascent: 24.755859
[0.281]     line metrics: ascent: 24.755859 descent: 6.271484 leading: 0.000000
[0.281]     font metrics: ascent: 24.755859 descent: 6.271484 leading: 0.000000 underline_position: -1.904297
[0.281]     cell_height: 31 baseline: 25 underline_position: 27 strikethrough_position: 16

I've updated the config file to the new syntax:

# Old syntax, works on 0.35.2
font_family       SFMono Nerd Font Medium
bold_font         SFMono Nerd Font Bold
italic_font       SFMono Nerd Font Medium Italic
bold_italic_font  SFMono Nerd Font Bold Italic

# Updated syntax, but does not work on 0.36.0
font_family       postscript_name=SFMonoNF-Medium
bold_font         postscript_name=SFMonoNF-Bold
italic_font       postscript_name=SFMonoNF-MediumItalic
bold_italic_font  postscript_name=SFMonoNF-BoldItalic

# also tried this syntax, still does not work on 0.36.0
font_family       family='SFMono Nerd Font' style='Medium'
bold_font         family='SFMono Nerd Font' style='Bold'
italic_font       family='SFMono Nerd Font' style='Medium Italic'
bold_italic_font  family='SFMono Nerd Font' style='Bold Italic'

To Reproduce I cannot distribute the patched font file due to Apple's licensing. However, they can be obtained from https://developer.apple.com/fonts/ and patch with nerd-font if needs to reproduce.

Screenshots Screenshot of kitten choose-font showing that only italic styles are detected:

Screenshot 2024-08-20 at 1 54 57 PM

Environment details

kitty 0.36.0 (d8db17c513) created by Kovid Goyal
Darwin Johnsons-M3-Pro.ht.home 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6030 arm64
ProductName:        macOS ProductVersion:       14.6.1 BuildVersion:        23G93
OpenGL: '4.1 Metal - 88.1' Detected version: 4.1
Frozen: True
Fonts:
  medium: Menlo-Regular: /System/Library/Fonts/Menlo.ttc
  bold: Menlo-Bold: /System/Library/Fonts/Menlo.ttc
  italic: SFMonoNF-MediumItalic: /Users/johnsonsu/Library/Fonts/SFMonoNerdFont-MediumItalic.otf
  bi: SFMonoNF-BoldItalic: /Users/johnsonsu/Library/Fonts/SFMonoNerdFont-BoldItalic.otf
Paths:
  kitty: /Applications/kitty.app/Contents/MacOS/kitty
  base dir: /Applications/kitty.app/Contents/Resources/kitty
  extensions dir: /Applications/kitty.app/Contents/Resources/Python/lib/kitty-extensions
  system shell: /bin/zsh
Loaded config files:
  /Users/johnsonsu/.config/kitty/kitty.conf

Config options different from defaults:
bold_font               postscript_name=SFMonoNF-Bold
bold_italic_font        postscript_name=SFMonoNF-BoldItalic
disable_ligatures       2
enabled_layouts         ['fat', 'tall', 'splits', 'stack']
font_family             postscript_name=SFMonoNF-Medium
font_size               13.0
initial_window_height   (440, 'px')
initial_window_width    (720, 'px')
italic_font             postscript_name=SFMonoNF-MediumItalic
remember_window_size    False
tab_bar_edge            1
tab_bar_style           powerline
Added shortcuts:
    cmd+[ →  previous_window
    cmd+] →  next_window
    cmd+left →  resize_window narrower
    cmd+right →  resize_window wider
    ctrl+` →  nth_window -1
Removed shortcuts:
    cmd+, →  edit_config_file
    cmd+h →  hide_macos_app
    cmd+k →  clear_terminal to_cursor active
    cmd+m →  minimize_macos_window
    cmd+n →  new_os_window
    cmd+q →  quit
    cmd+w →  close_tab
    ctrl+cmd+, →  load_config_file
    ctrl+cmd+f →  toggle_fullscreen
    opt+cmd+h →  hide_macos_other_apps
    opt+cmd+r →  clear_terminal reset active
    opt+cmd+s →  toggle_macos_secure_keyboard_entry
    shift+cmd+/ →  open_url https://sw.kovidgoyal.net/kitty/
    shift+cmd+[ →  previous_tab
    shift+cmd+] →  next_tab
    shift+cmd+d →  close_window
    shift+cmd+w →  close_os_window
Changed shortcuts:
    cmd+1 →  goto_tab 1
    cmd+2 →  goto_tab 2
    cmd+3 →  goto_tab 3
    cmd+4 →  goto_tab 4
    cmd+5 →  goto_tab 5
    cmd+6 →  goto_tab 6
    cmd+7 →  goto_tab 7
    cmd+8 →  goto_tab 8
    cmd+9 →  goto_tab 9
    cmd+down →  resize_window shorter
    cmd+enter →  launch --cwd=current
    cmd+home →  resize_window reset
    cmd+t →  new_tab_with_cwd !neighbor
    cmd+up →  resize_window taller
    kitty_mod+enter →  launch --cwd=current
    kitty_mod+t →  new_tab_with_cwd !neighbor
Colors:
    active_border_color     #e7e7e7   
    active_tab_background   #3a3d41   
    active_tab_foreground   #ffffff   
    background              #1e1e1e   
    color1                  #f14c4c   
    color10                 #0dbc79   
    color11                 #e5e510   
    color12                 #2472c8   
    color13                 #bc3fbc   
    color14                 #11a8cd   
    color15                 #e5e5e5   
    color2                  #23d18b   
    color3                  #f5f543   
    color4                  #3b8eea   
    color5                  #d670d6   
    color6                  #29b8db   
    color7                  #e5e5e5   
    color8                  #666666   
    color9                  #cd3131   
    cursor                  #ffffff   
    cursor_text_color       #1e1e1e   
    foreground              #cccccc   
    inactive_border_color   #414140   
    inactive_tab_background #1e1e1e   
    inactive_tab_foreground #858485   
    selection_background    #264f78   
    selection_foreground    #cccccc   

Important environment variables seen by the kitty process:
    PATH                                /Applications/kitty.app/Contents/MacOS:/usr/bin:/bin:/usr/sbin:/sbin
    LANG                                en_CA.UTF-8
    SHELL                               /bin/zsh
    USER                                johnsonsu
jtmkrueger commented 1 month ago

I'm having the same issue. I use OperatorMono and I've used the nerd-font patcher. Also can confirm it worked in 0.35

ReubenM commented 1 month ago

Use a normal font. Nerd fonts are built-in now.

kovidgoyal commented 1 month ago

dup of #7729

jtmkrueger commented 1 month ago

I subbed in the unpatched OperatorMono as @ReubenM suggested and it works fine now. thanks! Nice to not have to do my own patching when the icons update/change :D