File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,5 +14,5 @@ system-fonts = ["usvg/system-fonts", "usvg/memmap-fonts"]
1414[dependencies ]
1515image = { version = " 0.23" , default-features = false , optional = true }
1616miniz_oxide = " 0.4"
17- pdf-writer = { git = " https://github.com/typst/pdf-writer" , rev = " 141aa01 " }
17+ pdf-writer = { git = " https://github.com/typst/pdf-writer" , rev = " e1ec200 " }
1818usvg = { version = " 0.19" , default-features = false }
Original file line number Diff line number Diff line change @@ -251,7 +251,10 @@ pub fn convert_tree(tree: &Tree, options: Options) -> Vec<u8> {
251251/// Convert a [`usvg` tree](Tree) into a Form XObject that can be used as part
252252/// of a larger document.
253253///
254- /// This method is intended for use in an existing [`PdfWriter`] workflow.
254+ /// This method is intended for use in an existing [`PdfWriter`] workflow. It
255+ /// will always return an XObject with the width and height of one printer's
256+ /// point, just like an [`ImageXObject`](pdf_writer::writers::ImageXObject)
257+ /// would.
255258///
256259/// The resulting object can be used by registering a name and the `id` with a
257260/// page's [`/XObject`](pdf_writer::writers::Resources::x_objects) resources
@@ -281,6 +284,15 @@ pub fn convert_tree_into(
281284
282285 let mut xobject = writer. form_xobject ( id, & content) ;
283286 xobject. bbox ( bbox) ;
287+ xobject. matrix ( [
288+ 1.0 / ( bbox. x2 - bbox. x1 ) ,
289+ 0.0 ,
290+ 0.0 ,
291+ 1.0 / ( bbox. y2 - bbox. y1 ) ,
292+ 0.0 ,
293+ 0.0 ,
294+ ] ) ;
295+
284296 let mut resources = xobject. resources ( ) ;
285297 ctx. pop ( & mut resources) ;
286298
You can’t perform that action at this time.
0 commit comments