Shape and render explicit OpenType fonts in native Unicode jobs
This commit is contained in:
1 parent
3caf1eced2
commit
70822cbd94
33 files changed
+1255
-80
No files matched your search
@@ -131,6 +131,13 @@ impl SourceProvider for RecordingHost<'_> {
|
||||
.map_err(Clone::clone)
|
||||
})
|
||||
}
|
||||
fn optional_font_file(&mut self, kind: ResourceKind, name: &str, from: &str) -> Result<Option<LoadedResource>, String> {
|
||||
let (name, from) = (name.to_owned(), from.to_owned());
|
||||
call!(self, optional_font_file(kind, &name, &from); |result| {
|
||||
result.as_ref().map(|resource| resource.as_ref().map(|item| item.version.clone()))
|
||||
.map_err(Clone::clone)
|
||||
})
|
||||
}
|
||||
fn optional_font_map(&mut self, name: &str, from: &str) -> Result<Option<LoadedResource>, String> {
|
||||
let (name, from) = (name.to_owned(), from.to_owned());
|
||||
call!(self, optional_font_map(&name, &from); |result| {
|
||||
|
||||
@@ -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))?;
|
||||
|
||||
Reference in new issue
Block a user