Resolve named XeTeX fonts through captured resource catalogues
This commit is contained in:
1 parent
a31de14eb2
commit
767c8ffced
10 files changed
+513
-12
No files matched your search
@@ -1563,6 +1563,22 @@ impl SourceProvider for Files {
|
||||
}
|
||||
Ok(resource)
|
||||
}
|
||||
fn named_font(
|
||||
&mut self,
|
||||
name: &str,
|
||||
style: texrra_tex_core::resources::FontStyle,
|
||||
from: &str,
|
||||
) -> Result<Option<texrra_tex_core::resources::NamedFont>, String> {
|
||||
let selected = self.world.read_named_font(name, style, Path::new(from))?;
|
||||
if let Some(font) = &selected {
|
||||
let kind = match font.resource.version.path.extension().and_then(|ext| ext.to_str()) {
|
||||
Some(ext) if ext.eq_ignore_ascii_case("ttf") || ext.eq_ignore_ascii_case("ttc") => ResourceKind::TrueType,
|
||||
_ => ResourceKind::OpenType,
|
||||
};
|
||||
self.observe_resource(kind, &font.resource);
|
||||
}
|
||||
Ok(selected)
|
||||
}
|
||||
fn optional_font_file(&mut self, kind: ResourceKind, name: &str, from: &str) -> Result<Option<LoadedResource>, String> {
|
||||
let resource = self.world.read_optional(kind, name, Path::new(from))?;
|
||||
if let Some(resource) = &resource {
|
||||
|
||||
Reference in new issue
Block a user