Files
macvim-mirror/runtime/doc
Yee Cheng Chin f449e0d0f5 Support native macOS monospace font (SF Mono)
Can now set guifont to `-monospace-` to use the system default monospace
font, which is SF Mono on recent macOS versions (but could be updated to
other fonts in future macOS releases). The reason why this is necessary
instead of specifying the actual font name is that Apple does not expose
the SF Mono font for the user and instead only exposes an AppKit API
`monospacedSystemFontOfSize:weight:` to access it. The actual font name
(`.AppleSystemUIFontMonospaced` in macOS 14) is internal and subject to
change in different OS versions.

In older macOS versions, setting `-monospace-` will just use
`Menlo-Regular` just like the default font.

Also allow specifying the font weight for the font, e.g.
`-monospace-Semibold` / `-monospace-Light`. The list of weights follows
the NSFontWeight enum, but not all values yield unique fonts. E.g.
"UltraLight", "Thin", "Light" will all use the "Light" version of SF
Mono. The list of all font weights can be tab-completed but only if the
user has already filled in `-monospace-` in `:set guifont=`. This helps
prevents showing too many options when the user does tab completion just
to see the list of all fonts.

Note that SF Mono is currently available to be downloaded from Apple's
website as a standalone for testing. That font is mostly the same but
seems to have slightly different line spacing behavior, and when using
bold it uses the "Bold" font variant, whereas the system monospace font
uses "Semibold" variant instead.

Also make font panel not show misc formatting options like underline as
they aren't used by MacVim. Keep the background/foreground option just
so the font preview colors in the panel can be adjusted.

Also fix an existing potential buffer overflow issue in the Core Text
renderer in that `changeFont:` (when setting a new font using font panel
or using font size up/down) isn't setting `wideLen` which could cause an
unsafe memory access in Vim side.

Notes:
- Known issue: When using macaction `fontSizeUp:`/`fontSizeDown:` (Cmd
  +/-), `-monospace-` will get replaced by the internal font name (e.g.
  `.AppleSystemUIFontMonospaced-Regular`) instead due to how the
  `changeFont:` currently works. This could be fixed but it's low enough
  priority that it's ok for now.
- In the future, this may become the default font instead of Menlo, to
  make MacVim more consistent with Apple software like Terminal and
  Xcode.
2023-12-07 20:43:51 -05:00
..
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-09-27 17:30:34 +01:00
2023-04-22 22:40:14 +01:00
2022-06-28 13:44:46 +01:00
2023-04-22 22:40:14 +01:00
2022-06-28 13:44:46 +01:00
2023-02-02 13:59:48 +00:00
2023-02-02 13:59:48 +00:00
2021-06-27 15:18:56 +02:00
2022-02-26 12:25:45 +00:00
2022-07-25 15:42:07 +01:00
2023-02-20 20:44:55 +00:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2023-09-09 11:31:38 +02:00
2023-06-10 21:40:39 +01:00
2022-06-28 13:44:46 +01:00
2022-09-18 13:04:22 +01:00
2023-02-20 20:44:55 +00:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-11-23 23:46:31 +00:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-12-06 18:20:10 +00:00
2023-02-20 20:44:55 +00:00
2023-05-14 18:50:25 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-11-09 21:21:04 +00:00
2022-06-28 13:44:46 +01:00
2023-02-20 20:44:55 +00:00
2022-06-28 13:44:46 +01:00
2023-04-22 22:40:14 +01:00
2023-10-02 21:47:13 +02:00
2022-10-16 13:11:12 +01:00
2022-06-28 13:44:46 +01:00
2023-02-27 15:49:53 +00:00
2023-06-10 21:40:39 +01:00
2023-02-20 20:44:55 +00:00
2023-09-11 20:23:11 +02:00
2023-08-10 06:19:18 +02:00
2023-02-20 20:44:55 +00:00
2023-04-22 22:40:14 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-11-23 23:46:31 +00:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2023-02-20 20:44:55 +00:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-10-16 13:11:12 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-11-09 21:21:04 +00:00
2022-06-28 13:44:46 +01:00
2023-02-20 20:44:55 +00:00
2022-06-28 13:44:46 +01:00
2022-02-20 19:48:20 +00:00
2022-01-16 14:46:06 +00:00
2021-06-13 19:02:49 +02:00
2021-06-13 19:02:49 +02:00
2023-04-22 22:40:14 +01:00
2023-04-22 22:40:14 +01:00
2023-09-09 11:31:38 +02:00
2022-06-28 13:44:46 +01:00