Re: freetype/harfbuzz-based multi-line paragraph layout in skia
Jan Bruns <[email protected]> Fri, 3 Jan 2025 07:50:33 +0100
| Newsgroups | gmane.comp.fonts.freetype.devel |
|---|---|
| Message-ID | <[email protected]> |
Somehow funny to read that mail, beause that's pretty exactly the point [2] where my non-ft-based, dirty, low priority OMA sub-project [1] about typewriting currently hangs (besides of course a lot of more shortcomings, most notable here with gsub processing implementation, again some more topic that comes with a lot of reliance on MS design decisions and their documentation). Luckily, a lot of the topic is unicode specified [3], so there isn't so much "freedom of choice"-burden on first sight (specificly if you treat dependence on harfbuzz fixed). Well, "luckily" assuming unicode is conservative enough about definitions. [1] https://gitlab.com/janbruns/gui4pas/-/tree/main/imgsrc/ttf [2] https://gitlab.com/janbruns/gui4pas/-/blob/main/imgsrc/parapgraphlayouter.pas [3] https://gitlab.com/janbruns/gui4pas/-/blob/main/misc/unicode/paragraphmanager.pas On 14.08.24 21:04, Hin-Tak Leung wrote: > 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.