Fiddle with Unicode support some more.

This commit is contained in:
Michael R Sweet 2021-06-22 17:10:19 -04:00
parent 3844abdf92
commit 060e7cdbd5
No known key found for this signature in database
GPG Key ID: BE67C75EC81F3244
2 changed files with 16 additions and 2 deletions

View File

@ -1451,6 +1451,7 @@ pdfioFileCreateFontObjFromFile(
pdfioDictSetName(type2, "BaseFont", basefont);
pdfioDictSetDict(type2, "CIDSystemInfo", sidict);
pdfioDictSetObj(type2, "CIDToGIDMap", cid2gid_obj);
// pdfioDictSetName(type2, "CIDToGIDMap", "Identity");
pdfioDictSetObj(type2, "FontDescriptor", desc_obj);
if ((type2_obj = pdfioFileCreateObj(pdf, type2)) == NULL)

View File

@ -1095,6 +1095,7 @@ write_font_test(pdfio_file_t *pdf, // I - PDF file
pdfio_dict_t *dict; // Page dictionary
pdfio_stream_t *st; // Page contents stream
pdfio_obj_t *opensans; // OpenSans-Regular font
bool unicode; // Unicode?
int i; // Looping var
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"
};
unicode = true;
#if 1
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");
else
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);
if ((dict = pdfioDictCreate(pdf)) != NULL)
puts("PASS");
@ -1318,7 +1331,7 @@ write_font_test(pdfio_file_t *pdf, // I - PDF file
}
printf("pdfioContentTextShow(\"%s\"): ", welcomes[i]);
if (pdfioContentTextShow(st, true, welcomes[i]))
if (pdfioContentTextShow(st, unicode, welcomes[i]))
puts("PASS");
else
return (1);