There was a recent enquiry about the availability of skia's skparagraph 
functionality in skia-python, so I did some digging and added that to the next 
skia-python release. (m129/130 in about two months' time, when skia m130 get 
forked by google).

For those who doesn't know what it is (that includes me two weeks ago...), 
skia's skparagraph offers multi-line text layout, with a variety of alignment 
options (left/right, centered, justified), and decorations 
(underline/strikethrough). I guess that functionality is probably somewhat 
equivalent to pango's role. Skia's skparagraph is based on freetype/harfbuzz so 
can mostly "do the right thing" with the middle-eastern languages on 
line-breaks, etc. Have a try with Arabic / Hebrew etc if you feel like it. I 
did.

This is mostly a RFC / request for testers etc. The main info and source code 
is at https://github.com/kyamagu/skia-python/pull/258 , and example program at 
https://github.com/HinTak/skia-python-examples/blob/main/shape_text.py . 
Prebuilt python wheels is at 
https://github.com/kyamagu/skia-python/actions/runs/10355210169 for the three 
major platforms, linux, windows, mac os x.

The quickest way for people to try it out is simply download one of the 
relevant wheels, install it, and play with the example. (edit it with your own 
text for rendering, setting various options, then run "shape_text.py 
chosen-font.ttf output.png").

Note that most of the problems with documentations, and additional functions, 
neither https://github.com/kyamagu/skia-python/ nor 
https://github.com/HinTak/skia-python-examples/ is the correct place: see 
https://issues.skia.org/358587937 and https://issues.skia.org/307357528 - we 
basically replicate upstream's API / documentations, so it needs to be in 
Google's skia repo first.

Thanks for reading so far.  

Reply via email to