mirror of
https://github.com/alacritty/alacritty.git
synced 2024-11-11 13:51:01 -05:00
Switch over to using font_match everywhere.
This commit is contained in:
parent
50f27af643
commit
6ed7d99453
2 changed files with 5 additions and 9 deletions
|
@ -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,
|
||||
|
|
|
@ -140,15 +140,12 @@ 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)?);
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue