From f49350fd5bb767ed3b6f076ce562d01b86e8aae0 Mon Sep 17 00:00:00 2001 From: Roman Holovin Date: Wed, 24 Jul 2019 00:21:11 +0300 Subject: [PATCH] Respect fontconfig's embeddedbitmap setting Fixes #2655. --- CHANGELOG.md | 1 + font/src/ft/mod.rs | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac9d857b..c29518ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Debug ref tests are now written to disk regardless of shutdown method - Cursor color setting with escape sequence - Override default bindings with subset terminal mode match +- On Linux, respect fontconfig's `embeddedbitmap` configuration option ## 0.3.3 diff --git a/font/src/ft/mod.rs b/font/src/ft/mod.rs index 6be62562..5388aeb4 100644 --- a/font/src/ft/mod.rs +++ b/font/src/ft/mod.rs @@ -347,9 +347,10 @@ impl FreeTypeRasterizer { let antialias = pat.antialias().next().unwrap_or(true); let hinting = pat.hintstyle().next().unwrap_or(fc::HintStyle::Slight); let rgba = pat.rgba().next().unwrap_or(fc::Rgba::Unknown); + let embedded_bitmaps = pat.embeddedbitmap().next().unwrap_or(true); use freetype::face::LoadFlag; - match (antialias, hinting, rgba) { + let mut flags = match (antialias, hinting, rgba) { (false, fc::HintStyle::None, _) => LoadFlag::NO_HINTING | LoadFlag::MONOCHROME, (false, ..) => LoadFlag::TARGET_MONO | LoadFlag::MONOCHROME, (true, fc::HintStyle::None, _) => LoadFlag::NO_HINTING | LoadFlag::TARGET_NORMAL, @@ -378,7 +379,13 @@ impl FreeTypeRasterizer { // TODO should Medium/Full control whether to use the auto hinter? (true, _, fc::Rgba::Unknown) => LoadFlag::TARGET_NORMAL, (true, _, fc::Rgba::None) => LoadFlag::TARGET_NORMAL, + }; + + if !embedded_bitmaps { + flags |= LoadFlag::NO_BITMAP; } + + flags } fn ft_render_mode(pat: &fc::Pattern) -> freetype::RenderMode {