/* kr-test.c -- test program for Korean language support. * Copyright (C) 1999 FastIO Systems, All Rights Reserved. * For conditions of use, license, and distribution, see LICENSE.pdf * included in the distribution or /LICENSE.pdf To display the generated PDF file, your system must either be using a Korean version of the OS, or have a Korean font from Adobe installed. For Adobe Acrobat Reader 4.x and 5.0, the font is available for free downloading from: http://www.adobe.com/products/acrobat/acrrasianfontpack.html Errors will result if the font is missing. ------------------------------------------------------------------------------------ 1999-09-25 [io] Starting with Japanese, and then Korean. We will need Chinese help soon. cc -Wall -o kr-test -I/usr/local/include kr-test.c -lcpdfpm */ #include #include #include /* KSC-EUC-H (EUC-KR) test : Curtesy of Dr. Hwang, Jinsoo */ char *euc_kr_text[] = { "À̱ÛÀº ÇѱÛÀ©µµ¿?95¿¡¼­ ³?®ÆÐµå»óÀ¡¼­", "ÀÛ¼ºÇÑ ±ÛÀÔ´Ï´Ù. ÀÌ·¸°Ô Çѱۿ¡ ´?Ï¿©µµ", "½Å°æÀ» ½áÁּż­ °¨»çÇÕ´Ï´Ù.", "Ȳ Á?¼?, NULL }; /* KSC-EUC-H (EUC-KR) test : Curtesy of Dr. Hwang, Jinsoo */ char *euc_kr_english[] = { "English translation. :-)", "This is written under Korean Windows95 with NotePad.", "I appreciate your efforts to take care of Korean characters.", "Thank you", "", "Hwang, Jinsoo", NULL }; int main(int argc, char *argv[]) { int i; CPDFdoc *pdf; float fontsize = 16.0; float x = 1.0; float y = 8.5; int alignmode = TEXTPOS_LL; float ybump = 0.25; /* == Initialization == */ pdf = cpdf_open(0, NULL); cpdf_enableCompression(pdf, YES); /* use Flate/Zlib compression */ cpdf_init(pdf); cpdf_pageInit(pdf, 1, PORTRAIT, LETTER, LETTER); /* page orientation */ cpdf_beginText(pdf, 0); cpdf_setFont(pdf, "HYGoThic-Medium", "KSC-EUC-H", fontsize); /* Gothic type font */ for(i = 0; euc_kr_text[i] != NULL; i++) { cpdf_textAligned(pdf, x, y, 0.0, alignmode, euc_kr_text[i]); y -= ybump; } cpdf_endText(pdf); y -= ybump; cpdf_beginText(pdf, 0); cpdf_setFont(pdf, "HYSMyeongJo-Medium", "KSC-EUC-H", fontsize); /* MyeongJo type font */ for(i = 0; euc_kr_text[i] != NULL; i++) { cpdf_textAligned(pdf, x, y, 0.0, alignmode, euc_kr_text[i]); y -= ybump; } cpdf_endText(pdf); y -= ybump; cpdf_beginText(pdf, 0); cpdf_setFont(pdf, "Helvetica", "MacRomanEncoding", fontsize); for(i = 0; euc_kr_english[i] != NULL; i++) { cpdf_textAligned(pdf, x, y, 0.0, alignmode, euc_kr_english[i]); y -= ybump; } cpdf_endText(pdf); cpdf_finalizeAll(pdf); /* PDF file/memstream is actually written here */ cpdf_savePDFmemoryStreamToFile(pdf, "kr-test.pdf"); cpdf_launchPreview(pdf); /* launch Acrobat/PDF viewer on the output file */ /* == Clean up == */ cpdf_close(pdf); /* shut down */ return 0; }