Re: Freetype for Python. AttributeError: module 'freetype' has no attribute 'Face'

2023-12-15 Thread Alexei Podtelezhnikov

> 
> Both comments from Alex are wrong...
> 
Yeah, I figured it out 

Re: Freetype for Python. AttributeError: module 'freetype' has no attribute 'Face'

2023-12-15 Thread Hin-Tak Leung
 Both comments from Alex are wrong...
 freetype-py has its own versioning, it is confusing, but 2.4.0 is current: 
https://github.com/rougier/freetype-py/releases  
And has its init hook too: 
https://github.com/rougier/freetype-py/blob/master/freetype/__init__.py
I think that the python load path of the initial poster is wrong. Ie. You are 
not loading freetype-py, but something else which happens to have a 
"freetype.py" file, for example. It could be his own code - if he has a file 
called freetype.py himself, that would be loaded instead of the (system-wide) 
freetype-py package. Quite a common mistake, to have all user code interacting 
with freetype-py in a new file called "freetype.py" (in the current directory), 
or a user file "skia.py" to interact with skia-python, etc.

On Friday, 15 December 2023 at 02:50:03 GMT, Alexei Podtelezhnikov 
 wrote:  
 
 

I have bindings for freetype 2.4.0 for Python. I dont understand why that:

Do you realize that this version is 13 years old? I recently saw a current 
FreeType version in the anaconda environment. Just saying…


AttributeError: module 'freetype' has no attribute 'Face'

is coming from:
import freetypeface = freetype.Face("Vera.ttf")face.set_char_size( 48*64 
)face.load_char('S')bitmap = face.glyph.bitmapprint(bitmap.buffer)


FreeType requires initialization (internal module loading). See if you can find 
some _init_ method that you might need to call first.  

Re: Freetype for Python. AttributeError: module 'freetype' has no attribute 'Face'

2023-12-14 Thread Alexei Podtelezhnikov

> I have bindings for freetype 2.4.0 for Python. I dont understand why that:

Do you realize that this version is 13 years old? I recently saw a current 
FreeType version in the anaconda environment. Just saying…
> 
> AttributeError: module 'freetype' has no attribute 'Face'
> 
> is coming from:
> 
> import freetype
> face = freetype.Face("Vera.ttf")
> face.set_char_size( 48*64 )
> face.load_char('S')
> bitmap = face.glyph.bitmap
> print(bitmap.buffer)
> 
> 
FreeType requires initialization (internal module loading). See if you can find 
some _init_ method that you might need to call first.