font: add freetype_interpreter_version configuration option
This defaults to None, taking the default from the freetype library. You can select an integer value to tell the library to use an alternative version. Versions that are available in the build used by wezterm are 35, 38 and 40. See https://freetype.org/freetype2/docs/subpixel-hinting.html for more information.
This commit is contained in:
1 parent
80214319ae
commit
979368c4eb
2 files changed
+17
-8
No files matched your search
@@ -558,6 +558,12 @@ pub struct Config {
|
||||
#[serde(default)]
|
||||
pub font_antialias: FontAntiAliasing,
|
||||
|
||||
/// Selects the freetype interpret version to use.
|
||||
/// Likely values are 35, 38 and 40 which have different
|
||||
/// characteristics with respective to subpixel hinting.
|
||||
/// See https://freetype.org/freetype2/docs/subpixel-hinting.html
|
||||
pub freetype_interpreter_version: Option<u32>,
|
||||
|
||||
/// Specify the features to enable when using harfbuzz for font shaping.
|
||||
/// There is some light documentation here:
|
||||
/// <https://harfbuzz.github.io/shaping-opentype-features.html>
|
||||
|
||||
@@ -245,14 +245,17 @@ impl Library {
|
||||
let lib = ft_result(res, lib).context("FT_Init_FreeType")?;
|
||||
let mut lib = Library { lib };
|
||||
|
||||
let interpreter_version: FT_UInt = 38;
|
||||
unsafe {
|
||||
FT_Property_Set(
|
||||
lib.lib,
|
||||
b"truetype\0" as *const u8 as *const FT_String,
|
||||
b"interpreter-version\0" as *const u8 as *const FT_String,
|
||||
&interpreter_version as *const FT_UInt as *const _,
|
||||
);
|
||||
let config = configuration();
|
||||
if let Some(vers) = config.freetype_interpreter_version {
|
||||
let interpreter_version: FT_UInt = vers;
|
||||
unsafe {
|
||||
FT_Property_Set(
|
||||
lib.lib,
|
||||
b"truetype\0" as *const u8 as *const FT_String,
|
||||
b"interpreter-version\0" as *const u8 as *const FT_String,
|
||||
&interpreter_version as *const FT_UInt as *const _,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Due to patent concerns, the freetype library disables the LCD
|
||||
|
||||
Reference in new issue
Block a user