You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I'm the author of typst-preview. Recently I'm investigating GPU accelerated 2d vector rendering library and find it surprisingly hard. And vello seems to be the only suitable rust library i've found!
For some background, typst is a new typesetting system (written in rust) which aims to be as powerful as LaTeX but still being lightning fast. And typst-preview is a 3rd party util that compiles and render your typst source code on every keystroke. So the e2e latency is important. Typst can produce pdf/svg/png as output. When exporting to svg, typst compiles every glyph into paths and embed images into svg file using data url. Currently we use the browser to display svg, and we use a VDOM based incremental svg renderer: when updating, we only replace the changed part of the svg DOM tree. However, it still feels laggy when there is a lot of paths in document. Users with lower-end devices also complain that the browser uses too much resource.
I believe a gpu based, native application would have better performance than browser. And I'm trying to render svg produced by typst using vello_svg. Vello renders them pretty well. And the rendering speed is insane!
I just read the code of vello_svg and find it simply renders all paths in svg tree and ignore other things like image or clip-path. There is already a tracking issue for images in #176. I want to know is it hard to implement clip-path? I can offer help if it is not too hard.
The text was updated successfully, but these errors were encountered:
I'm trying to add basic support for clippath on my branch. I don't really understand how push/pop layer works, and currently it looks a little bit broken. Which blend mode should I choose? Could anyone give some clue of how to fix this?
The composition mode should be SrcOver, or just pass Mix::Clip as the blend mode and it should handle that properly. Otherwise, I think your code looks about right. The base path code calls abs_transform() on the path before use… I’m not sure if you need to do the same thing for clip_path.
Hi! I'm the author of typst-preview. Recently I'm investigating GPU accelerated 2d vector rendering library and find it surprisingly hard. And vello seems to be the only suitable rust library i've found!
For some background, typst is a new typesetting system (written in rust) which aims to be as powerful as LaTeX but still being lightning fast. And typst-preview is a 3rd party util that compiles and render your typst source code on every keystroke. So the e2e latency is important. Typst can produce pdf/svg/png as output. When exporting to svg, typst compiles every glyph into paths and embed images into svg file using data url. Currently we use the browser to display svg, and we use a VDOM based incremental svg renderer: when updating, we only replace the changed part of the svg DOM tree. However, it still feels laggy when there is a lot of paths in document. Users with lower-end devices also complain that the browser uses too much resource.
I believe a gpu based, native application would have better performance than browser. And I'm trying to render svg produced by typst using vello_svg. Vello renders them pretty well. And the rendering speed is insane!

I just read the code of
vello_svg
and find it simply renders all paths in svg tree and ignore other things like image or clip-path. There is already a tracking issue for images in #176. I want to know is it hard to implement clip-path? I can offer help if it is not too hard.The text was updated successfully, but these errors were encountered: