Skip to content

Commit

Permalink
freetype_load_flags now defaults to NO_HINTING
Browse files Browse the repository at this point in the history
  • Loading branch information
wez committed Jan 29, 2024
1 parent 69e0858 commit 616b218
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
8 changes: 7 additions & 1 deletion config/src/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ bitflags! {
// Note that these are strongly coupled with deps/freetype/src/lib.rs,
// but we can't directly reference that from here without making config
// depend on freetype.
#[derive(Default, FromDynamic, ToDynamic)]
#[derive(FromDynamic, ToDynamic)]
#[dynamic(try_from="String", into="String")]
pub struct FreeTypeLoadFlags: u32 {
/// FT_LOAD_DEFAULT
Expand All @@ -271,6 +271,12 @@ bitflags! {
}
}

impl Default for FreeTypeLoadFlags {
fn default() -> Self {
Self::NO_HINTING
}
}

impl From<FreeTypeLoadFlags> for String {
fn from(val: FreeTypeLoadFlags) -> Self {
val.to_string()
Expand Down
5 changes: 4 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ usually the best available version.
As features stabilize some brief notes about them will accumulate here.

#### Changed
* Not yet!
* The default for
[freetype_load_flags](config/lua/config/freetype_load_flags.md) is now
`NO_HINTING`. #4874

#### New
#### Fixed
* macOS: System LastResort font would be taken in preference to other fonts
Expand Down
21 changes: 18 additions & 3 deletions docs/config/lua/config/freetype_load_flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ be combined.
Available flags are:

* `DEFAULT` - This is the default!
* `NO_HINTING` - Disable hinting. This generally generates ‘blurrier’
bitmap glyph when the glyph is rendered in any of the
anti-aliased modes.
* `NO_HINTING` - Disable hinting. The freetype documentation says that this
generally generates ‘blurrier’ bitmap glyph when the glyph is rendered in any of the
anti-aliased modes, but that was written for rasterizing direct to bitmaps.
In the context of wezterm where we are rasterizing to a texture that is then
sampled and applied to a framebuffer through vertices on the GPU, the hinting
process can be counter-productive and result in unexpect visual artifacts.
* `NO_BITMAP` - don't load any pre-rendered bitmap strikes
* `FORCE_AUTOHINT` - Use the freetype auto-hinter rather than the font's
native hinter.
Expand All @@ -30,3 +33,15 @@ Available flags are:
config.freetype_load_flags = 'NO_HINTING|MONOCHROME'
```

{{since('nightly')}}

The default value has changed to `NO_HINTING` as that generally works
more predictably and with fewer surprising artifacts.

In earlier versions, it is recommended that you configure this
explicitly:

```lua
config.freetype_load_flags = 'NO_HINTING'
```

0 comments on commit 616b218

Please sign in to comment.