mirror of
https://github.com/wez/wezterm.git
synced 2024-11-28 01:06:37 +03:00
fix build on linux
This commit is contained in:
parent
b5a59a18fa
commit
17101b182e
@ -1,17 +1,19 @@
|
|||||||
use crate::config::FontAttributes;
|
use crate::config::FontAttributes;
|
||||||
|
use crate::font::fcwrap;
|
||||||
use crate::font::loader::{FontDataHandle, FontLocator};
|
use crate::font::loader::{FontDataHandle, FontLocator};
|
||||||
use failure::Fallible;
|
use failure::Fallible;
|
||||||
|
use fcwrap::Pattern as FontPattern;
|
||||||
|
|
||||||
/// A FontLocator implemented using the system font loading
|
/// A FontLocator implemented using the system font loading
|
||||||
/// functions provided by font-config
|
/// functions provided by font-config
|
||||||
pub struct FontConfigFontLocator {}
|
pub struct FontConfigFontLocator {}
|
||||||
|
|
||||||
impl FontLocator for FontLoaderFontLocator {
|
impl FontLocator for FontConfigFontLocator {
|
||||||
fn load_fonts(&self, fonts_selection: &[FontAttributes]) -> Fallible<Vec<FontDataHandle>> {
|
fn load_fonts(&self, fonts_selection: &[FontAttributes]) -> Fallible<Vec<FontDataHandle>> {
|
||||||
let mut fonts = vec![];
|
let mut fonts = vec![];
|
||||||
let mut fallback = vec![];
|
let mut fallback = vec![];
|
||||||
|
|
||||||
for attr in style.font_with_fallback() {
|
for attr in fonts_selection {
|
||||||
let mut pattern = FontPattern::new()?;
|
let mut pattern = FontPattern::new()?;
|
||||||
pattern.family(&attr.family)?;
|
pattern.family(&attr.family)?;
|
||||||
if attr.bold {
|
if attr.bold {
|
||||||
@ -45,14 +47,14 @@ impl FontLocator for FontLoaderFontLocator {
|
|||||||
// The additional items in this loop are fallback fonts
|
// The additional items in this loop are fallback fonts
|
||||||
// suggested by fontconfig and are lower precedence
|
// suggested by fontconfig and are lower precedence
|
||||||
if idx == 0 {
|
if idx == 0 {
|
||||||
self.fonts.push(handle);
|
fonts.push(handle);
|
||||||
} else {
|
} else {
|
||||||
self.fallback.push(handle);
|
fallback.push(handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fonts.extend_from_slice(&mut fallback);
|
fonts.append(&mut fallback);
|
||||||
|
|
||||||
Ok(fonts)
|
Ok(fonts)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user