servo / pathfinder

A fast, practical GPU rasterizer for fonts and vector graphics
Apache License 2.0
3.52k stars 198 forks source link

Export as pdf #538

Open JustFrederik opened 1 year ago

JustFrederik commented 1 year ago

I tried to export some text as a pdf, but i doent look right. Code That are the imports:

[dependencies]
pathfinder_canvas = { version="0.5", features=["pf-text"] }
pathfinder_geometry = "0.5.1"
pathfinder_content = "0.5"
pathfinder_renderer = "0.5"
pathfinder_export = {commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder"}

[patch.crates-io]
pathfinder_geometry = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_canvas = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_renderer = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_content = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_simd = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_gl = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_webgl = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_gpu = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_resources = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_color = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_lottie = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_magicleap_demo = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_ui = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_svg = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_metal = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_swf = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_text = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_web_canvas = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }

And this is the resut for the pdf(the svg is fine): foo.pdf

s3bk commented 1 year ago

That does indeed look wrong.

Possible causes:

Try exporting a SVG with the same settings and see if that has the same problem.

JustFrederik commented 1 year ago

I tried it with another font. The xy coordinates arent flipped and even if it wouldnt stretch the fonts, because the coordiantes only set the start position. The svg is mostly fine. The stroke has some wheird trianges, but it renders normally: foo

So the exporter is most likly the problem