diff options
author | 2019-11-13 03:54:36 +0100 | |
---|---|---|
committer | 2019-11-13 03:54:36 +0100 | |
commit | f0b1e65ba4f8df173f8201585a1d81245e93ab94 (patch) | |
tree | 1e03a138846adc20ba072079e15f3454106ad2ec /wgpu/src/font.rs | |
parent | 73f3c900071f950ea914652ca3f0002c1e173f61 (diff) | |
download | iced-f0b1e65ba4f8df173f8201585a1d81245e93ab94.tar.gz iced-f0b1e65ba4f8df173f8201585a1d81245e93ab94.tar.bz2 iced-f0b1e65ba4f8df173f8201585a1d81245e93ab94.zip |
Move text logic in `iced_wgpu` to a `text` module
Diffstat (limited to 'wgpu/src/font.rs')
-rw-r--r-- | wgpu/src/font.rs | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/wgpu/src/font.rs b/wgpu/src/font.rs deleted file mode 100644 index 31df5bf4..00000000 --- a/wgpu/src/font.rs +++ /dev/null @@ -1,36 +0,0 @@ -pub use font_kit::error::SelectionError as LoadError; -pub use font_kit::family_name::FamilyName as Family; - -pub struct Source { - raw: font_kit::source::SystemSource, -} - -impl Source { - pub fn new() -> Self { - Source { - raw: font_kit::source::SystemSource::new(), - } - } - - pub fn load(&self, families: &[Family]) -> Result<Vec<u8>, LoadError> { - let font = self.raw.select_best_match( - families, - &font_kit::properties::Properties::default(), - )?; - - match font { - font_kit::handle::Handle::Path { path, .. } => { - use std::io::Read; - - let mut buf = Vec::new(); - let mut reader = std::fs::File::open(path).expect("Read font"); - let _ = reader.read_to_end(&mut buf); - - Ok(buf) - } - font_kit::handle::Handle::Memory { bytes, .. } => { - Ok(bytes.as_ref().clone()) - } - } - } -} |