-
-
Notifications
You must be signed in to change notification settings - Fork 682
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
Misaligned Glyphs in Berkeley Mono #1502
Comments
Thanks for the report. I can take a look. Btw have you tried this in the standard Apple terminal or text editor? (since I'm probably not going to install ghostty for this) |
I've had this problem in MacVim for as long as I can remember using the Monaco font that ships with macOS (though it does not present with the Menlo font that ships with macOS). Besides misalignment of rounded corners, there is also superfluous vertical spacing between box-drawing characters. Perhaps these issues are related. See below for screenshots comparing the font rendering between various applications. → box-drawing.txt A cursory look at iTerm2, Kitty, and WezTerm shows that they implement custom workarounds to fix these issues:
MacVim · MenloMacVim · MonacoiTerm2 · MonacoKitty · MonacoWezTerm · MonacoApple Terminal · MenloApple Terminal · MonacoApple Terminal · SF MonoTextEdit · MenloTextEdit · Monaco |
Oh right this is the box drawing stuff. I missed that in the original issue report. Just to be clear, this is not really a "bug" per se and it's really a feature request. The misalignment is so because this is just how the font glyphs are defined and the terminals/MacVim that show rendering issues are just drawing the glyphs correctly. The terminals that display it "properly" are just manually overriding how to draw these symbols to match how old terminals used to work. Some fonts just happen to have better definitions for their box drawing characters (e.g. SF Mono) so just drawing the font works. Vim itself had a request for this support for vanilla GVim in vim/vim#11477, where it was rejected by Bram (also see my comments which link to iTerm2/Alacritty discussions about this). I don't fully agree with Bram's reasoning for closing it, as this has since become standard in a lot of modern terminals. I'll play around with this. We will need an option to turn this on or off and there is a design decision whether this should be an upstream GVim option or a MacVim user setting. |
So, I have been playing around with this. The root cause for most issues in box drawing usually really have to do with the improperly designed fonts that have bad hinting for their glyphs, essentially making it a font bug. Unless we are dealing with non-standard line heights, it should be up to the font designer to make them all line up and match properly. In @amadeus's example, the issue here is that the font didn't try to align the different box drawing characters leading to the corner being lower. Unfortunately, ghostty is not open source (but other terminals do have custom box drawing), and the font costs $75 (the trial version only has ASCII and doesn't have box drawing I think) so I don't have an easy way to look at them. For the example by @serban, it's true that Monaco does not draw these characters correctly but it's also a really old font that Apple has phased out a long time ago. The other fonts I tested mostly work fine. Are there other examples of fonts that do not work properly and can be easily obtained/downloaded? My thinking is currently most terminals did add custom box drawing, so adding this is in a way adding feature parity, but philosophically I'm personally not a big fan of custom drawing because you essentially are going around the font design and not using the originally designed shapes for box drawing, and I imagine the original font designer died a little inside every time someone uses this custom feature. Even if I implement custom box drawing it would likely not be a default setting. That said, It's easier if I could see more examples of fonts that don't work properly though, as that would give a little more context as to what exactly is wrong with them. (E.g. if it's a simple alignment issue that can be inferred from the glyph hints, that could be fixed easily) There's still value to implementing custom drawing, if only for variable line heights (that the font cannot really account for), but if it's broken in every popular programmer font the priority would be higher than if it's a couple fonts here and there. |
Steps to reproduce
set guifont=BerkeleyMono-Regular:h16
as your font font link (can probably be repro'd with the existing trialExpected behaviour
Unclear if the issue is because of how fallback fonts apply or if these are embedded glyphs in the font that are being mis-rendered
Version of Vim and architecture
MacVim 9.1, Included Patches: 1-727
Environment
Operating System: macOS Sequoia (15.0)
How MacVim was installed
Built from source
Logs and stack traces
No response
Vim configuration where issue is reproducable
No response
Issue has been tested with given configuration
Issue has been tested with no configuration
mvim --clean
(orgvim
, supplied by MacVim distribution)vim --clean
(in terminal, supplied by MacVim distribution)vim --clean
(in terminal, other suppliers, e.g. /usr/bin/vim)Other conditions
The text was updated successfully, but these errors were encountered: