diff --git a/config/src/config.rs b/config/src/config.rs index 140a037ef..bd4a8c01f 100644 --- a/config/src/config.rs +++ b/config/src/config.rs @@ -191,6 +191,9 @@ pub struct Config { /// See https://freetype.org/freetype2/docs/subpixel-hinting.html pub freetype_interpreter_version: Option, + #[dynamic(default)] + pub freetype_pcf_long_family_names: bool, + /// Specify the features to enable when using harfbuzz for font shaping. /// There is some light documentation here: /// diff --git a/deps/freetype/build.rs b/deps/freetype/build.rs index 1fbbe42d8..d701272cc 100644 --- a/deps/freetype/build.rs +++ b/deps/freetype/build.rs @@ -147,6 +147,10 @@ fn freetype() { "#define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2", "#define TT_CONFIG_OPTION_SUBPIXEL_HINTING 3", ) + .replace( + "/* #define PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */", + "#define PCF_CONFIG_OPTION_LONG_FAMILY_NAMES", + ) .replace( "/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */", "#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING", diff --git a/wezterm-font/src/ftwrap.rs b/wezterm-font/src/ftwrap.rs index b99e557e0..5590a1ef0 100644 --- a/wezterm-font/src/ftwrap.rs +++ b/wezterm-font/src/ftwrap.rs @@ -860,6 +860,22 @@ impl Library { } } + { + let no_long_names: FT_Bool = if config.freetype_pcf_long_family_names { + 0 + } else { + 1 + }; + unsafe { + FT_Property_Set( + lib.lib, + b"pcf\0" as *const u8 as *const FT_String, + b"no-long-family-names\0" as *const u8 as *const FT_String, + &no_long_names as *const FT_Bool as *const _, + ); + } + } + // Due to patent concerns, the freetype library disables the LCD // filtering feature by default, and since we always build our // own copy of freetype, it is likewise disabled by default for