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
changed the title [-]How to render stacked Tibetan font with ImageFont, and ImageDraw [/-][+]How to render stacked Tibetan letters with ImageFont, and ImageDraw [/+]on Jun 9, 2017
@wiredfool with libraqm compiled and installed, and pip installed Fahad-Alsaidi/Pillow@CTL branch, do I need to alter anything to solve this issue? It seems that the letters still don't stack.
If that's the case, then there are 3 possibilities:
The CTL branch didn't actually compile correctly and the feature isn't available. One issue with that PR is that the feature reporting is incorrect. I've got a fix, and another PR that it relied on is merged, so it's time to get back to that and push it off my machine. It's possible that you have raqm installed, but Pillow couldn't find harfbuzz or fribdi.
The CTL branch is supposed to handle this case, and doesn't do it correctly.
It's a separate issue. From a quick google, it does appear that harfbuzz is supposed to to Tibetan script, so I'm going to count this as unlikely.
So, I've got a branch where I'm testing out the complex text layout PR (#2576) and using the following script, I've got something that appears to match what I'm seeing in the browser and libreoffice on Ubuntu 16.04. This is using the font package 'fonts-tibetan-machine', and displaying the whole thing as one string rather than individual glyphs in matplotlib.
To my eye, it looks correct, but I'm not an expert by any means.
[edit] Now this is strange, it appears to just work without the complex text support as well, on my old 12.04 instance which doesn't have the pre-requisites for raqm. So maybe it's a font thing?
Thanks @hugovk and @wiredfool It seems that fonts are handled with some preference. To notice although some of them are stacked, they are not rendered properly. Kokonor and Kailasa are default on macOS, and rendered all right when typed as texts.
I've checked this with the mac fonts on an Ubuntu 16.04 machine, and it's the font, not the freetype version. So there's something different in the fonts.
@Fahad-Alsaidi Can you take a look at this and see if raqm + harfbuzz is properly parsing this as Tibetan and enabling the appropriate script options? If not, is there a way to override any detected script and pass in Tibetan, either as a feature or otherwise? (i.e., I'm seeing 'TIB ' and 'Tibt' in the harfbuzz source, but neither seem to affect the rendering)
Mac system fonts are likely to be AAT not OpenType fonts, so they will not work on Windows or Linux correctly. On Mac AAT fonts should work if HarfBuzz is compiled with Core Text support.
changed the title [-]How to render stacked Tibetan letters with ImageFont, and ImageDraw [/-][+]How to render stacked Tibetan letters[/+]on Oct 7, 2019
Activity
[-]How to render stacked Tibetan font with ImageFont, and ImageDraw [/-][+]How to render stacked Tibetan letters with ImageFont, and ImageDraw [/+]wiredfool commentedon Jun 9, 2017
I suspect it's the same underlying issue that's fixed in #2284.
serser commentedon Jun 10, 2017
@wiredfool with
libraqmcompiled and installed, and pip installedFahad-Alsaidi/Pillow@CTLbranch, do I need to alter anything to solve this issue? It seems that the letters still don't stack.wiredfool commentedon Jun 12, 2017
If that's the case, then there are 3 possibilities:
wiredfool commentedon Jun 13, 2017
So, I've got a branch where I'm testing out the complex text layout PR (#2576) and using the following script, I've got something that appears to match what I'm seeing in the browser and libreoffice on Ubuntu 16.04. This is using the font package 'fonts-tibetan-machine', and displaying the whole thing as one string rather than individual glyphs in matplotlib.
To my eye, it looks correct, but I'm not an expert by any means.
[edit] Now this is strange, it appears to just work without the complex text support as well, on my old 12.04 instance which doesn't have the pre-requisites for raqm. So maybe it's a font thing?
hugovk commentedon Jun 14, 2017
I get this on master (Python 2.7.13, macOS, with no RAQM pre-requisites):
And this on wiredfool/pr_2284:
wiredfool commentedon Jun 14, 2017
Is the top one a cropping issue, or is it a rendering thing?
hugovk commentedon Jun 14, 2017
Looks like rendering. With 640px width:
Highlighting for emphasis:

wiredfool commentedon Jun 14, 2017
That's odd. Wonder if it's a freetype version issue, or if it's a font thing. It looks like you have the same font, so that's not likely to be it.
hugovk commentedon Jun 14, 2017
I used this font: https://github.com/cscott/mw-ocg-latexer/blob/master/fonts/tibetan-machine/TibetanMachineUni.ttf
wiredfool commentedon Jun 14, 2017
Freetype version?
hugovk commentedon Jun 14, 2017
Freetype 2.7.1:
/usr/local/Cellar/freetype/2.7.1wiredfool commentedon Jun 14, 2017
12.04:
16.04:
Hmm.
serser commentedon Jun 14, 2017
Thanks @hugovk and @wiredfool It seems that fonts are handled with some preference. To notice although some of them are stacked, they are not rendered properly.
KokonorandKailasaare default on macOS, and rendered all right when typed as texts.wiredfool commentedon Jun 16, 2017
I've checked this with the mac fonts on an Ubuntu 16.04 machine, and it's the font, not the freetype version. So there's something different in the fonts.
wiredfool commentedon Jun 16, 2017
@Fahad-Alsaidi Can you take a look at this and see if raqm + harfbuzz is properly parsing this as Tibetan and enabling the appropriate script options? If not, is there a way to override any detected script and pass in Tibetan, either as a feature or otherwise? (i.e., I'm seeing 'TIB ' and 'Tibt' in the harfbuzz source, but neither seem to affect the rendering)
Fahad-Alsaidi commentedon Jun 16, 2017
well, have you tried this raqm_set_language (). I think this isn't implemented yet in the original PR.
khaledhosny commentedon Jun 16, 2017
Mac system fonts are likely to be AAT not OpenType fonts, so they will not work on Windows or Linux correctly. On Mac AAT fonts should work if HarfBuzz is compiled with Core Text support.
[-]How to render stacked Tibetan letters with ImageFont, and ImageDraw [/-][+]How to render stacked Tibetan letters[/+]radarhere commentedon Oct 7, 2019
raqm_set_languagewas added in Pillow 6.0.0 - https://pillow.readthedocs.io/en/stable/releasenotes/6.0.0.html#new-language-parameterAttempt-Q commentedon Dec 15, 2021
Has the problem been solved, can anyone help me?
radarhere commentedon Feb 10, 2022
#2576 was merged, which included #2284. Testing with a font downloaded from the web, the raqm support added there resolves this.
Current Pillow without raqm.







Current Pillow with raqm.







I've also tested this with our CI jobs to confirm that it passes on Linux, macOS and Windows.