[poppler] Branch 'xpdf303merge' - poppler/SplashOutputDev.cc splash/SplashFontEngine.cc splash/SplashFontEngine.h splash/SplashFTFontEngine.cc splash/SplashFTFontEngine.h
Carlos Garcia Campos
carlosgc at kemper.freedesktop.org
Thu Sep 8 03:40:24 PDT 2011
poppler/SplashOutputDev.cc | 12 +++++++++++-
splash/SplashFTFontEngine.cc | 29 +++++++++++++++++------------
splash/SplashFTFontEngine.h | 3 ++-
splash/SplashFontEngine.cc | 6 ++++--
splash/SplashFontEngine.h | 3 ++-
5 files changed, 36 insertions(+), 17 deletions(-)
New commits:
commit 89d95d0f254a828d28d943b698eeaec51f03686f
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date: Thu Sep 8 12:38:36 2011 +0200
xpdf303: Add codeToGID and codeToGIDLen params to loadOpenTypeCFFFont()
diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index 9fc0656..93c9499 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -1881,9 +1881,19 @@ void SplashOutputDev::doUpdateFont(GfxState *state) {
}
break;
case fontCIDType0COT:
+ if (((GfxCIDFont *)gfxFont)->getCIDToGID()) {
+ n = ((GfxCIDFont *)gfxFont)->getCIDToGIDLen();
+ codeToGID = (int *)gmallocn(n, sizeof(int));
+ memcpy(codeToGID, ((GfxCIDFont *)gfxFont)->getCIDToGID(),
+ n * sizeof(int));
+ } else {
+ codeToGID = NULL;
+ n = 0;
+ }
if (!(fontFile = fontEngine->loadOpenTypeCFFFont(
id,
- fontsrc))) {
+ fontsrc,
+ codeToGID, n))) {
error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
gfxFont->getName() ? gfxFont->getName()->getCString()
: "(unnamed)");
diff --git a/splash/SplashFTFontEngine.cc b/splash/SplashFTFontEngine.cc
index 676db5f..7a4568d 100644
--- a/splash/SplashFTFontEngine.cc
+++ b/splash/SplashFTFontEngine.cc
@@ -139,7 +139,9 @@ SplashFontFile *SplashFTFontEngine::loadCIDFont(SplashFontFileID *idA,
}
SplashFontFile *SplashFTFontEngine::loadOpenTypeCFFFont(SplashFontFileID *idA,
- SplashFontSrc *src) {
+ SplashFontSrc *src,
+ int *codeToGID,
+ int codeToGIDLen) {
FoFiTrueType *ff;
int *cidToGIDMap;
int nCIDs;
@@ -147,21 +149,24 @@ SplashFontFile *SplashFTFontEngine::loadOpenTypeCFFFont(SplashFontFileID *idA,
cidToGIDMap = NULL;
nCIDs = 0;
- if (!useCIDs) {
- if (src->isFile) {
- ff = FoFiTrueType::load(src->fileName->getCString());
- } else {
- ff = FoFiTrueType::make(src->buf, src->bufLen);
- }
- if (ff) {
- if (ff->isOpenTypeCFF()) {
- cidToGIDMap = ff->getCIDToGIDMap(&nCIDs);
+ if (!codeToGID) {
+ if (!useCIDs) {
+ if (src->isFile) {
+ ff = FoFiTrueType::load(src->fileName->getCString());
+ } else {
+ ff = FoFiTrueType::make(src->buf, src->bufLen);
+ }
+ if (ff) {
+ if (ff->isOpenTypeCFF()) {
+ cidToGIDMap = ff->getCIDToGIDMap(&nCIDs);
+ }
+ delete ff;
}
- delete ff;
}
}
ret = SplashFTFontFile::loadCIDFont(this, idA, src,
- cidToGIDMap, nCIDs);
+ codeToGID ? codeToGID : cidToGIDMap,
+ codeToGID ? codeToGIDLen : nCIDs);
if (!ret) {
gfree(cidToGIDMap);
}
diff --git a/splash/SplashFTFontEngine.h b/splash/SplashFTFontEngine.h
index 6bb40c8..aa1ad5f 100644
--- a/splash/SplashFTFontEngine.h
+++ b/splash/SplashFTFontEngine.h
@@ -54,7 +54,8 @@ public:
SplashFontFile *loadType1CFont(SplashFontFileID *idA, SplashFontSrc *src, const char **enc);
SplashFontFile *loadOpenTypeT1CFont(SplashFontFileID *idA, SplashFontSrc *src, const char **enc);
SplashFontFile *loadCIDFont(SplashFontFileID *idA, SplashFontSrc *src);
- SplashFontFile *loadOpenTypeCFFFont(SplashFontFileID *idA, SplashFontSrc *src);
+ SplashFontFile *loadOpenTypeCFFFont(SplashFontFileID *idA, SplashFontSrc *src,
+ int *codeToGID, int codeToGIDLen);
SplashFontFile *loadTrueTypeFont(SplashFontFileID *idA, SplashFontSrc *src,
int *codeToGID, int codeToGIDLen, int faceIndex = 0);
diff --git a/splash/SplashFontEngine.cc b/splash/SplashFontEngine.cc
index 6e3db3d..2e74f5a 100644
--- a/splash/SplashFontEngine.cc
+++ b/splash/SplashFontEngine.cc
@@ -235,13 +235,15 @@ SplashFontFile *SplashFontEngine::loadCIDFont(SplashFontFileID *idA,
}
SplashFontFile *SplashFontEngine::loadOpenTypeCFFFont(SplashFontFileID *idA,
- SplashFontSrc *src) {
+ SplashFontSrc *src,
+ int *codeToGID,
+ int codeToGIDLen) {
SplashFontFile *fontFile;
fontFile = NULL;
#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
if (!fontFile && ftEngine) {
- fontFile = ftEngine->loadOpenTypeCFFFont(idA, src);
+ fontFile = ftEngine->loadOpenTypeCFFFont(idA, src, codeToGID, codeToGIDLen);
}
#endif
diff --git a/splash/SplashFontEngine.h b/splash/SplashFontEngine.h
index 2d349ba..54926b4 100644
--- a/splash/SplashFontEngine.h
+++ b/splash/SplashFontEngine.h
@@ -74,7 +74,8 @@ public:
SplashFontFile *loadType1CFont(SplashFontFileID *idA, SplashFontSrc *src, const char **enc);
SplashFontFile *loadOpenTypeT1CFont(SplashFontFileID *idA, SplashFontSrc *src, const char **enc);
SplashFontFile *loadCIDFont(SplashFontFileID *idA, SplashFontSrc *src);
- SplashFontFile *loadOpenTypeCFFFont(SplashFontFileID *idA, SplashFontSrc *src);
+ SplashFontFile *loadOpenTypeCFFFont(SplashFontFileID *idA, SplashFontSrc *src,
+ int *codeToGID, int codeToGIDLen);
SplashFontFile *loadTrueTypeFont(SplashFontFileID *idA, SplashFontSrc *src,
int *codeToGID, int codeToGIDLen, int faceIndex = 0);
More information about the poppler
mailing list