fonts: fix compilation on win32
This commit is contained in:
1 parent
c312983643
commit
8237dfc8c6
2 files changed
+20
-2
No files matched your search
@@ -57,7 +57,7 @@ fn extract_font_data(font: HFONT, attr: &FontAttributes) -> anyhow::Result<Parse
|
||||
let data = data?;
|
||||
|
||||
let source = FontDataSource::Memory {
|
||||
data: Cow::Owned(data),
|
||||
data: Arc::new(data.into_boxed_slice()),
|
||||
name: attr.family.clone(),
|
||||
};
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ pub enum FontDataSource {
|
||||
},
|
||||
Memory {
|
||||
name: String,
|
||||
data: Arc<[u8]>,
|
||||
data: Arc<Box<[u8]>>,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -176,3 +176,21 @@ impl FontLocator for NopSystemSource {
|
||||
Ok(vec![])
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_memory_datasource() {
|
||||
// This is currently only used on Windows, so make sure
|
||||
// that we have compiler coverage of constructing it on
|
||||
// other systems
|
||||
let data = b"hello".to_vec();
|
||||
let source = FontDataSource::Memory {
|
||||
data: Arc::new(data.into_boxed_slice()),
|
||||
name: "hello!".to_string(),
|
||||
};
|
||||
eprintln!("{:?}", source);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user