[poppler] poppler/poppler: ArthurOutputDev.cc,1.10,1.11
Albert Astals Cid
aacid at freedesktop.org
Mon Feb 13 15:04:56 PST 2006
Update of /cvs/poppler/poppler/poppler
In directory gabe:/tmp/cvs-serv16856/poppler
Modified Files:
ArthurOutputDev.cc
Log Message:
* poppler/ArthurOutputDev.cc: Make it compile after changing code so we did not pass files to freetype but buffers
Index: ArthurOutputDev.cc
===================================================================
RCS file: /cvs/poppler/poppler/poppler/ArthurOutputDev.cc,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- ArthurOutputDev.cc 30 Oct 2005 20:29:05 -0000 1.10
+++ ArthurOutputDev.cc 13 Feb 2006 23:04:54 -0000 1.11
@@ -245,11 +245,13 @@
GfxFontType fontType;
SplashOutFontFileID *id;
SplashFontFile *fontFile;
+ SplashFontSrc *fontsrc;
FoFiTrueType *ff;
Ref embRef;
Object refObj, strObj;
- GooString *tmpFileName, *fileName, *substName;
- FILE *tmpFile;
+ GooString *fileName, *substName;
+ char *tmpBuf;
+ int tmpBufLen;
Gushort *codeToGID;
DisplayFontParam *dfp;
double m11, m12, m21, m22, w1, w2;
@@ -259,7 +261,8 @@
m_needFontUpdate = false;
m_font = NULL;
- tmpFileName = NULL;
+ fileName = NULL;
+ tmpBuf = NULL;
substIdx = -1;
if (!(gfxFont = state->getFont())) {
@@ -279,22 +282,9 @@
// if there is an embedded font, write it to disk
if (gfxFont->getEmbeddedFontID(&embRef)) {
- if (!openTempFile(&tmpFileName, &tmpFile, "wb", NULL)) {
- error(-1, "Couldn't create temporary font file");
+ tmpBuf = gfxFont->readEmbFontFile(xref, &tmpBufLen);
+ if (! tmpBuf)
goto err2;
- }
- refObj.initRef(embRef.num, embRef.gen);
- refObj.fetch(xref, &strObj);
- refObj.free();
- strObj.streamReset();
- while ((c = strObj.streamGetChar()) != EOF) {
- fputc(c, tmpFile);
- }
- strObj.streamClose();
- strObj.free();
- fclose(tmpFile);
- fileName = tmpFileName;
-
// if there is an external font file, use it
} else if (!(fileName = gfxFont->getExtFontFile())) {
@@ -321,13 +311,18 @@
}
}
+ fontsrc = new SplashFontSrc;
+ if (fileName)
+ fontsrc->setFile(fileName, gFalse);
+ else
+ fontsrc->setBuf(tmpBuf, tmpBufLen, gFalse);
+
// load the font file
switch (fontType) {
case fontType1:
if (!(fontFile = m_fontEngine->loadType1Font(
id,
- fileName->getCString(),
- fileName == tmpFileName,
+ fontsrc,
((Gfx8BitFont *)gfxFont)->getEncoding()))) {
error(-1, "Couldn't create a font for '%s'",
gfxFont->getName() ? gfxFont->getName()->getCString()
@@ -338,8 +333,7 @@
case fontType1C:
if (!(fontFile = m_fontEngine->loadType1CFont(
id,
- fileName->getCString(),
- fileName == tmpFileName,
+ fontsrc,
((Gfx8BitFont *)gfxFont)->getEncoding()))) {
error(-1, "Couldn't create a font for '%s'",
gfxFont->getName() ? gfxFont->getName()->getCString()
@@ -355,8 +349,7 @@
delete ff;
if (!(fontFile = m_fontEngine->loadTrueTypeFont(
id,
- fileName->getCString(),
- fileName == tmpFileName,
+ fontsrc,
codeToGID, 256))) {
error(-1, "Couldn't create a font for '%s'",
gfxFont->getName() ? gfxFont->getName()->getCString()
@@ -368,8 +361,7 @@
case fontCIDType0C:
if (!(fontFile = m_fontEngine->loadCIDFont(
id,
- fileName->getCString(),
- fileName == tmpFileName))) {
+ fontsrc))) {
error(-1, "Couldn't create a font for '%s'",
gfxFont->getName() ? gfxFont->getName()->getCString()
: "(unnamed)");
@@ -383,8 +375,7 @@
n * sizeof(Gushort));
if (!(fontFile = m_fontEngine->loadTrueTypeFont(
id,
- fileName->getCString(),
- fileName == tmpFileName,
+ fontsrc,
codeToGID, n))) {
error(-1, "Couldn't create a font for '%s'",
gfxFont->getName() ? gfxFont->getName()->getCString()
@@ -408,17 +399,11 @@
mat[2] = m21; mat[3] = -m22;
m_font = m_fontEngine->getFont(fontFile, mat);
- if (tmpFileName) {
- delete tmpFileName;
- }
return;
err2:
delete id;
err1:
- if (tmpFileName) {
- delete tmpFileName;
- }
return;
}
More information about the poppler
mailing list