On Saturday, 8 July 2023 at 19:35:09 GMT+8, Devesh Sharma (M20AIE233) 
<sharma...@iitj.ac.in> wrote:
 
> I reviewed the pygame source and it seems their "freetype" interface is 
> missing harfbuzz objects internally, thus, when pygame-freetype passes 
> requests to FT, the FT-Face do not have valid hb_* object pointers. I am 
> thinking of making a change in pygame interface. Do you think it will fly and 
> doable? 
If you are using Devanagari fonts you have to get harfbuzz involved at some 
stage, either directly or indirectly. There are nicer (python) libraries to use 
like uharbuzz (just search for "harfbuzz python" on github or Google...). That 
said, another shameless plug:
https://github.com/HinTak/harfbuzz-python-demos

The code is a combination of quite low-level freetype and harfbuzz calls - 
basically get harfbuzz to convert from character strings to list of glyphs plus 
positioning offsets, then use freetype to get at the bitmaps, then draw the 
bitmaps at the positions and offsets from harfbuzz. It is not how most people 
who use Indic language to do it (most prefer some higher level libraries) - I 
wrote it mostly to learn about harfbuzz , reusing some of the python code I 
contributed to freetype-py. 
By the way, you can ask freetype-py directly what version of freetype it is 
using. In your case, something like:
    import pygame.freetype
    print(pygame.freetype.version())
would do it.
I just try that on my system (with "import freetype; 
print(freetype.version())", using the system copy of freetype-py rather than 
pygame's). It prints 
(2,13,0)
which is the expected answer. (2.13.1 was out two weeks ago and I haven’t 
upgraded yet).






  

Reply via email to