PfExtentWideText and uint16_t

PfExtentWideText is define in the help as:

PhRect_t * PfExtentWideText(PhRect_t extent, PhPoint_t const * pos, const
char * font, const wchar_t
str, int len);

Although in the photon/Pf.h its:

PhRect_t * PfExtentWideText(PhRect_t extent, PhPoint_t const * pos, const
char * font, const uint16_t
str, int len);


My question is a wchar_t just a uint16_t? Can I simply type cast a wchar_t *
to a uint16_t *, as in:

PhRect pExtent;
PhPoint pPoint;
char * fontName= “Helvetica”;
wchar_t wideText[10];
int nWideTextLen = 10;

PfExtentWideText(&pExtent, &pPoint, fontName, (uint16_t *)wideText,
nWideTextLen);


Jeffrey B. Holtz
Software Engineering
Electro Scientific Industries, Inc.
Ph: 734-332-7054
Fax: 734-332-7077
email: holtzj@esi.com

I’m actually trying to get the Extent of a Korean string. Everytime I do
this though I get back a NULL return code, FAILURE. Either with
PgExtentText, PfExtentText, or PfExtentWideText. I have a wchar_t* for
Korean font. Any suggestions??

\

Jeffrey B. Holtz
Software Engineering
Electro Scientific Industries, Inc.
Ph: 734-332-7054
Fax: 734-332-7077
email: holtzj@esi.com
“Jeff Holtz” <holtzj@esi.com> wrote in message
news:atqp8j$bah$1@inn.qnx.com

PfExtentWideText is define in the help as:

PhRect_t * PfExtentWideText(PhRect_t extent, PhPoint_t const * pos, const
char * font, const wchar_t
str, int len);

Although in the photon/Pf.h its:

PhRect_t * PfExtentWideText(PhRect_t extent, PhPoint_t const * pos, const
char * font, const uint16_t
str, int len);


My question is a wchar_t just a uint16_t? Can I simply type cast a wchar_t
*
to a uint16_t *, as in:

PhRect pExtent;
PhPoint pPoint;
char * fontName= “Helvetica”;
wchar_t wideText[10];
int nWideTextLen = 10;

PfExtentWideText(&pExtent, &pPoint, fontName, (uint16_t *)wideText,
nWideTextLen);


Jeffrey B. Holtz
Software Engineering
Electro Scientific Industries, Inc.
Ph: 734-332-7054
Fax: 734-332-7077
email: > holtzj@esi.com

Jeff Holtz <holtzj@esi.com> wrote:

I’m actually trying to get the Extent of a Korean string. Everytime I do
this though I get back a NULL return code, FAILURE. Either with
PgExtentText, PfExtentText, or PfExtentWideText. I have a wchar_t* for
Korean font. Any suggestions??

No, the docs in 6.1 are wrong. wchar_t is 32-bit now, so either undef
wchar_t and make a redefine as uint16_t, or define your arrays
as uint16_t.

In 6.2, use PfExtent/PfExtentCx, and pass
the PF_WIDE_CHAR32 flag when using wchar_t.

Regards.



Jeffrey B. Holtz
Software Engineering
Electro Scientific Industries, Inc.
Ph: 734-332-7054
Fax: 734-332-7077
email: > holtzj@esi.com
“Jeff Holtz” <> holtzj@esi.com> > wrote in message
news:atqp8j$bah$> 1@inn.qnx.com> …
PfExtentWideText is define in the help as:

PhRect_t * PfExtentWideText(PhRect_t extent, PhPoint_t const * pos, const
char * font, const wchar_t
str, int len);

Although in the photon/Pf.h its:

PhRect_t * PfExtentWideText(PhRect_t extent, PhPoint_t const * pos, const
char * font, const uint16_t
str, int len);


My question is a wchar_t just a uint16_t? Can I simply type cast a wchar_t
*
to a uint16_t *, as in:

PhRect pExtent;
PhPoint pPoint;
char * fontName= “Helvetica”;
wchar_t wideText[10];
int nWideTextLen = 10;

PfExtentWideText(&pExtent, &pPoint, fontName, (uint16_t *)wideText,
nWideTextLen);


Jeffrey B. Holtz
Software Engineering
Electro Scientific Industries, Inc.
Ph: 734-332-7054
Fax: 734-332-7077
email: > holtzj@esi.com

Jeff Holtz wrote:

I’m actually trying to get the Extent of a Korean string. Everytime I do
this though I get back a NULL return code, FAILURE. Either with
PgExtentText, PfExtentText, or PfExtentWideText. I have a wchar_t* for
Korean font. Any suggestions??


Jeffrey B. Holtz
Software Engineering
Electro Scientific Industries, Inc.
Ph: 734-332-7054
Fax: 734-332-7077
email: > holtzj@esi.com
“Jeff Holtz” <> holtzj@esi.com> > wrote in message
news:atqp8j$bah$> 1@inn.qnx.com> …
PfExtentWideText is define in the help as:

PhRect_t * PfExtentWideText(PhRect_t extent, PhPoint_t const * pos, const
char * font, const wchar_t
str, int len);

Although in the photon/Pf.h its:

PhRect_t * PfExtentWideText(PhRect_t extent, PhPoint_t const * pos, const
char * font, const uint16_t
str, int len);


My question is a wchar_t just a uint16_t? Can I simply type cast a wchar_t
*
to a uint16_t *, as in:

wchar_t is a uint32_t for libc. Try uning PfExtent with the PF_WIDE_CHAR32 flag.
But the Pg function calls do not seem to support 32 bits wide char.

Solution : If you can, switch/convert ( wctoutf8() ) to Unicode. Photon is using
Unicode everywhere anyway. It will simplify your life Everywhere you pass an
ASCII string to a libc function or a Photon function, you can pass a UTF8 string
with no special flag.

Michel