clown
2011-08-08
Hello,
I have a problem with vertical writing (embedding TrueType fonts).
The problem is happened when setting "embedding = HPDF_TRUE" and "encoding = 90ms-RKSJ-V".
Other cases, (for example, embedding is false or encoding is 90ms-RKSJ-H,) are shown nice.
The sample code is here:
int main(int argc, char* argv) {
const char* description = "hello, world!";
document_type doc = HPDF_New(plaza::generator::hpdf_policy::error_handler, NULL);
//HPDF_SetCompressionMode(doc, HPDF_COMP_ALL);
HPDF_UseJPEncodings(doc);
HPDF_UseJPFonts(doc);
const char* font_name = HPDF_LoadTTFontFromFile2(doc, "data/DF-GyouSho-W7J.ttc", 0, HPDF_TRUE);
HPDF_Font font = HPDF_GetFont(doc, font_name, "90ms-RKSJ-V");
HPDF_Page page = HPDF_AddPage(doc);
// show sample text.
HPDF_Page_BeginText(page);
HPDF_Page_SetFontAndSize(page, font, 24);
double width = HPDF_Page_TextWidth(page, description);
double x = (HPDF_Page_GetWidth(page) - width) / 2.0;
double y = HPDF_Page_GetHeight(page) - 200;
HPDF_Page_SetTextMatrix(page, 1, 0, 0, 1, x, y);
HPDF_Page_ShowText(page, description);
HPDF_Page_EndText(page);
HPDF_SaveToFile(doc, "data/vertical.pdf");
HPDF_Free(doc);
return 0;
}