kovidgoyal / kitty

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

macOS: Kitty can no longer find "FiraCode Nerd Font" on system. Falls back to Menlo. #7795

Closed damienbutt closed 2 months ago

damienbutt commented 2 months ago

Describe the bug I use Fira Code Nerd Font. I have this installed with Homebrew. Never had any issues. Recently Kitty is unable to find this font and falls back to Menlo.

The font is installed and other terminals can use it.

kitty --debug-font-fallback
[0.067] Cannot use both macos_titlebar_color and background_opacity
[2.027] The font FiraCode Nerd Font was not found, falling back to Menlo
[2.139] Cell height calculation:
[2.139]     line height from line origins: 41.000000
[2.139]     line bounds: origin-y: -8.490234 height: 41.906250
[2.139]     line bounds-no-leading: origin-y: -8.490234 height: 41.906250
[2.139]     bounds metrics: ascent: 33.416016
[2.139]     line metrics: ascent: 33.416016 descent: 8.490234 leading: 0.000000
[2.139]     font metrics: ascent: 33.416016 descent: 8.490234 leading: 0.000000 underline_position: -2.285156
[2.139]     cell_height: 41 baseline: 33 underline_position: 36 strikethrough_position: 21
[2.284] Text fonts:
[2.284]   Normal: Menlo-Regular: /System/Library/Fonts/Menlo.ttc
[2.284]   Bold: Menlo-Bold: /System/Library/Fonts/Menlo.ttc
[2.284]   Italic: Menlo-Italic: /System/Library/Fonts/Menlo.ttc
[2.284]   Bold-Italic: Menlo-BoldItalic: /System/Library/Fonts/Menlo.ttc

Environment details

kitty 0.36.1 (95245ee473) created by Kovid Goyal
Darwin db-macbook-pro 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:13:00 PDT 2024; root:xnu-10063.141.2~1/RELEASE_X86_64 x86_64
ProductName:        macOS ProductVersion:       14.6.1 BuildVersion:        23G93
OpenGL: '4.1 ATI-5.5.17' Detected version: 4.1
Frozen: True
Fonts:
  medium: Menlo-Regular: /System/Library/Fonts/Menlo.ttc
  bold: Menlo-Bold: /System/Library/Fonts/Menlo.ttc
  italic: Menlo-Italic: /System/Library/Fonts/Menlo.ttc
  bi: Menlo-BoldItalic: /System/Library/Fonts/Menlo.ttc
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/damienbutt/.config/kitty/kitty.conf

Config options different from defaults:
active_border_color     None
background_blur         10
background_opacity      0.9
confirm_os_window_close 0
cursor_blink_interval   (1.0, kitty.options.utils.EasingFunction(), kitty.options.utils.EasingFunction())
cursor_text_color       None
enable_audio_bell       False
font_family             FiraCode Nerd Font
font_size               18.0
inactive_text_alpha     0.7
linux_display_server    x11
macos_option_as_alt     2
shell_integration       frozenset({'disabled'})
term                    xterm-256color
window_padding_width    FloatEdges(left=15.0, top=15.0, right=15.0, bottom=15.0)
Removed shortcuts:
    cmd+, →  edit_config_file
    cmd+enter →  new_window
    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+t →  new_tab
    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
Colors:
    active_tab_background   #f8f8f2   
    active_tab_foreground   #282a36   
    background              #0b0c0e   
    color0                  #21222c   
    color1                  #ff5555   
    color10                 #69ff94   
    color11                 #ffffa5   
    color12                 #d6acff   
    color13                 #ff92df   
    color14                 #a4ffff   
    color2                  #50fa7b   
    color3                  #f1fa8c   
    color4                  #bd93f9   
    color5                  #ff79c6   
    color6                  #8be9fd   
    color7                  #f8f8f2   
    color8                  #6272a4   
    color9                  #ff6e6e   
    cursor                  #ff80bf   
    foreground              #f7f8f2   
    inactive_tab_background #6272a4   
    inactive_tab_foreground #282a36   
    mark1_background        #ff5555   
    mark1_foreground        #282a36   
    selection_background    #44475a   
    selection_foreground    #434c56   
    url_color               #8be9fd   

Important environment variables seen by the kitty process:
    PATH                                /Applications/kitty.app/Contents/MacOS:/usr/bin:/bin:/usr/sbin:/sbin
    LANG                                en_GB.UTF-8
    SHELL                               /bin/zsh
    USER                                damienbutt
kovidgoyal commented 2 months ago

Do not use patched fonts in kitty. Read the FAQ: https://sw.kovidgoyal.net/kitty/faq/#kitty-is-not-able-to-use-my-favorite-font

liuyinz commented 2 months ago

Same problem. However my font is not patched nerd font, but still can not found. The question is LXGW WenKai can not be found in fixed-width collection in font-book, but however it worked quiet well in previous versions of kitty.

f[0.033] Cannot use both macos_titlebar_color and background_opacity
[0.154] The font LXGW WenKai Mono Light was not found, falling back to Menlo
[0.154] The font LXGW WenKai Mono Bold was not found, falling back to Menlo
[0.192] Cell height calculation:
[0.192]     line height from line origins: 40.000000
[0.192]     line bounds: origin-y: -8.018555 height: 39.578125
[0.192]     line bounds-no-leading: origin-y: -8.018555 height: 39.578125
[0.192]     bounds metrics: ascent: 31.559570
[0.192]     line metrics: ascent: 31.559570 descent: 8.018555 leading: 0.000000
[0.192]     font metrics: ascent: 31.559570 descent: 8.018555 leading: 0.000000 underline_position: -2.158203
[0.192]     cell_height: 40 baseline: 32 underline_position: 34 strikethrough_position: 20
[0.251] Text fonts:
[0.251]   Normal: Menlo-Regular: /System/Library/Fonts/Menlo.ttc
[0.251]   Bold: Menlo-Bold: /System/Library/Fonts/Menlo.ttc
[0.251]   Italic: Menlo-Italic: /System/Library/Fonts/Menlo.ttc
[0.251]   Bold-Italic: Menlo-BoldItalic: /System/Library/Fonts/Menlo.ttc
kovidgoyal commented 2 months ago

Yes that was a bug. kitty allows only fixed width fonts for its main font. On macOS that restriction was not previously enforced now it is.

liuyinz commented 2 months ago

On macOS that restriction was not previously enforced now it is.

Does it means I must stay at version 0.35.2 forever ?

kovidgoyal commented 2 months ago

Yes, if you want to use non-monospaced fonts as the main font in kitty, then you will have to stay with 0.35.2

moebiusband73 commented 2 months ago

I like Kitty very much and use it on all operating systems. I used it with a monospaced font, but this font is not classified as monospaced on Macos. I did not figure out how this is determined. I added it to the Fixed Width group, but that did not make a difference. At the moment I only have the choice of 5 fonts, and I do not like any of them.

To choose the font you like is a central point in a terminal and in my opinion much more important than an esoteric speed advantage that you probably can measure but not experience anymore. If this stays like that you force me to use another terminal emulator, which is a bummer.

kovidgoyal commented 2 months ago

There are literally hundreds of monospace fonts that are actually monospaced and work with kitty. Pick one. I'm afraid I am not going to gimp kitty to work with non-monospaced fonts.

moebiusband73 commented 2 months ago

I use a monospaced font that is derived from DejaVue Mono: https://github.com/BRUTALISM/Brutalist

I wonder how the font kitten and the Font Book App determine what is a monospaced font and what not. Maybe I can fix it? Btw patched font is not patched font, some of us add icon sets that are not part of the standard Nerdfont collection.

This worked perfectly fine up to now, and performance was very competitive as far as I can tell. I wonder what has changed and why this is necessary?

kovidgoyal commented 2 months ago

On Fri, Sep 06, 2024 at 03:58:01AM -0700, Jan Eitzinger wrote:

I use a monospaced font that is derived from DejaVue Mono: https://github.com/BRUTALISM/Brutalist

I wonder how the font kitten and the Font Book App determine what is a monospaced font and what not. Maybe I can fix it? Btw patched font is not patched font, some of us add icon sets that are not part of the standard Nerdfont collection.

You can load your icon set from any standalone font using symbol_map you dont need to add icons to font files.

This worked perfectly fine up to now, and performance was very competitive as far as I can tell. I wonder what has changed and why this is necessary?

It was a bug that non monospaced fonts were allowed on macOS and no it didnt work perfectly fine, you just didnt happen to notice any issues at your particular font size.

moebiusband73 commented 2 months ago

Dejavu Mono installed via homebrew works fine and I got my icons working using the symbol_map option.

I am still unsure why the Brutalist Mono font that is basically Dejavu Mono is not detected as a monospace font, but I try to figure it out.

moebiusband73 commented 2 months ago

Ok everything works now!

As it turns out this was a bug in the Brutalist Font and the most recent version shows up as a monospaced font. I am very sorry for the noise.

flczcy commented 2 weeks ago

Same problem. However my font is not patched nerd font, but still can not found. The question is LXGW WenKai can not be found in fixed-width collection in font-book, but however it worked quiet well in previous versions of kitty.

f[0.033] Cannot use both macos_titlebar_color and background_opacity
[0.154] The font LXGW WenKai Mono Light was not found, falling back to Menlo
[0.154] The font LXGW WenKai Mono Bold was not found, falling back to Menlo
[0.192] Cell height calculation:
[0.192]   line height from line origins: 40.000000
[0.192]   line bounds: origin-y: -8.018555 height: 39.578125
[0.192]   line bounds-no-leading: origin-y: -8.018555 height: 39.578125
[0.192]   bounds metrics: ascent: 31.559570
[0.192]   line metrics: ascent: 31.559570 descent: 8.018555 leading: 0.000000
[0.192]   font metrics: ascent: 31.559570 descent: 8.018555 leading: 0.000000 underline_position: -2.158203
[0.192]   cell_height: 40 baseline: 32 underline_position: 34 strikethrough_position: 20
[0.251] Text fonts:
[0.251]   Normal: Menlo-Regular: /System/Library/Fonts/Menlo.ttc
[0.251]   Bold: Menlo-Bold: /System/Library/Fonts/Menlo.ttc
[0.251]   Italic: Menlo-Italic: /System/Library/Fonts/Menlo.ttc
[0.251]   Bold-Italic: Menlo-BoldItalic: /System/Library/Fonts/Menlo.ttc

You can use the latest version LXGW WenKai Mono, it is fixed-width and it works in latest kitty.

The latest version: https://github.com/lxgw/LxgwWenKai/releases/tag/v1.501

你可以使用最新版的 LXGW WenKai Mono 字体, 而不是 LXGW WenKai, LXGW WenKai Mono这个是 monospace fonts 字体, 务必使用最新版(1.5)的, 其中 1.3 版本的有问题 最新版下载地址: https://github.com/lxgw/LxgwWenKai/releases/tag/v1.501

调整 post 表中 isFixedPitch 值为 1,以使等宽字体可被 macOS 正确识别;#101 , #150

font_family      family='Operator Mono' style=Book
bold_font        family='Operator Mono Lig' style=Book
italic_font      family='LXGW WenKai Mono'
bold_italic_font family='LXGW WenKai Mono'

kitty --config NONE -o 'font_family LXGW WenKai Mono' --debug-font-fallback

 $ kitty --version                                                             
kitty 0.36.4 created by Kovid Goyal
$ kitty --config NONE -o 'font_family LXGW WenKai Mono' --debug-font-fallback 
[0.930] Cell height calculation:
[0.930]     line height from line origins: 25.000000
[0.930]     line bounds: origin-y: -5.301941 height: 25.717804
[0.930]     line bounds-no-leading: origin-y: -5.301941 height: 25.717804
[0.930]     bounds metrics: ascent: 20.415863
[0.930]     line metrics: ascent: 20.415863 descent: 5.301941 leading: 0.000000
[0.930]     font metrics: ascent: 20.415863 descent: 5.301941 leading: 0.000000 underline_position: -3.850000
[0.930]     cell_height: 25 baseline: 20 underline_position: 24 strikethrough_position: 13
[1.135] Text fonts:
[1.135]   Normal: LXGWWenKaiMono-Regular: /Users/yc/Library/Fonts/LXGWWenKaiMono-Regular.ttf
Features: ()
[1.135]   Bold: LXGWWenKaiMono-Medium: /Users/yc/Library/Fonts/LXGWWenKaiMono-Medium.ttf
Features: ()
[1.135]   Italic: LXGWWenKaiMono-Regular: /Users/yc/Library/Fonts/LXGWWenKaiMono-Regular.ttf
Features: ()
[1.135]   Bold-Italic: LXGWWenKaiMono-Medium: /Users/yc/Library/Fonts/LXGWWenKaiMono-Medium.ttf
Features: ()
2024-10-21 10:39:29.543 kitty[31227:188417] +[IMKClient subclass]: chose IMKClient_Legacy
2024-10-21 10:39:29.589 kitty[31227:188417] +[IMKInputSession subclass]: chose IMKInputSession_Legacy