Repository navigation
MacVim won't set the font Cascadia Mono with the typeface Light via the Fonts dialogue #1208
Description
Describe the bug
MacVim won't set the font Cascadia Mono with the typeface Light via the Fonts picker, but can set it via set guifont.
To Reproduce
- Install Cascadia Code fonts from here
- In MacVim, do
:set guifont=*, then selectCascadia Monowith typefaceLight - The font will not change
:set guifontwill verify the font doesn't change
It seems like MacVim is trying to use the name CascadiaMono-Regular_Light:h12 as the font name. But manually doing :set guifont=CascadiaMono-Regular_Light:h12 results in a "font missing" error.
:set guifont=Cascadia\ Mono\ Light:h12 will set the font correctly.
Expected behavior
I expected the font to change when clicking the font in the dialogue.
Screenshots
I made a video demonstration of the bug here.
Environment (please complete the following information):
$ vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Apr 1 2021 08:37:51)
macOS version - x86_64
Included patches: 1-2681
Compiled by GitHub Actions
Huge version with MacVim GUI. Features included (+) or not (-):
+acl +file_in_path -mouse_sysmouse -tag_old_static
+arabic +find_in_path +mouse_urxvt -tag_any_white
+autocmd +float +mouse_xterm -tcl
+autochdir +folding +multi_byte +termguicolors
-autoservername -footer +multi_lang +terminal
+balloon_eval +fork() -mzscheme +terminfo
+balloon_eval_term +fullscreen +netbeans_intg +termresponse
+browse +gettext +num64 +textobjects
++builtin_terms -hangul_input +odbeditor +textprop
+byte_offset +iconv +packages +timers
+channel +insert_expand +path_extra +title
+cindent +ipv6 +perl/dyn +toolbar
+clientserver +job +persistent_undo +transparency
+clipboard +jumplist +popupwin +user_commands
+cmdline_compl +keymap +postscript +vartabs
+cmdline_hist +lambda +printer +vertsplit
+cmdline_info +langmap +profile +virtualedit
+comments +libcall +python/dyn +visual
+conceal +linebreak +python3/dyn +visualextra
+cryptv +lispindent +quickfix +viminfo
+cscope +listcmds +reltime +vreplace
+cursorbind +localmap +rightleft +wildignore
+cursorshape +lua/dyn +ruby/dyn +wildmenu
+dialog_con_gui +menu +scrollbind +windows
+diff +mksession +signs +writebackup
+digraphs +modify_fname +smartindent -X11
+dnd +mouse -sound -xfontset
-ebcdic +mouseshape +spell +xim
+emacs_tags +mouse_dec +startuptime -xpm
+eval -mouse_gpm +statusline -xsmp
+ex_extra -mouse_jsbterm -sun_workshop -xterm_clipboard
+extra_search +mouse_netterm +syntax -xterm_save
-farsi +mouse_sgr +tag_binary
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
defaults file: "$VIMRUNTIME/defaults.vim"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe -DMACOS_X -DMACOS_X_DARWIN -g -O2 -arch x86_64 -arch arm64 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -Wall -Wextra -Wshadow -Werror -Wno-error=missing-field-initializers -Wno-error=deprecated-declarations -Wno-error=unused-function
Linking: clang -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/readline/lib -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/readline/lib -arch x86_64 -arch arm64 -L/usr/local/lib -o Vim -lm -lncurses -liconv /usr/local/lib/libintl.a -framework AppKit -fstack-protector -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE
Additional context
I tried adding some print statements in the MacVim source to see if I could figure out the issue, but I didn't get far. I don't understand how the font name is determined, or how MacVim matches that up with fonts available on the system. Sorry I can't be more help. 🙇🏻♂️
Activity
eirnym commentedon Sep 18, 2021
Fun fact about this font: microsoft/terminal#9375
eirnym commentedon Sep 18, 2021
I suspect it's not marked as monospaced or has issues and need some additional settings to be selected properly.
eirnym commentedon Sep 18, 2021
Spaces are crucial for font selection
tenderlove commentedon Sep 18, 2021
Does a font need to be marked as monospaced? I'm able to select things like "Times New Roman" from the font picker, and it seems to work fine. AFAICT, whatever data is sent to MacVim via the font picker isn't what we need (or isn't being manipulated correctly) to look up the font.
I've found that when I pick a font from the selector,
handleSetFontgets called with the stringCascadiaMono-Regular_Light. I don't know how the string gets generated, so I don't know whether or not that is the correct string for the particular font.I guess this string is being put in to the
inputQueue, but I'm not sure how.tenderlove commentedon Sep 18, 2021
Ok, so the string is getting in to the queue via
[MMBackend processInput:data:], which I guess is getting that string from CoreFoundation:This is very odd.
tenderlove commentedon Sep 18, 2021
I should have read the README in
src/MacVim😅This stack trace is telling me that the front end MacVim process is sending that string to the backend Vim process. So I need to find the place in the front end process that's getting this string.
poige commentedon Sep 15, 2025
Awesome findings, but yeah, ping from 2025 — it's 4 years later and stil-lllllllllll.
ychin commentedon Sep 15, 2025
I don't know why I missed this when it was first posted. Yes, fonts for regular guifont is supposed to be monospaced, but they would still work if you just set it.
This issue is kind of old now so I don't know if this is still an issue. @poige are you seeing this issue? What about @tenderlove?
Also, these days MacVim has auto-complete for
guifont. As long as the font is monospaced the font will be included in that auto-completed list and it would work.I can look into why the font picker doesn't work.
poige commentedon Sep 16, 2025
Yes, the issue still persists — otherwise I wouldn't be digging through a 4-year-old report. Not really my idea of weekend reading. )
tenderlove commentedon Sep 22, 2025
I totally forgot about this issue 😅
It seems like this has actually regressed further. I still cannot select the font via the GUI, but now I also can't do it via the
:setcommand like in my original post.tenderlove commentedon Sep 22, 2025
Sorry, this isn't true (I had installed the fonts incorrectly). I'm able to choose the font from the GUI correctly now, so it seems like this issue is fixed.
I'm using this version now:
@poige what version are you using?
poige commentedon Sep 23, 2025
actually just the same as you are!
Meh, I even didn't know that it was ever possible to install fonts on macos incorrectly — I can easily use all variations of Cascadia Code with, say, iTerm2, but only "regular" one with macvim, otherwise it's failing:
E596: Invalid font(s): guifont=CascadiaCode-Regular_Light, although this is exactly the name it auto-completes to when usingset guifont=Cascadiastub.ychin commentedon Sep 23, 2025
Seems like a font name parsing issue, as somewhere along the line mishandles the dash and underscore. I can take a look. Or I will just blame Microsoft since this is macOS software :)
Allow underscores in guifont PostScript names
Allow underscores in guifont PostScript names
ychin commentedon Sep 24, 2025
Will be fixed in #1600 and released in the upcoming release which should be soon.