[poppler] 2 commits - fofi/FoFiTrueType.cc fofi/FoFiTrueType.h glib/poppler-page.cc poppler/GfxFont.cc poppler/GlobalParams.cc poppler/GlobalParams.h poppler/PSOutputDev.cc poppler/PSOutputDev.h
Albert Astals Cid
aacid at kemper.freedesktop.org
Mon Mar 26 13:53:09 PDT 2012
fofi/FoFiTrueType.cc | 47 ++++++++++++++++++++++++++++++++++++-----------
fofi/FoFiTrueType.h | 8 +++++++-
glib/poppler-page.cc | 2 +-
poppler/GfxFont.cc | 14 ++++++++------
poppler/GlobalParams.cc | 16 ----------------
poppler/GlobalParams.h | 3 ---
poppler/PSOutputDev.cc | 6 +++++-
poppler/PSOutputDev.h | 3 +++
8 files changed, 60 insertions(+), 39 deletions(-)
New commits:
commit a5257efe00d0fe850b1abe5c552f7581027ac64c
Author: Fabio D'Urso <fabiodurso at hotmail.it>
Date: Mon Mar 26 19:28:55 2012 +0200
Re-added forceRasterize to PSOutputDev (and qt4 fix too)â
The patch restores the forceRasterize argument in PSOutputDev ctors.
Commit 6ee907f291427b8751a872b31210bf32e8d2b722 had removed it, turning it
into a global param.
As a side effect, this patch also fixes qt4/poppler-ps-converter, which had
not been updated to the new signature, and thus produced corrupted output if
forceRasterization was set.
diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index 64a65bd..c5252aa 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -1065,7 +1065,7 @@ poppler_page_render_to_ps (PopplerPage *page,
ps_file->first_page, ps_file->last_page,
psModePS, (int)ps_file->paper_width,
(int)ps_file->paper_height, ps_file->duplex,
- 0, 0, 0, 0, gFalse);
+ 0, 0, 0, 0, gFalse, gFalse);
ps_file->document->doc->displayPage (ps_file->out, page->index + 1, 72.0, 72.0,
diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index 73a9855..76da74a 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -588,7 +588,6 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir)
psUncompressPreloadedImages = gFalse;
psRasterResolution = 300;
psRasterMono = gFalse;
- psAlwaysRasterize = gFalse;
textEncoding = new GooString("UTF-8");
#if defined(_WIN32)
textEOL = eolDOS;
@@ -1618,15 +1617,6 @@ GBool GlobalParams::getPSRasterMono() {
return mono;
}
-GBool GlobalParams::getPSAlwaysRasterize() {
- GBool rast;
-
- lockGlobalParams;
- rast = psAlwaysRasterize;
- unlockGlobalParams;
- return rast;
-}
-
GooString *GlobalParams::getTextEncodingName() {
GooString *s;
@@ -2016,12 +2006,6 @@ void GlobalParams::setPSRasterMono(GBool mono) {
unlockGlobalParams;
}
-void GlobalParams::setPSAlwaysRasterize(GBool always) {
- lockGlobalParams;
- psAlwaysRasterize = always;
- unlockGlobalParams;
-}
-
void GlobalParams::setTextEncoding(char *encodingName) {
lockGlobalParams;
delete textEncoding;
diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h
index be1d4b6..be14123 100644
--- a/poppler/GlobalParams.h
+++ b/poppler/GlobalParams.h
@@ -170,7 +170,6 @@ public:
GBool getPSUncompressPreloadedImages();
double getPSRasterResolution();
GBool getPSRasterMono();
- GBool getPSAlwaysRasterize();
GooString *getTextEncodingName();
EndOfLineKind getTextEOL();
GBool getTextPageBreaks();
@@ -225,7 +224,6 @@ public:
void setPSUncompressPreloadedImages(GBool uncomp);
void setPSRasterResolution(double res);
void setPSRasterMono(GBool mono);
- void setPSAlwaysRasterize(GBool always);
void setTextEncoding(char *encodingName);
GBool setTextEOL(char *s);
void setTextPageBreaks(GBool pageBreaks);
@@ -327,7 +325,6 @@ private:
GBool psRasterMono; // true to do PostScript rasterization
// in monochrome (gray); false to do it
// in color (RGB/CMYK)
- GBool psAlwaysRasterize; // force PostScript rasterization
GooString *textEncoding; // encoding (unicodeMap) to use for text
// output
EndOfLineKind textEOL; // type of EOL marker to use for text
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index f30f53e..8fa8410 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -1052,6 +1052,7 @@ PSOutputDev::PSOutputDev(const char *fileName, PDFDoc *doc,
int firstPage, int lastPage, PSOutMode modeA,
int paperWidthA, int paperHeightA, GBool duplexA,
int imgLLXA, int imgLLYA, int imgURXA, int imgURYA,
+ GBool forceRasterizeA,
GBool manualCtrlA,
PSOutCustomCodeCbk customCodeCbkA,
void *customCodeCbkDataA) {
@@ -1078,6 +1079,7 @@ PSOutputDev::PSOutputDev(const char *fileName, PDFDoc *doc,
customColors = NULL;
haveTextClip = gFalse;
t3String = NULL;
+ forceRasterize = forceRasterizeA;
// open file or pipe
if (!strcmp(fileName, "-")) {
@@ -1120,6 +1122,7 @@ PSOutputDev::PSOutputDev(PSOutputFunc outputFuncA, void *outputStreamA,
int firstPage, int lastPage, PSOutMode modeA,
int paperWidthA, int paperHeightA, GBool duplexA,
int imgLLXA, int imgLLYA, int imgURXA, int imgURYA,
+ GBool forceRasterizeA,
GBool manualCtrlA,
PSOutCustomCodeCbk customCodeCbkA,
void *customCodeCbkDataA) {
@@ -1143,6 +1146,7 @@ PSOutputDev::PSOutputDev(PSOutputFunc outputFuncA, void *outputStreamA,
customColors = NULL;
haveTextClip = gFalse;
t3String = NULL;
+ forceRasterize = forceRasterizeA;
init(outputFuncA, outputStreamA, psGeneric, psTitle,
doc, firstPage, lastPage, modeA,
@@ -3055,7 +3059,7 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
GBool useBinary;
GBool isGray;
- if (globalParams->getPSAlwaysRasterize()) {
+ if (forceRasterize) {
rasterize = gTrue;
} else {
scan = new PreScanOutputDev(doc);
diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h
index ed23c5c..82f8dfa 100644
--- a/poppler/PSOutputDev.h
+++ b/poppler/PSOutputDev.h
@@ -98,6 +98,7 @@ public:
GBool duplexA = gTrue,
int imgLLXA = 0, int imgLLYA = 0,
int imgURXA = 0, int imgURYA = 0,
+ GBool forceRasterizeA = gFalse,
GBool manualCtrlA = gFalse,
PSOutCustomCodeCbk customCodeCbkA = NULL,
void *customCodeCbkDataA = NULL);
@@ -111,6 +112,7 @@ public:
GBool duplexA = gTrue,
int imgLLXA = 0, int imgLLYA = 0,
int imgURXA = 0, int imgURYA = 0,
+ GBool forceRasterizeA = gFalse,
GBool manualCtrlA = gFalse,
PSOutCustomCodeCbk customCodeCbkA = NULL,
void *customCodeCbkDataA = NULL);
@@ -474,6 +476,7 @@ private:
GBool t3FillColorOnly; // operators should only use the fill color
GBool t3Cacheable; // cleared if char is not cacheable
GBool t3NeedsRestore; // set if a 'q' operator was issued
+ GBool forceRasterize; // forces the page to be rasterized into a image before printing
GBool displayText; // displayText
#if OPI_SUPPORT
commit 55d039ada063a9427de6dd59846ce1570ab26e9f
Author: Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
Date: Mon Mar 26 22:31:29 2012 +0200
CJK improvements
More info in the mailing list threads
* script names for vertical writing mode should be differentiated for CJK
* 2 workarounds for a Korean font on Microsoft Windows
diff --git a/fofi/FoFiTrueType.cc b/fofi/FoFiTrueType.cc
index 431910d..d0bc800 100644
--- a/fofi/FoFiTrueType.cc
+++ b/fofi/FoFiTrueType.cc
@@ -18,6 +18,7 @@
// Copyright (C) 2007 Carlos Garcia Campos <carlosgc at gnome.org>
// Copyright (C) 2008, 2009 Albert Astals Cid <aacid at kde.org>
// Copyright (C) 2008 Tomas Are Haavet <tomasare at gmail.com>
+// Copyright (C) 2012 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
@@ -2219,7 +2220,17 @@ Guint FoFiTrueType::charToTag(const char *tagName)
setup GSUB table data
Only supporting vertical text substitution.
*/
-int FoFiTrueType::setupGSUB(const char *tagName)
+int FoFiTrueType::setupGSUB(const char *scriptName)
+{
+ return setupGSUB(scriptName, NULL);
+}
+
+/*
+ setup GSUB table data
+ Only supporting vertical text substitution.
+*/
+int FoFiTrueType::setupGSUB(const char *scriptName,
+ const char *languageName)
{
Guint gsubTable;
unsigned int i;
@@ -2236,11 +2247,11 @@ int FoFiTrueType::setupGSUB(const char *tagName)
int x;
Guint pos;
- if (tagName == 0) {
+ if (scriptName == 0) {
gsubFeatureTable = 0;
return 0;
}
- scriptTag = charToTag(tagName);
+ scriptTag = charToTag(scriptName);
/* read GSUB Header */
if ((x = seekTable("GSUB")) < 0) {
return 0; /* GSUB table not found */
@@ -2277,11 +2288,25 @@ int FoFiTrueType::setupGSUB(const char *tagName)
/* read script table */
/* use default language system */
pos = gsubTable+scriptList+scriptTable;
- langSys = getU16BE(pos,&parsedOk);/* default language system */
+ langSys = 0;
+ if (languageName) {
+ Guint langTag = charToTag(languageName);
+ Guint langCount = getU16BE(pos+2,&parsedOk);
+ for (i = 0;i < langCount && langSys == 0;i++) {
+ tag = getU32BE(pos+4+i*(4+2),&parsedOk);
+ if (tag == langTag) {
+ langSys = getU16BE(pos+4+i*(4+2)+4,&parsedOk);
+ }
+ }
+ }
+ if (langSys == 0) {
+ /* default language system */
+ langSys = getU16BE(pos,&parsedOk);
+ }
/* read LangSys table */
if (langSys == 0) {
- /* no ldefault LangSys */
+ /* no default LangSys */
return 0;
}
@@ -2453,6 +2478,9 @@ int FoFiTrueType::checkGIDInCoverage(Guint coverage, Guint orgGID)
case 1:
count = getU16BE(pos,&parsedOk);
pos += 2;
+ // In some poor CJK fonts, key GIDs are not sorted,
+ // thus we cannot finish checking even when the range
+ // including orgGID seems to have already passed.
for (i = 0;i < count;i++) {
Guint gid;
@@ -2462,9 +2490,6 @@ int FoFiTrueType::checkGIDInCoverage(Guint coverage, Guint orgGID)
/* found */
index = i;
break;
- } else if (gid > orgGID) {
- /* not found */
- break;
}
}
break;
@@ -2481,13 +2506,13 @@ int FoFiTrueType::checkGIDInCoverage(Guint coverage, Guint orgGID)
pos += 2;
startIndex = getU16BE(pos,&parsedOk);
pos += 2;
+ // In some poor CJK fonts, key GIDs are not sorted,
+ // thus we cannot finish checking even when the range
+ // including orgGID seems to have already passed.
if (startGID <= orgGID && orgGID <= endGID) {
/* found */
index = startIndex+orgGID-startGID;
break;
- } else if (orgGID <= endGID) {
- /* not found */
- break;
}
}
break;
diff --git a/fofi/FoFiTrueType.h b/fofi/FoFiTrueType.h
index c2d7bd4..fb05ae9 100644
--- a/fofi/FoFiTrueType.h
+++ b/fofi/FoFiTrueType.h
@@ -16,6 +16,7 @@
// Copyright (C) 2006 Takashi Iwai <tiwai at suse.de>
// Copyright (C) 2007 Koji Otani <sho at bbr.jp>
// Copyright (C) 2011 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2012 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
@@ -165,7 +166,12 @@ public:
// Otherwise returns false. (Only useful for OpenType CFF fonts).
GBool getCFFBlock(char **start, int *length);
- int setupGSUB(const char *tagName);
+ // setup vert/vrt2 GSUB for default lang
+ int setupGSUB(const char *scriptName);
+
+ // setup vert/vrt2 GSUB for specified lang
+ int setupGSUB(const char *scriptName, const char* languageName);
+
private:
FoFiTrueType(char *fileA, int lenA, GBool freeFileDataA, int faceIndexA);
diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc
index ac4942d..b3016f4 100644
--- a/poppler/GfxFont.cc
+++ b/poppler/GfxFont.cc
@@ -28,6 +28,7 @@
// Copyright (C) 2011 Axel Strübing <axel.struebing at freenet.de>
// Copyright (C) 2011, 2012 Adrian Johnson <ajohnson at redneon.com>
// Copyright (C) 2012 Yi Yang <ahyangyi at gmail.com>
+// Copyright (C) 2012 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
@@ -2232,36 +2233,37 @@ int *GfxCIDFont::getCodeToGIDMap(FoFiTrueType *ff, int *mapsizep) {
static struct CMapListEntry {
const char *collection;
const char *scriptTag;
+ const char *languageTag;
const char *toUnicodeMap;
const char **CMaps;
} CMapList[] = {
{
"Adobe-CNS1",
- "kana",
+ "hani", "CHN ",
"Adobe-CNS1-UCS2",
adobe_cns1_cmaps,
},
{
"Adobe-GB1",
- "kana",
+ "hani", "CHN ",
"Adobe-GB1-UCS2",
adobe_gb1_cmaps,
},
{
"Adobe-Japan1",
- "kana",
+ "kana", "JAN ",
"Adobe-Japan1-UCS2",
adobe_japan1_cmaps,
},
{
"Adobe-Japan2",
- "kana",
+ "kana", "JAN ",
"Adobe-Japan2-UCS2",
adobe_japan2_cmaps,
},
{
"Adobe-Korea1",
- "kana",
+ "hang", "KOR ",
"Adobe-Korea1-UCS2",
adobe_korea1_cmaps,
},
@@ -2359,7 +2361,7 @@ int *GfxCIDFont::getCodeToGIDMap(FoFiTrueType *ff, int *mapsizep) {
cMap->decRefCnt();
}
}
- ff->setupGSUB(lp->scriptTag);
+ ff->setupGSUB(lp->scriptTag, lp->languageTag);
} else {
error(errSyntaxError, -1, "Unknown character collection {0:t}\n",
getCollection());
More information about the poppler
mailing list