discuss-gnustep
[Top][All Lists]
Advanced

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

RE: Traditional Chinese partially supported


From: Yen-Ju Chen
Subject: RE: Traditional Chinese partially supported
Date: Mon, 11 Mar 2002 09:07:00 -0500

> -----Original Message-----
> From: discuss-gnustep-admin@gnu.org
> [mailto:discuss-gnustep-admin@gnu.org]On Behalf Of Pete French
> Sent: Monday, March 11, 2002 5:46 AM
> To: discuss-gnustep@gnu.org; yjchen@virginia.edu
> Subject: Re: Traditional Chinese partially supported
>
>
> I am very interested in this work, because I have been working on
> multi-linugal support at work as well. Not for Chinese specifically,
> but to fit full Unicode support into my own Objectve C strings that
> I use on thw website (this was started in the days when GNUstep
> would compile
> under Cygwin so unfortunately I couldnt use it - which is exasperating
> nopw as I ahve to maintain my own foundation libraries, but anyway)

  Fred Kiefer said there is a library called pango (www.pango.org).
  Maybe that's what you want, but it is based on GTK.
  After I finished the necessary modification for 2bytes display and
editing,
  maybe I will try to implement it using GNUstep.

>
> >   http://www.people.virginia.edu/~yc2w/GNUstep/Chinese/NSMenu.gif
> >   http://www.people.virginia.edu/~yc2w/GNUstep/Chinese/Ink.gif
>
> That is excellent! Especially the latter - we have a requirement to
> mix japanese and english in the same string. I want to do this in GNUstep
> too.

  The reason they can be put together is because they all use the same font
!
  Chinese fonts can draw English as well.
  So they are all in one NSString, not NSAttributedString.
  I haven't check what will happen if I use NSAttributedString.
  My Chinese font use Unicode encoding,
  so I have to modify the source code associated with
NSUnicodeStringEncoding,
  not NSBIG5StringEncoding.
  So it should works for any language if they use Unicode font.

> Interesting. So do these changes just affect Big5 encoding, or will they
> make all strings draw using XftDrawStringUtf8 ? I havent tried mixing
> characters under GNUstep yet and drawing them, but surely this would be
> a good way to draw all characters ? Elsse how do you decide when you need
> to use this function aspposed to the 8 bit function ?

  They will affect all the string no matter what is the encoding.
  All the string are drawed by XftDrawStringUtf8.
  The tricky thing is that the encoding of 1bytes character
  is the same in UTF8 and in it's original encoding.
  So it won't affect the original western font display, I hope.

> I havent looked at the innards of an NSString myself - I had
> always assumed
> that it was internally stored as either UTF-8 (or possibly UTF-16) so
> it could just be drawn and output directly.

  No. it stored the CString as original encoding,
  which is based on GNUSTEP_STRING_ENCODING environment variable.
  They are some situations I found.
  If you use @"" or initWithCString, a NSString will store the string
  in the original encoding.
  So [aString cString] will give you the original encoding.
  [aString UTF8String] will give you the UTF8 encoding (very nice).
  But [aString getCharacters] will give you the internal Unicode encoding.
  In my system, it is UCS-2-INTERNAL.

  That is a interesting situation for getCharacters
  because getCharacters give you an unichar string.
  So if the cString is 1bytes character, one character will be stored in 1
unichar.
  But if the cString is 2bytes character, one character (2bytes) will be
sotred in 1 unichar.
  So the length of string shrinks.
  8 bytes of 1byte character will be store in 8 bytes of unichar,
  But 8 bytes of 2bytes character will be store in 4 bytes of unichar.
  That causes some problems in my modification
  because by default, GNUstep will convert 8 bytes character into 8 bytes
unichar.
  For chinese, the rest 4 bytes are garbage.
  I haven't fix this problem in my modification,
  but it should be very easy.

>
> >   Another suggestion is that GNUstep can use DrawStringUtf8
> function instead
> > of DrawString8.
>
> That sounds like a very good idea to me at first reading...
>
> -bat.
>
> _______________________________________________
> Discuss-gnustep mailing list
> Discuss-gnustep@gnu.org
> http://mail.gnu.org/mailman/listinfo/discuss-gnustep




reply via email to

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