freetype/harfbuzz-based multi-line paragraph layout in skia
Hin-Tak Leung <[email protected]> Wed, 14 Aug 2024 19:04:58 +0000 (UTC)
| Newsgroups | gmane.comp.fonts.freetype.devel,gmane.comp.freedesktop.harfbuzz,gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
------=_Part_8807200_1578162127.1723662298086 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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. ------=_Part_8807200_1578162127.1723662298086 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div> There was a recent enquiry about the availability of s= kia's skparagraph functionality in skia-python, so I did some digging a= nd added that to the next skia-python release. (m129/130 in about two month= s' time, when skia m130 get forked by google).<br><br>For those who doe= sn't know what it is (that includes me two weeks ago...), skia's sk= paragraph offers multi-line text layout, with a variety of alignment option= s (left/right, centered, justified), and decorations (underline/strikethrou= gh). I guess that functionality is probably somewhat equivalent to pango= 9;s role. Skia's skparagraph is based on freetype/harfbuzz so can mostl= y "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= .<br><br>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 exa= mple program at https://github.com/HinTak/skia-python-examples/blob/main/sh= ape_text.py . Prebuilt python wheels is at https://github.com/kyamagu/skia-= python/actions/runs/10355210169 for the three major platforms, linux, windo= ws, mac os x.<br><br>The quickest way for people to try it out is simply do= wnload 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").<br><br>Note that mo= st of the problems with documentations, and additional functions, neither h= ttps://github.com/kyamagu/skia-python/ nor https://github.com/HinTak/skia-p= ython-examples/ is the correct place: see https://issues.skia.org/358587937= and https://issues.skia.org/307357528 - we basically replicate upstream&#= 39;s API / documentations, so it needs to be in Google's skia repo firs= t.<br><br>Thanks for reading so far. </div> =20 ------=_Part_8807200_1578162127.1723662298086--