zed icon indicating copy to clipboard operation
zed copied to clipboard

Implement basic font-width support

Open LawnGnome opened this issue 1 year ago • 6 comments

This adds three new settings: buffer_font_width, terminal.font_width, and ui_font_width. They all take a float between 0.5 and 2.0, matching the font-width CSS property (and, more usefully, the way font width is represented in cosmic_text and font-kit).

A nice affordance here would be to support the usual array of string constants in the configuration, but that is probably beyond my knowledge, and definitely beyond what I have time for right now.

This works for me with some fairly minimal testing of Iosevka Extended on Linux (specifically, with the font width set to 1.5), but there are a couple of issues that I suspect would need to be addressed before this was mergeable:

  1. I'm not actually 100% sure I got all the places where font styling is passed through the various components in the editor. The best I can say is that it seems to work.
  2. I've done zero testing of this outside of Linux, mostly because I only use Linux. Given that one of the modified files is in gpui::platform::linux, I'm going to guess that there are changes required to support other platforms.

Anyway, were the above to be addressed, this would fix #14096.


Release Notes:

  • Added buffer_font_width, terminal.font_width, and ui_font_width settings to control the font width in editor buffers, terminal panes, and the UI, respectively. These values can be set to any value between 0.5 and 2.0, with 1.0 representing "normal" font width. Note that fonts that don't support multiple widths will always be rendered in their default width, no matter what these settings are set to.

LawnGnome avatar Aug 20 '24 02:08 LawnGnome

We require contributors to sign our Contributor License Agreement, and we don't have @LawnGnome on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

cla-bot[bot] avatar Aug 20 '24 02:08 cla-bot[bot]

@cla-bot check

LawnGnome avatar Aug 20 '24 02:08 LawnGnome

The cla-bot has been summoned, and re-checked this pull request!

cla-bot[bot] avatar Aug 20 '24 02:08 cla-bot[bot]

matching the font-width CSS property

I'm not seeing any CSS property with this name.

Chrome doesn't know about it either:

Screenshot 2024-08-20 at 1 42 57 PM

maxdeviant avatar Aug 20 '24 17:08 maxdeviant

Sorry, I jumped the gun slightly: it's still font-stretch in current browsers.

LawnGnome avatar Aug 20 '24 17:08 LawnGnome

Sorry, I jumped the gun slightly: it's still font-stretch in current browsers.

Ah, I see. Thanks for the link!

maxdeviant avatar Aug 20 '24 18:08 maxdeviant

Thanks for the PR!

I don't think we're ready to merge this PR at the moment, as it seems there is still some work involved to get it over the finish line.

I think that splitting it into two PRs—one for adding font-width support to GPUI itself, and another for integrating it into Zed—would help with landing it more incrementally.

I'm going to close for now, but feel free to reopen or open a new PR if you decide to pick it up again.

maxdeviant avatar Sep 17 '24 15:09 maxdeviant