Shape and render explicit OpenType fonts in native Unicode jobs

This commit is contained in:
gloamxun committed 2026-11-21 10:35:03 +08:00
1 parent 3caf1eced2
commit 70822cbd94
33 files changed
+1255 -80

No files matched your search

+14
View File
@@ -786,6 +786,13 @@ impl Files {
json!({"x": x, "y": y, "size": size, "slot": slot, "font": font.name}),
);
}
DisplayItem::OpenTypeGlyph { x, y, size, glyph, text, font, .. } => {
paint_order.push(json!(["glyph", glyphs.len()]));
glyphs.push(json!({
"x": x, "y": y, "size": size, "glyph": glyph,
"font": font.name, "text": text, "resource": font.resource.version,
}));
}
DisplayItem::Rule {
x,
y,
@@ -1553,6 +1560,13 @@ impl SourceProvider for Files {
}
Ok(resource)
}
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 {
self.observe_resource(kind, resource);
}
Ok(resource)
}
fn optional_font_map(&mut self, name: &str, from: &str) -> Result<Option<LoadedResource>, String> {
let kind = ResourceKind::Map;
let resource = self.world.read_optional(kind, name, Path::new(from))?;