tony2001/libharu — Issue #5: HPDF_Page_TextRect return HPDF_PAGE_INSUFFICIENT_SPACE
Author: njman
Created: 2012-01-20 14:06:46+00:00
State: open

Hi Tony,

I' m getting trouble with `HPDF_Page_TextRect` based on Chinese text (cp936) if the input Chinese line exceed rectangle width, it return `HPDF_PAGE_INSUFFICIENT_SPACE`.

1. demo/mbtext/cp936_t.txt include:

早上好，多关照。早上好，多关照。早上好，多关照。

2. Test code based on `text_demo2` :

HPDF_UseCNSEncodings (pdf);
HPDF_UseCNSFonts (pdf);

HPDF_Rect rect;
/* HPDF_TALIGN_LEFT */
rect.left = 25;
rect.top = 545;
rect.right = 200;
rect.bottom = rect.top - 40;

HPDF_Page_SetCMYKStroke(page,0,1,1,0.07);

HPDF_Page_Rectangle (page, rect.left, rect.bottom, rect.right - rect.left,
rect.top - rect.bottom);
HPDF_Page_Stroke (page);

HPDF_Page_BeginText (page);
HPDF_STATUS ret = HPDF_Page_TextRect (page, rect.left, rect.top, rect.right, rect.bottom,
text, HPDF_TALIGN_LEFT, NULL);
if (ret != HPDF_OK) printf("Bad return code=%d!\n", ret);

HPDF_Page_EndText (page);

However, with below input, it worked:

早上好，多关照。早上好，多关照。早上好，多 关照。
^
Note: ^ denote space between 2 Chinese word.

I didn't see multibyte lang demo of exceeding rectangle width. Within `text_demo2`, it only demoed English Character.

Thanks and Regards
njman