diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2020-02-20 00:24:50 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-20 00:24:50 +0300 |
commit | 8abca441827788d48de49d3552735cdd0999379e (patch) | |
tree | 24c158088c9806024f3d2608fec580b09a39747c /font/src/ft/mod.rs | |
parent | 933b2e25ff4ecca8e3892c73fa36c35a8f0866b2 (diff) | |
download | alacritty-8abca441827788d48de49d3552735cdd0999379e.tar.gz alacritty-8abca441827788d48de49d3552735cdd0999379e.zip |
Fix discarding of FreeType loading flags
Fixes regression introduced in 6b327b6f8f0f308ff8f46cdf551ce0d0f3eda60b.
Fixes #3355.
Diffstat (limited to 'font/src/ft/mod.rs')
-rw-r--r-- | font/src/ft/mod.rs | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/font/src/ft/mod.rs b/font/src/ft/mod.rs index 35d3d28b..3e43a29f 100644 --- a/font/src/ft/mod.rs +++ b/font/src/ft/mod.rs @@ -241,9 +241,12 @@ impl FreeTypeRasterizer { }, } + pattern.config_substitute(config, fc::MatchKind::Pattern); + pattern.default_substitute(); + // Get font list using pattern. First font is the primary one while the rest are fallbacks - let matched_fonts = fc::font_sort(&config, &mut pattern.clone()) - .ok_or_else(|| Error::MissingFont(desc.to_owned()))?; + let matched_fonts = + fc::font_sort(&config, &pattern).ok_or_else(|| Error::MissingFont(desc.to_owned()))?; let mut matched_fonts = matched_fonts.into_iter(); let primary_font = @@ -288,7 +291,8 @@ impl FreeTypeRasterizer { let list: Vec<FallbackFont> = matched_fonts .map(|fallback_font| { let charset = fallback_font.get_charset().unwrap_or(&empty_charset); - let fallback_font = primary_font.render_prepare(config, fallback_font); + // Use original pattern to preserve loading flags + let fallback_font = pattern.render_prepare(config, fallback_font); let fallback_font_id = FontID::new(hash, fallback_font.hash()); let _ = coverage.merge(&charset); @@ -416,16 +420,7 @@ impl FreeTypeRasterizer { continue; } - // Recreate a pattern - let mut pattern = Pattern::new(); - pattern.add_pixelsize(self.pixel_size as f64); - pattern.add_style(font_pattern.style().next().unwrap_or("Regular")); - pattern.add_family(font_pattern.family().next().unwrap_or("monospace")); - - // Render pattern, otherwise most of its properties wont work - let config = fc::Config::get_current(); - let pattern = pattern.render_prepare(config, font_pattern); - + let pattern = font_pattern.clone(); let key = self.face_from_pattern(&pattern, font_id, None)?.unwrap(); return Ok(key); }, |