- /* T1 allows us to recode only once. Therefore, remove
- and reload the font to reset it */
- T1_DeleteFont(id);
- T1_LoadFont(id);
- initT1Font(id, encoding);
-}
-
-int SWFOutputDev::initT1Font(int id, FontEncoding*encoding)
-{
- int encStrSize;
- char *encPtr;
- int i;
-
- if(!T1_GetFontName(id))
- T1_LoadFont(id);
-
- /* reencode the font:
- * This is the only way to get the unmapped characters
- * from t1lib
- */
- encStrSize = 0;
- for (i = 0; i < 256 && i < encoding->getSize(); ++i) {
- if (encoding->getCharName(i)) {
- encStrSize += strlen(encoding->getCharName(i)) + 1;
- }
- }
- char**enc = (char **)gmalloc(257 * sizeof(char *));
- char*encStr = (char *)gmalloc(encStrSize * sizeof(char));
- encPtr = encStr;
- for (i = 0; i < 256 && i < encoding->getSize(); ++i) {
- if (encoding->getCharName(i)) {
- strcpy(encPtr, encoding->getCharName(i));
- enc[i] = encPtr;
- encPtr += strlen(encPtr) + 1;
- } else {
- enc[i] = ".notdef";
- }
- }
- for (; i < 256; ++i) {
- enc[i] = ".notdef";
- }
- enc[256] = "custom";
- int ret=T1_ReencodeFont(id, enc);
- t1id = id;
- return 1;