fonts: improve error message slightly
refs: https://github.com/wez/wezterm/issues/2772
This commit is contained in:
1 file changed
+16
-1
@@ -693,7 +693,7 @@ impl FontShaper for HarfbuzzShaper {
|
||||
fn metrics_for_idx(&self, font_idx: usize, size: f64, dpi: u32) -> anyhow::Result<FontMetrics> {
|
||||
let mut pair = self
|
||||
.load_fallback(font_idx)?
|
||||
.ok_or_else(|| anyhow!("unable to load font idx {}!?", font_idx))?;
|
||||
.ok_or_else(|| anyhow!("metrics_for_idx: there is no font with idx={font_idx}!?"))?;
|
||||
|
||||
let key = MetricsKey {
|
||||
font_idx,
|
||||
@@ -796,6 +796,21 @@ impl FontShaper for HarfbuzzShaper {
|
||||
theoretical_height,
|
||||
selected_size.height
|
||||
);
|
||||
|
||||
if metrics_idx + 1 >= self.handles.len() {
|
||||
log::warn!(
|
||||
"metrics: I wanted to skip idx {} because diff={} factor={} \
|
||||
theoretical_height={} cell_height={}, but there are no more \
|
||||
fallback fonts. Metrics will likely be crazy.",
|
||||
metrics_idx,
|
||||
diff,
|
||||
factor,
|
||||
theoretical_height,
|
||||
selected_size.height
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
metrics_idx += 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user