[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ft-devel] Position Independent Port of FreeType2
From: |
Mickey Gabel |
Subject: |
[ft-devel] Position Independent Port of FreeType2 |
Date: |
Tue, 20 Jan 2009 15:31:59 +0200 |
User-agent: |
Thunderbird 2.0.0.19 (Windows/20081209) |
Hello,
In our company we are building a text rendering library for our client,
based of FT2 (which is awesome), using a custom configuration. One of
the target platforms may be the BREW platform
( http://en.wikipedia.org/wiki/BREW ) using ARM's ADS and RVCT compilers.
From initial experiments, it seems that there are some issues when
porting FT2 to BREW.
We plan to make changes to FT2 to support systems requiring position
independent code (such as BREW).
This is why I want to consult FT2 maintainers and developers so that we
can make these changes properly. Then, if the FT2 maintainers and our
client agree, we want to integrate these changes back into FT2 thus
making it more versatile for everyone, and us reaping the benefits of
open source.
Some Technical Details
----------------------
A large issue is that BREW, like some other embedded systems, requires
all code to be position independent (
http://en.wikipedia.org/wiki/Position_independent_code ).
FT2 uses some programming idioms making it impossible to compile to ROPI
(read-only, position independent) code.
For example, const global data (static or not) pointers must have
address fixups at run time - something that is impossible on BREW.
Some examples:
const int x = 0; /* no problem */
const int* p = &x; /* needs address fixup - can't be used in PIC */
char *list1[] = {"zero", "one", "two"}; /* pointers need fixup */
char list2[3][5] = {"zero", "one", "two"}; /* OK, no problem */
FT2 uses lots a lot of such constants, such as arrays of pointers to
structs and function tables. This is pervasive throughout all parts of FT2.
The Changes
-----------
I propose adding an FT_CONFIG_OPTION_PIC switch that if defined, will
allow FT2 to compile to PIC:
* The previously global const structures will now be part of some
internal structure. For example inside FT_LibraryRec_ (there are other
options).
* Additional init functions will be called at library init (during
FT_Init_FreeType) that will generate the structures, arrays, tables, and
pointers at run time.
* Ideally, each structure/table/array/whatever only needs to be written
once (via a macro?), and depending on FT_CONFIG_OPTION_PIC either a
global const is generated, or a struct member with a matching init
function to be called.
* From what I could see, most parts of FT2 use such global constants.
* Ideally, the internal FT2 API would not be modified.
* We only use a subset (around 25% maybe?) of FT2.
Your Help
---------
FT2 developers are obviously more familiar than me with the library, and
could help devise a good solution and estimate the amount of work.
I have more ideas and more details regarding this, but who should I be
talking to?
I want to stress that while this is part of a project for our client, we
definitely want to do this with the support, help (and eventual open
sourcing of the result!) of the community.
I believe that a PIC build option for FT2 will make it more useful on
more systems, and is possible without a huge change in FT2.
Much regards,
Mickey