sile-typesetter / sile

The SILE Typesetter — Simon’s Improved Layout Engine
https://sile-typesetter.org
MIT License
1.67k stars 98 forks source link

Target Skia Canvas as backend #553

Open buckle2000 opened 5 years ago

buckle2000 commented 5 years ago

Skia Canvas comes with raster, SVG and PDF support. It can also target OpenGL or Vulkan to render in real-time. In fact, Flutter uses Skia as its backend.

Here is an example of rendering canvases to PDF: https://skia.org/user/sample/pdf

I think Sile would benefit from using Skia as its backend. It is trivial to create a Sile reader (like PDF reader) if it targets Skia.

simoncozens commented 5 years ago

Sounds interesting! And it does look like I can avoid the problem I've often had with external output libraries which is that, because our shaping is done by Harfbuzz, we want to output our text using the font's glyph IDs. Some of the examples in SkPaint and SkTextBlob suggest we can feed it an array of glyph IDs. Definitely one to investigate, but I'm not really sure of any direct benefit...

alerque commented 4 years ago

See https://github.com/justvanrossum/drawbot-skia/pull/4

One ‘crazy’ idea is that I think it would be possible to build SILE as a Rust library. This would bundle everything including a Lua interpreter and all the SILE sources into a single module, then expose the Lua global SILE module as an API interface to Rust.

A Rust module might sound out of scope to work as a layout engine for a Python/Skia implementation of Drawbot, but Rust libraries can be compiled into native Python modules. This would expose the typesetter API to a Python app, and if Skia was a backend, allow it to draw content including shaping and layout out onto a Skia canvas.

Have I had too much coffee today?