From 01f50102ab2150a95b1b5517552da080441ddffa Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 21 Dec 2019 17:18:53 -0800 Subject: [PATCH] fonts: suppress error when a font is not found in font_dirs ... and the font locator will use a system locator as a follow up. --- src/font/locator/mod.rs | 2 +- src/font/parser.rs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/font/locator/mod.rs b/src/font/locator/mod.rs index 338d393f8..16ce36a86 100644 --- a/src/font/locator/mod.rs +++ b/src/font/locator/mod.rs @@ -54,7 +54,7 @@ pub trait FontLocator { -> anyhow::Result>; } -#[derive(Debug, Deserialize, Clone, Copy)] +#[derive(Debug, Deserialize, Clone, Copy, PartialEq, Eq)] pub enum FontLocatorSelection { /// Use fontconfig APIs to resolve fonts (!macos, posix systems) FontConfig, diff --git a/src/font/parser.rs b/src/font/parser.rs index d4beed03b..bedad3089 100644 --- a/src/font/parser.rs +++ b/src/font/parser.rs @@ -3,7 +3,7 @@ //! but in the future I'd like to use its shaping functionality #![allow(dead_code)] use crate::config::{Config, FontAttributes}; -use crate::font::locator::FontDataHandle; +use crate::font::locator::{FontDataHandle, FontLocatorSelection}; use crate::font::shaper::{FallbackIdx, FontMetrics, GlyphInfo}; use crate::font::units::*; use allsorts::binary::read::{ReadScope, ReadScopeOwned}; @@ -119,7 +119,8 @@ impl ParsedFont { break; } } - if !found { + if !found && FontLocatorSelection::get_default() != FontLocatorSelection::ConfigDirsOnly + { log::error!("Did not locate a font match for {:?}", attr); } }