diff options
author | Harlan Lieberman-Berg <hlieberman@setec.io> | 2017-02-27 21:49:00 -0500 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2017-03-01 22:07:14 -0800 |
commit | 6ed7d99453c03dc5c739018cd0c7b880cf55ea75 (patch) | |
tree | d012272f3d383b8d1c39a6073740d417cd6d7d36 | |
parent | 50f27af643f6edd5c0820c49bf09122afe018763 (diff) | |
download | alacritty-6ed7d99453c03dc5c739018cd0c7b880cf55ea75.tar.gz alacritty-6ed7d99453c03dc5c739018cd0c7b880cf55ea75.zip |
Switch over to using font_match everywhere.
-rw-r--r-- | font/src/ft/list_fonts.rs | 2 | ||||
-rw-r--r-- | font/src/ft/mod.rs | 12 |
2 files changed, 5 insertions, 9 deletions
diff --git a/font/src/ft/list_fonts.rs b/font/src/ft/list_fonts.rs index 0789bbd6..fdadea82 100644 --- a/font/src/ft/list_fonts.rs +++ b/font/src/ft/list_fonts.rs @@ -63,7 +63,6 @@ pub mod fc { } /// Find the font closest matching the provided pattern. - #[allow(dead_code)] pub fn font_match( config: &ConfigRef, pattern: &mut PatternRef, @@ -90,6 +89,7 @@ pub mod fc { } /// list fonts by closeness to the pattern + #[allow(dead_code)] pub fn font_sort( config: &ConfigRef, pattern: &mut PatternRef, diff --git a/font/src/ft/mod.rs b/font/src/ft/mod.rs index 20dfd2ce..d6585265 100644 --- a/font/src/ft/mod.rs +++ b/font/src/ft/mod.rs @@ -140,14 +140,11 @@ impl FreeTypeRasterizer { pattern.set_weight(weight.into_fontconfig_type()); pattern.set_slant(slant.into_fontconfig_type()); - let fonts = fc::font_sort(fc::Config::get_current(), &mut pattern) + let font = fc::font_match(fc::Config::get_current(), &mut pattern) .ok_or_else(|| Error::MissingFont(desc.to_owned()))?; - // Take first font that has a path - for font in &fonts { - if let (Some(path), Some(index)) = (font.file(0), font.index(0)) { - return Ok(self.library.new_face(path, index)?); - } + if let (Some(path), Some(index)) = (font.file(0), font.index(0)) { + return Ok(self.library.new_face(path, index)?); } Err(Error::MissingFont(desc.to_owned())) @@ -167,9 +164,8 @@ impl FreeTypeRasterizer { if let (Some(path), Some(index)) = (font.file(0), font.index(0)) { println!("got font path={:?}", path); return Ok(self.library.new_face(path, index)?); - } else { - Err(Error::MissingFont(desc.to_owned())) } + Err(Error::MissingFont(desc.to_owned())) } fn get_rendered_glyph(&mut self, glyph_key: &GlyphKey, have_recursed: bool) |