1 //========================================================================
5 //========================================================================
7 //========================================================================
9 // Modified under the Poppler project - http://poppler.freedesktop.org
11 // All changes made under the Poppler project to this file are licensed
12 // under GPL version 2 or later
14 // Copyright (C) 2006 Takashi Iwai <tiwai@suse.de>
15 // Copyright (C) 2009 Albert Astals Cid <aacid@kde.org>
17 // To see a description of the changes please see the Changelog file that
18 // came with your tarball or type make ChangeLog if you are building from git
20 //========================================================================
26 #ifdef USE_GCC_PRAGMAS
27 #pragma implementation
32 #include "goo/GooString.h"
33 #include "goo/gfile.h"
35 #include "SplashT1FontEngine.h"
36 #include "SplashT1Font.h"
37 #include "SplashT1FontFile.h"
39 //------------------------------------------------------------------------
41 //------------------------------------------------------------------------
43 SplashFontFile
*SplashT1FontFile::loadType1Font(SplashT1FontEngine
*engineA
,
44 SplashFontFileID
*idA
,
55 SplashFontSrc
*newsrc
= NULL
;
59 GooString
*tmpFileName
;
61 if (!openTempFile(&tmpFileName
, &tmpFile
, "wb"))
63 fwrite(src
->buf
, 1, src
->bufLen
, tmpFile
);
65 newsrc
= new SplashFontSrc
;
66 newsrc
->setFile(tmpFileName
, gTrue
);
70 fileNameA
= src
->fileName
;
72 if ((t1libIDA
= T1_AddFont(fileNameA
->getCString())) < 0) {
76 T1_LoadFont(t1libIDA
);
80 for (i
= 0; i
< 256; ++i
) {
82 encStrSize
+= strlen(encA
[i
]) + 1;
85 encTmp
= (const char **)gmallocn(257, sizeof(char *));
86 encStrTmp
= (char *)gmallocn(encStrSize
, sizeof(char));
88 for (i
= 0; i
< 256; ++i
) {
90 strcpy(encPtr
, encA
[i
]);
92 encPtr
+= strlen(encPtr
) + 1;
94 encTmp
[i
] = ".notdef";
97 encTmp
[256] = "custom";
98 T1_ReencodeFont(t1libIDA
, (char **)encTmp
);
100 ff
= new SplashT1FontFile(engineA
, idA
, src
,
101 t1libIDA
, encTmp
, encStrTmp
);
107 SplashT1FontFile::SplashT1FontFile(SplashT1FontEngine
*engineA
,
108 SplashFontFileID
*idA
,
110 int t1libIDA
, const char **encA
, char *encStrA
):
111 SplashFontFile(idA
, srcA
)
119 SplashT1FontFile::~SplashT1FontFile() {
122 T1_DeleteFont(t1libID
);
125 SplashFont
*SplashT1FontFile::makeFont(SplashCoord
*mat
,
126 SplashCoord
*textMat
) {
129 font
= new SplashT1Font(this, mat
, textMat
);
134 #endif // HAVE_T1LIB_H