[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FT2 design question

From: Just van Rossum
Subject: FT2 design question
Date: Fri, 25 Feb 2000 14:19:01 +0100

I'm in the process of designing a clean Python interface to the core FT2
API, and am wondering about the following.

If I understand it correctly, the ability to have multiple instances of
FT_Library is mainly meant for DLL use, so various clients have completely
independant contexts. Are there other reasons?

The reason I ask is that I consider creating *one* global FT_Library
instance in the Python wrapper module: from a Python module's perspective,
it doesn't seem to make sense to be able to have multiple instances of the
FT_Library object.

Doing this means basically that I turn all FT_Library methods into
functions, where the library instance gets passed implicitly.
FT_Init_Freetype() would then be called automatically the first time the
module gets imported ("import freetype"), and would not be accessible
explicitly from Python. I tend to think this simplifies the Python version
of the API without taking away any flexibility.

Another reason why I think this would be the way to do it, is that certain
functions which are now technically methods of the library object (but only
because the use the library's memory manager, like FT_New_Outline and
FT_Done_Outline) would look like global functions from within Python, as
they should. Not only is this slightly easier to use, it is definitely
easier to implement: it makes automatic finalizing the objects (crucial in
Python!) much more straightforward to get right.

Separate Python processes using freetype would still (and automatically!)
get their own instance of the library object, so I don't think any harm is
done in making it implicit.

Any compelling reasons not to do it this way?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]