mirror of
https://github.com/michaelrsweet/pdfio.git
synced 2025-02-20 19:02:50 +01:00
Fiddle with Unicode support some more.
This commit is contained in:
parent
3844abdf92
commit
060e7cdbd5
@ -1451,6 +1451,7 @@ pdfioFileCreateFontObjFromFile(
|
|||||||
pdfioDictSetName(type2, "BaseFont", basefont);
|
pdfioDictSetName(type2, "BaseFont", basefont);
|
||||||
pdfioDictSetDict(type2, "CIDSystemInfo", sidict);
|
pdfioDictSetDict(type2, "CIDSystemInfo", sidict);
|
||||||
pdfioDictSetObj(type2, "CIDToGIDMap", cid2gid_obj);
|
pdfioDictSetObj(type2, "CIDToGIDMap", cid2gid_obj);
|
||||||
|
// pdfioDictSetName(type2, "CIDToGIDMap", "Identity");
|
||||||
pdfioDictSetObj(type2, "FontDescriptor", desc_obj);
|
pdfioDictSetObj(type2, "FontDescriptor", desc_obj);
|
||||||
|
|
||||||
if ((type2_obj = pdfioFileCreateObj(pdf, type2)) == NULL)
|
if ((type2_obj = pdfioFileCreateObj(pdf, type2)) == NULL)
|
||||||
|
17
testpdfio.c
17
testpdfio.c
@ -1095,6 +1095,7 @@ write_font_test(pdfio_file_t *pdf, // I - PDF file
|
|||||||
pdfio_dict_t *dict; // Page dictionary
|
pdfio_dict_t *dict; // Page dictionary
|
||||||
pdfio_stream_t *st; // Page contents stream
|
pdfio_stream_t *st; // Page contents stream
|
||||||
pdfio_obj_t *opensans; // OpenSans-Regular font
|
pdfio_obj_t *opensans; // OpenSans-Regular font
|
||||||
|
bool unicode; // Unicode?
|
||||||
int i; // Looping var
|
int i; // Looping var
|
||||||
static const char * const welcomes[] =// "Welcome" in many languages
|
static const char * const welcomes[] =// "Welcome" in many languages
|
||||||
{
|
{
|
||||||
@ -1248,12 +1249,24 @@ write_font_test(pdfio_file_t *pdf, // I - PDF file
|
|||||||
"Ngiyakwemukela\n"
|
"Ngiyakwemukela\n"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
unicode = true;
|
||||||
|
|
||||||
|
#if 1
|
||||||
fputs("pdfioFileCreateFontObjFromFile(OpenSans-Regular.ttf): ", stdout);
|
fputs("pdfioFileCreateFontObjFromFile(OpenSans-Regular.ttf): ", stdout);
|
||||||
if ((opensans = pdfioFileCreateFontObjFromFile(pdf, "testfiles/OpenSans-Regular.ttf", true)) != NULL)
|
if ((opensans = pdfioFileCreateFontObjFromFile(pdf, "testfiles/OpenSans-Regular.ttf", unicode)) != NULL)
|
||||||
puts("PASS");
|
puts("PASS");
|
||||||
else
|
else
|
||||||
return (1);
|
return (1);
|
||||||
|
|
||||||
|
#else
|
||||||
|
fputs("pdfioFileCreateFontObjFromFile(NotoSansJP-Regular.otf): ", stdout);
|
||||||
|
if ((opensans = pdfioFileCreateFontObjFromFile(pdf, "testfiles/NotoSansJP-Regular.otf", unicode)) != NULL)
|
||||||
|
puts("PASS");
|
||||||
|
else
|
||||||
|
return (1);
|
||||||
|
#endif // 1
|
||||||
|
|
||||||
fputs("pdfioDictCreate: ", stdout);
|
fputs("pdfioDictCreate: ", stdout);
|
||||||
if ((dict = pdfioDictCreate(pdf)) != NULL)
|
if ((dict = pdfioDictCreate(pdf)) != NULL)
|
||||||
puts("PASS");
|
puts("PASS");
|
||||||
@ -1318,7 +1331,7 @@ write_font_test(pdfio_file_t *pdf, // I - PDF file
|
|||||||
}
|
}
|
||||||
|
|
||||||
printf("pdfioContentTextShow(\"%s\"): ", welcomes[i]);
|
printf("pdfioContentTextShow(\"%s\"): ", welcomes[i]);
|
||||||
if (pdfioContentTextShow(st, true, welcomes[i]))
|
if (pdfioContentTextShow(st, unicode, welcomes[i]))
|
||||||
puts("PASS");
|
puts("PASS");
|
||||||
else
|
else
|
||||||
return (1);
|
return (1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user