1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-23 15:04:36 +03:00

fonts: adjust error diagnostics

This commit is contained in:
Wez Furlong 2021-04-09 22:17:08 -07:00
parent 438b7540ba
commit f9bdd2502a
2 changed files with 9 additions and 5 deletions

View File

@ -518,9 +518,10 @@ impl Library {
}
let face = match &source.source {
FontDataSource::OnDisk(path) => self.new_face(path.to_str().unwrap(), index as _)?,
FontDataSource::Memory { data, .. } => self.new_face_from_slice(&data, index as _)?,
};
FontDataSource::OnDisk(path) => self.new_face(path.to_str().unwrap(), index as _),
FontDataSource::Memory { data, .. } => self.new_face_from_slice(&data, index as _),
}
.with_context(|| format!("face_from_locator({:?})", handle))?;
Ok(Face {
face,
@ -548,7 +549,7 @@ impl Library {
};
return ft_result(res, face).with_context(|| {
format!(
"FT_New_Face for {} index {}",
"FT_New_Face(\"{}\", face_index={})",
path.as_ref().display(),
face_index
)
@ -578,7 +579,8 @@ impl Library {
&mut face as *mut _,
)
};
ft_result(res, face).with_context(|| format!("FT_New_Memory_Face for index {}", face_index))
ft_result(res, face)
.with_context(|| format!("FT_New_Memory_Face(<data>, face_index={})", face_index))
}
pub fn set_lcd_filter(&mut self, filter: FT_LcdFilter) -> anyhow::Result<()> {

View File

@ -89,7 +89,9 @@ impl FontLocator for CoreTextFontLocator {
for attr in fonts_selection {
if let Ok(descriptor) = descriptor_from_attr(attr) {
let handles = handles_from_descriptor(&descriptor);
log::trace!("core text matched {:?} to {:#?}", attr, handles);
if let Some(parsed) = ParsedFont::best_match(attr, handles) {
log::trace!("best match from core text is {:?}", parsed);
fonts.push(parsed);
loaded.insert(attr.clone());
}