On Mon, 11 Dec 2000, Lee Brown wrote:
> On Mon, 11 Dec 2000, [EMAIL PROTECTED] wrote:
>
> > Since Unicode only uses 16-bit char codes, and the functions in libgft handle char
>codes as uint32, I believe we have a way
> > to deal with negative char codes without disturbing Unicode support:
> >
> > if (char_code > 2^16)
> > char_code = (unsigned char) char_code;
>
> This is certainly clever. Pat yourself on the back for thinking of it.
>
> > Even when libgft supports different character encodings, it will be necessary to
>support signed chars being passed as an
> > argument (i.e., it will have to handle negative charcodes and map them to
>Unicode), and charmaps other than Latin-1 will
> > envolve a more complicated approach, other than just casting those values to
>(unsigned char).
> >
> > But until then, I see no harm in leaving Latin-1 support already built into libgft:
>
> I like to have the multi-tiered approach to API's. Different people
> have different needs and you want to capture both the quick n dirty people and
> the long term users. My intent was to have simple char support because this is
> what is easy. I also wanted unicode support because truetype supports it and I
> didn't want to handcuff the user.
>
> I'll stick to adding routines for both char and unicode. I don't like to add
> gratuitous if statements when the programmers desires are clear. Casting needs
> to be added and I'll do that too.
What I want to say is:
Use routines with 32bit-wide chars (signed long) for extensibility and
flexibility.
Use US-ASCII-chars as _default_, unless the user sets the charset s/he wanna
use.
For example, you have in the <ggi/gft.h> something like this:
-----------------------------------------------------
...
enum {
GFT_US_ASCII, /* 7-bit font */
GFT_IBM_ASCII, /* 8-bit font */
GFT_UNICODE,
GFT_LATIN1,
GFT_LATIN2,
...
GFT_LAST_FONT
} charset_t;
/* Sets the charset. You can also change the current
* charset during runtime.
* It fails, if it isn't supported by the used target/font-type
* and falls back to the one used before.
*/
int gftSetCharset(enum charset_t charset);
/* Returns the current charset. It returns GFT_US_ASCII as default,
* when no charset is set before.
*/
int gftGetCharset(enum charset_t *charset);
...
-----------------------------------------------------
The different charsets can be handled by the sublibs in the
default-subdirectory in the form of libgft/default/<charset>.
The conversion can be done i.e. in libgft/gft/convert.c
as Manuell <[EMAIL PROTECTED]> said.
Comments?
Christoph Egger
E-Mail: [EMAIL PROTECTED]