render: retain authored webfont identity
This commit is contained in:
1 parent
20be62bca9
commit
1b313ecb49
3 files changed
+271
-62
No files matched your search
@@ -410,6 +410,24 @@ pub fn layout_dom_with_resources(
|
||||
viewport: (f32, f32),
|
||||
intrinsic: &HashMap<NodeId, (f32, f32)>,
|
||||
fonts: &[Vec<u8>],
|
||||
) -> DomLayout {
|
||||
let fonts: Vec<_> = fonts
|
||||
.iter()
|
||||
.map(|data| crate::inline::WebFont {
|
||||
data: data.clone(),
|
||||
family: None,
|
||||
weight: None,
|
||||
italic: None,
|
||||
})
|
||||
.collect();
|
||||
layout_dom_with_web_fonts(tree, viewport, intrinsic, &fonts)
|
||||
}
|
||||
|
||||
pub(crate) fn layout_dom_with_web_fonts(
|
||||
tree: &DomTree,
|
||||
viewport: (f32, f32),
|
||||
intrinsic: &HashMap<NodeId, (f32, f32)>,
|
||||
fonts: &[crate::inline::WebFont],
|
||||
) -> DomLayout {
|
||||
let timing = std::env::var("OBSCURA_RENDER_TIMING").is_ok();
|
||||
|
||||
@@ -467,7 +485,7 @@ pub fn layout_dom_with_resources(
|
||||
let mut taffy_tree: TaffyTree<usize> = TaffyTree::new();
|
||||
let mut id_map: HashMap<taffy::NodeId, NodeId> = HashMap::new();
|
||||
let mut words: HashMap<taffy::NodeId, (NodeId, String)> = HashMap::new();
|
||||
let mut engine = crate::inline::TextEngine::new_with_fonts(fonts);
|
||||
let mut engine = crate::inline::TextEngine::new_with_web_fonts(fonts);
|
||||
let mut ifc_items = IfcRegistry::default();
|
||||
|
||||
// The document node itself is not an element; lay out from the first
|
||||
|
||||
Reference in new issue
Block a user