Implement perceptual gamma / contrast correction for Linux font rendering (#38862)
Part of https://github.com/zed-industries/zed/issues/7992 Port of https://github.com/zed-industries/zed/pull/37167 to Linux When using Blade rendering (Linux platforms and self-compiled builds with the Blade renderer enabled), Zed reads `ZED_FONTS_GAMMA` and `ZED_FONTS_GRAYSCALE_ENHANCED_CONTRAST` environment variables for the values to use for font rendering. `ZED_FONTS_GAMMA` corresponds to [getgamma](https://learn.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwriterenderingparams-getgamma) values. Allowed range [1.0, 2.2], other values are clipped. Default: 1.8 `ZED_FONTS_GRAYSCALE_ENHANCED_CONTRAST` corresponds to [getgrayscaleenhancedcontrast](https://learn.microsoft.com/en-us/windows/win32/api/dwrite_1/nf-dwrite_1-idwriterenderingparams1-getgrayscaleenhancedcontrast) values. Allowed range: [0.0, ..), other values are clipped. Default: 1.0 Screenshots (left is Nightly, right is the new code): * Non-lodpi display With the defaults: <img width="2560" height="1600" alt="image" src="https://github.com/user-attachments/assets/987168b4-3f5f-45a0-a740-9c0e49efbb9c" /> With `env ZED_FONTS_GRAYSCALE_ENHANCED_CONTRAST=7777`: <img width="2560" height="1600" alt="image" src="https://github.com/user-attachments/assets/893bc2c7-9db4-4874-8ef6-3425d079db63" /> Lodpi, default settings: <img width="3830" height="2160" alt="image" src="https://github.com/user-attachments/assets/ec009e00-69b3-4c01-a18c-8286e2015e74" /> Lodpi, font size 7: <img width="3830" height="2160" alt="image" src="https://github.com/user-attachments/assets/f33e3df6-971b-4e18-b425-53d3404b19be" /> Release Notes: - Implement perceptual gamma / contrast correction for Linux font rendering --------- Co-authored-by: localcc <work@localcc.cc>
This commit is contained in:
co-authored by
localcc
parent
f25ace6be0
commit
e72021a26b
@@ -368,3 +368,15 @@ xrandr --dpi 192
|
||||
```
|
||||
|
||||
Replace `192` with your desired DPI value. This affects the system globally and will be used by Zed's automatic RandR detection when `Xft.dpi` is not set.
|
||||
|
||||
### Font rendering parameters
|
||||
|
||||
When using Blade rendering (Linux platforms and self-compiled builds with the Blade renderer enabled), Zed reads `ZED_FONTS_GAMMA` and `ZED_FONTS_GRAYSCALE_ENHANCED_CONTRAST` environment variables for the values to use for font rendering.
|
||||
|
||||
`ZED_FONTS_GAMMA` corresponds to [getgamma](https://learn.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwriterenderingparams-getgamma) values.
|
||||
Allowed range [1.0, 2.2], other values are clipped.
|
||||
Default: 1.8
|
||||
|
||||
`ZED_FONTS_GRAYSCALE_ENHANCED_CONTRAST` corresponds to [getgrayscaleenhancedcontrast](https://learn.microsoft.com/en-us/windows/win32/api/dwrite_1/nf-dwrite_1-idwriterenderingparams1-getgrayscaleenhancedcontrast) values.
|
||||
Allowed range: [0.0, ..), other values are clipped.
|
||||
Default: 1.0
|
||||
|
||||
Reference in New Issue
Block a user