|
From: | Darren J Longhorn |
Subject: | Re: [Freetype] Lonely Longs |
Date: | Tue, 27 Jul 2004 12:10:46 +0100 |
User-agent: | Mozilla Thunderbird 0.7.2 (Windows/20040707) |
Werner LEMBERG wrote:
From: Aurio Sectio <address@hidden> Subject: [Freetype] Lonely Longs Date: Tue, 17 Sep 2002 13:08:10 -0700 (PDT) I know this reply is two years late, but...What is the recommended practice for systems that have a non-standard number of bytes for the long data type? (A long takes 5 bytes on the 6211 DSP!) Compilation crashes in ftconfig.h since only 4 and 8 byte longs are supported.Have you ever found a solution? Currently, we have this in ftconfig.h which is a bit more sophisticated than two years ago: ---- /* There are systems (like the Texas Instruments 'C54x) where a `char' */ /* has 16 bits. ANSI C says that sizeof(char) is always 1. Since an */ /* `int' has 16 bits also for this system, sizeof(int) gives 1 which */ /* is probably unexpected. */ /* */ /* `CHAR_BIT' (defined in limits.h) gives the number of bits in a */ /* `char' type. */ #ifndef FT_CHAR_BIT #define FT_CHAR_BIT CHAR_BIT #endif /* The size of an `int' type. */ #if FT_UINT_MAX == 0xFFFFFFFFUL #define FT_SIZEOF_INT (32 / FT_CHAR_BIT) #elif FT_UINT_MAX == 0xFFFFU #define FT_SIZEOF_INT (16 / FT_CHAR_BIT) #elif FT_UINT_MAX > 0xFFFFFFFFU && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFU #define FT_SIZEOF_INT (64 / FT_CHAR_BIT) #else #error "Unsupported size of `int' type!" #endif /* The size of a `long' type. */ #if FT_ULONG_MAX == 0xFFFFFFFFUL #define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) #elif FT_ULONG_MAX > 0xFFFFFFFFU && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFU #define FT_SIZEOF_LONG (64 / FT_CHAR_BIT) #else #error "Unsupported size of `long' type!" #endif
What I did, more recently than two years ago, on the DM642 was to avoid the use of the five byte longs by doing this:
/* The size of a `long' type. */ #if FT_ULONG_MAX == 0xFFFFFFFFUL #define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) #elif FT_ULONG_MAX > 0xFFFFFFFFU && FT_ULONG_MAX == 0xFFFFFFFFFFU #define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) #elif FT_ULONG_MAX > 0xFFFFFFFFFFU && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFU #define FT_SIZEOF_LONG (64 / FT_CHAR_BIT) #else #error "Unsupported size of `long' type!" #endif Which later results in FT_ULONG being 32 bits.A quick look through the code revealed that there was some use of "naked long" i.e. without using the freetype type definition. This at least has the _potential_ to cause problems, but didn't seem to interfere with the operation, at least as far as I got. My suggested solution for this would be to replace usage of "long" & "unsigned long" with "FT_LONG" & "FT_ULONG".
How far did I get? Well, I got the code built and linked in to my app. I called a few initialisation functions, and rendered some text to "ascii hex", on the standard output (Each pixel printed in to stdout in an ascii representation of it's hex value - yes, that basic!). Obviously, it's difficult to give a qualitative asessment of the result, but the output was plausible at least ;-)
Unfortunately, (and fortunately in other ways!) I'm working in a small start up, and my time is currently needed elsewhere. Our requirement for a renderer has receded temporarily, but is still there, and I hope to return to FreeType in the future. In any case, I continue to monitor the mailing lists.
Sorry for not sharing my results before, but I was hoping to get back to the port and make more progress. Alas, you know how these things work out...
Cheers Darren J Longhorn
[Prev in Thread] | Current Thread | [Next in Thread] |