nanogui: Thread: Problem with Unicode strings in nano-x/nxlib/FLTK


[<<] [<] Page 1 of 1 [>] [>>]
Subject: Problem with Unicode strings in nano-x/nxlib/FLTK
From: "Ivan Tarapov" ####@####.####
Date: 21 Mar 2006 12:08:57 +0000
Message-Id: <20060321120849.8A5A0CACE4@mail.telcos.net.ua>

Hello. 

 

A little while ago, I've had a problem with drawing Unicode strings with pcf
fonts.

 

Since then I have been struggling to solve this problem. I have found the
reason of pcf fonts not being recognized by the system, installed the patch
to fix it, found the way to plug the font and now I'm having another
problem. 

 

I have an application that is comprised of FLTK communicating through nxlib
with nano-x. It runs on a board with ARM processor. 

 

The problem is on the stage of drawing. FLTK converts the string (correctly
- I've checked that) into UTF-16 and then it is passed to nxlib's
XDrawString16 function. From what I can see in the code, this string is
passed to GrText with GR_TFXCHAR2B|GR_TFBASELINE format modifiers, which
seem perfectly appropriate in this case. The byte sequence passed is correct
UTF-16 string. However on the screen, each drawn symbol is followed by a
square symbol (which, I suppose is the way of system drawing symbols, for
which it couldn't find appropriate glyphs). I.e., instead of a string "03:43
am" a string like "0│3│:│4│3│ │a│m│" is displayed. If I try to output
Russian symbols (my ultimate goal), a question mark is drawn instead of the
symbol. It seems to me that somewhere the supplied bytes array is still
interpreted as single-byte string, despite the flags passed to GrText (I
used GR_TFUC16 and GR_TFUTF8 to no avail). Could anyone suggest any solution
to this problem? 

 

Thanks

 

 

 

Subject: Re: [nanogui] Problem with Unicode strings in nano-x/nxlib/FLTK
From: "Greg Haerr" ####@####.####
Date: 22 Mar 2006 14:28:29 +0000
Message-Id: <041601c64dbc$8ad800c0$6401a8c0@winXP>

> The problem is on the stage of drawing. FLTK converts the string
(correctly
- I've checked that) into UTF-16 and then it is passed to nxlib's
XDrawString16 function. From what I can see in the code, this string is
passed to GrText with GR_TFXCHAR2B|GR_TFBASELINE format modifiers, which
seem perfectly appropriate in this case. The byte sequence passed is correct
UTF-16 string.


GR_TFXCHAR2B is incorrect, it specifies X11 format 2-byte characters.
You must use the GR_TFUC16 flag with GrText with UC16 formatted
text data.

However, in thinking about this, I'm not sure .pcf files are unicode
formatted,
they may be XCHAR2B indexed.  Perhaps this is the problem.  If you
have the original .bdf files, you might convert them to .fnt files.
Otherwise,
the UC16 character may have to be converted to an XCHAR2B character.

This is only a guess: it depends on the MAP array within the .bdf file.

Regards,

Greg












However on the screen, each drawn symbol is followed by a
square symbol (which, I suppose is the way of system drawing symbols, for
which it couldn't find appropriate glyphs). I.e., instead of a string "03:43
am" a string like "0│3│:│4│3│ │a│m│" is displayed. If I try to output
Russian symbols (my ultimate goal), a question mark is drawn instead of the
symbol. It seems to me that somewhere the supplied bytes array is still
interpreted as single-byte string, despite the flags passed to GrText (I
used GR_TFUC16 and GR_TFUTF8 to no avail). Could anyone suggest any solution
to this problem?



Thanks








[<<] [<] Page 1 of 1 [>] [>>]


Powered by ezmlm-browse 0.20.