Home
Developer Resources
QNX RTOS v4
QNX RTOS v4 Knowledge Base

QNX RTOS v4 Knowledge Base

Foundry27
Foundry27
QNX RTOS v4 project
Resources

QNX RTOS v4 Knowledge Base

Title Drawing unicode fonts with PgDrawText.
Ref. No. QNX.000009656
Category(ies) Development
Issue We are trying to display unicode strings via the PgDrawText() function.  Is there any source to do this?
Solution A wide character is a 16-bit value representing the symbol.  Multibyte is a string representation of up to MB_CUR_MAX bytes per symbol.  7-bit ASCII maps to the same locations in Unicode, UTF-8.  Use mbtoXX routines, and wctoXX() routines.  Using multibyte is the prefered method.
---------------------------------------------
PhPoint_t pnt = { 10, 10 };
wchar_t ch = 0x65;

//Wide characters
PgDrawText(&ch, 2, &pnt, Pg_TEXT_WIDECHAR);

//Multi-byte

char sz[M_CUR_MAX];
int iLen = 0;

iLen = wctombs(sz, ch);

sz[iLen] = 'x0';

PgDrawText(sz, strlen(sz)m &pnt,0);