[poppler] poppler/ArthurOutputDev.cc poppler/GlobalParams.cc poppler/GlobalParams.h poppler/SplashOutputDev.cc splash/SplashFontEngine.cc splash/SplashFontEngine.h splash/SplashFTFont.cc splash/SplashFTFontEngine.cc splash/SplashFTFontEngine.h splash/SplashFTFont.h
Albert Astals Cid
aacid at kemper.freedesktop.org
Wed May 20 15:40:10 PDT 2009
poppler/ArthurOutputDev.cc | 2 +
poppler/GlobalParams.cc | 20 +++++++++++
poppler/GlobalParams.h | 4 ++
poppler/SplashOutputDev.cc | 2 +
splash/SplashFTFont.cc | 76 ++++++++++++++++++++++++++-----------------
splash/SplashFTFont.h | 2 +
splash/SplashFTFontEngine.cc | 8 ++--
splash/SplashFTFontEngine.h | 6 ++-
splash/SplashFontEngine.cc | 4 +-
splash/SplashFontEngine.h | 2 +
10 files changed, 91 insertions(+), 35 deletions(-)
New commits:
commit af32d56af779edcc539b680e634755941d1bf45c
Author: Petr Gajdos <pgajdos at novell.com>
Date: Thu May 21 00:37:18 2009 +0200
Add the possibility of forcing no hinting of fonts
diff --git a/poppler/ArthurOutputDev.cc b/poppler/ArthurOutputDev.cc
index 22660c6..306fbfa 100644
--- a/poppler/ArthurOutputDev.cc
+++ b/poppler/ArthurOutputDev.cc
@@ -17,6 +17,7 @@
// Copyright (C) 2005-2009 Albert Astals Cid <aacid at kde.org>
// Copyright (C) 2008 Pino Toscano <pino at kde.org>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc at gnome.org>
+// Copyright (C) 2009 Petr Gajdos <pgajdos at novell.com>
//
// 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
@@ -105,6 +106,7 @@ void ArthurOutputDev::startDoc(XRef *xrefA) {
#endif
#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
globalParams->getEnableFreeType(),
+ globalParams->getForceNoFTAutoHinting(),
#endif
m_painter->testRenderHint(QPainter::TextAntialiasing));
}
diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index 9c42f36..13a54d2 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -19,6 +19,7 @@
// Copyright (C) 2006 Ed Catmur <ed at catmur.co.uk>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk at gmail.com>
// Copyright (C) 2007, 2009 Jonathan Kew <jonathan_kew at sil.org>
+// Copyright (C) 2009 Petr Gajdos <pgajdos at novell.com>
//
// 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
@@ -618,6 +619,7 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir)
enableFreeType = gTrue;
antialias = gTrue;
vectorAntialias = gTrue;
+ forceNoFTAutoHinting = gFalse;
strokeAdjust = gTrue;
screenType = screenUnset;
screenSize = -1;
@@ -1393,6 +1395,15 @@ GBool GlobalParams::getVectorAntialias() {
return f;
}
+GBool GlobalParams::getForceNoFTAutoHinting() {
+ GBool f;
+
+ lockGlobalParams;
+ f = forceNoFTAutoHinting;
+ unlockGlobalParams;
+ return f;
+}
+
GBool GlobalParams::getStrokeAdjust() {
GBool f;
@@ -1719,6 +1730,15 @@ GBool GlobalParams::setVectorAntialias(char *s) {
return ok;
}
+GBool GlobalParams::setForceNoFTAutoHinting(char *s) {
+ GBool ok;
+
+ lockGlobalParams;
+ ok = parseYesNo2(s, &forceNoFTAutoHinting);
+ unlockGlobalParams;
+ return ok;
+}
+
void GlobalParams::setStrokeAdjust(GBool adjust)
{
lockGlobalParams;
diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h
index a0e4ff0..ebc16fb 100644
--- a/poppler/GlobalParams.h
+++ b/poppler/GlobalParams.h
@@ -19,6 +19,7 @@
// Copyright (C) 2006 Kristian Høgsberg <krh at redhat.com>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk at gmail.com>
// Copyright (C) 2009 Jonathan Kew <jonathan_kew at sil.org>
+// Copyright (C) 2009 Petr Gajdos <pgajdos at novell.com>
//
// 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
@@ -202,6 +203,7 @@ public:
GBool getEnableFreeType();
GBool getAntialias();
GBool getVectorAntialias();
+ GBool getForceNoFTAutoHinting();
GBool getStrokeAdjust();
ScreenType getScreenType();
int getScreenSize();
@@ -245,6 +247,7 @@ public:
GBool setEnableFreeType(char *s);
GBool setAntialias(char *s);
GBool setVectorAntialias(char *s);
+ GBool setForceNoFTAutoHinting(char *s);
void setStrokeAdjust(GBool strokeAdjust);
void setScreenType(ScreenType st);
void setScreenSize(int size);
@@ -327,6 +330,7 @@ private:
GBool enableFreeType; // FreeType enable flag
GBool antialias; // anti-aliasing enable flag
GBool vectorAntialias; // vector anti-aliasing enable flag
+ GBool forceNoFTAutoHinting; // force to disable FT autohinting
GBool strokeAdjust; // stroke adjustment enable flag
ScreenType screenType; // halftone screen type
int screenSize; // screen matrix size
diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index dc4661a..ca44682 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -19,6 +19,7 @@
// Copyright (C) 2006 Krzysztof Kowalczyk <kkowalczyk at gmail.com>
// Copyright (C) 2006 Scott Turner <scotty1024 at mac.com>
// Copyright (C) 2007 Koji Otani <sho at bbr.jp>
+// Copyright (C) 2009 Petr Gajdos <pgajdos at novell.com>
//
// 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
@@ -708,6 +709,7 @@ void SplashOutputDev::startDoc(XRef *xrefA) {
#endif
#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
globalParams->getEnableFreeType(),
+ globalParams->getForceNoFTAutoHinting(),
#endif
allowAntialias &&
globalParams->getAntialias() &&
diff --git a/splash/SplashFTFont.cc b/splash/SplashFTFont.cc
index 7d5e308..4c62dc6 100644
--- a/splash/SplashFTFont.cc
+++ b/splash/SplashFTFont.cc
@@ -13,6 +13,7 @@
//
// Copyright (C) 2005, 2007-2009 Albert Astals Cid <aacid at kde.org>
// Copyright (C) 2006 Kristian Høgsberg <krh at bitplanet.net>
+// Copyright (C) 2009 Petr Gajdos <pgajdos at novell.com>
//
// 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
@@ -54,7 +55,8 @@ static int glyphPathCubicTo(const FT_Vector *ctrl1, const FT_Vector *ctrl2,
SplashFTFont::SplashFTFont(SplashFTFontFile *fontFileA, SplashCoord *matA,
SplashCoord *textMatA):
- SplashFont(fontFileA, matA, textMatA, fontFileA->engine->aa)
+ SplashFont(fontFileA, matA, textMatA, fontFileA->engine->aa),
+ noah(fontFileA->engine->noah)
{
FT_Face face;
double div;
@@ -194,23 +196,31 @@ GBool SplashFTFont::makeGlyph(int c, int xFrac, int yFrac,
return gFalse;
}
- // if we have the FT2 bytecode interpreter, autohinting won't be used
+ if (noah) {
+ if (FT_Load_Glyph(ff->face, gid,
+ aa ? FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP
+ : FT_LOAD_DEFAULT)) {
+ return gFalse;
+ }
+ } else {
+ // if we have the FT2 bytecode interpreter, autohinting won't be used
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
- if (FT_Load_Glyph(ff->face, gid,
- aa ? FT_LOAD_NO_BITMAP : FT_LOAD_DEFAULT)) {
- return gFalse;
- }
+ if (FT_Load_Glyph(ff->face, gid,
+ aa ? FT_LOAD_NO_BITMAP : FT_LOAD_DEFAULT)) {
+ return gFalse;
+ }
#else
- // FT2's autohinting doesn't always work very well (especially with
- // font subsets), so turn it off if anti-aliasing is enabled; if
- // anti-aliasing is disabled, this seems to be a tossup - some fonts
- // look better with hinting, some without, so leave hinting on
- if (FT_Load_Glyph(ff->face, gid,
- aa ? FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP
- : FT_LOAD_DEFAULT)) {
- return gFalse;
- }
+ // FT2's autohinting doesn't always work very well (especially with
+ // font subsets), so turn it off if anti-aliasing is enabled; if
+ // anti-aliasing is disabled, this seems to be a tossup - some fonts
+ // look better with hinting, some without, so leave hinting on
+ if (FT_Load_Glyph(ff->face, gid,
+ aa ? FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP
+ : FT_LOAD_DEFAULT)) {
+ return gFalse;
+ }
#endif
+ }
FT_Glyph_Metrics *glyphMetrics = &(ff->face->glyph->metrics);
// prelimirary values from FT_Glyph_Metrics
@@ -286,23 +296,31 @@ double SplashFTFont::getGlyphAdvance(int c)
return -1;
}
- // if we have the FT2 bytecode interpreter, autohinting won't be used
+ if (noah) {
+ if (FT_Load_Glyph(ff->face, gid,
+ aa ? FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP
+ : FT_LOAD_DEFAULT)) {
+ return -1;
+ }
+ } else {
+ // if we have the FT2 bytecode interpreter, autohinting won't be used
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
- if (FT_Load_Glyph(ff->face, gid,
- aa ? FT_LOAD_NO_BITMAP : FT_LOAD_DEFAULT)) {
- return -1;
- }
+ if (FT_Load_Glyph(ff->face, gid,
+ aa ? FT_LOAD_NO_BITMAP : FT_LOAD_DEFAULT)) {
+ return -1;
+ }
#else
- // FT2's autohinting doesn't always work very well (especially with
- // font subsets), so turn it off if anti-aliasing is enabled; if
- // anti-aliasing is disabled, this seems to be a tossup - some fonts
- // look better with hinting, some without, so leave hinting on
- if (FT_Load_Glyph(ff->face, gid,
- aa ? FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP
- : FT_LOAD_DEFAULT)) {
- return -1;
- }
+ // FT2's autohinting doesn't always work very well (especially with
+ // font subsets), so turn it off if anti-aliasing is enabled; if
+ // anti-aliasing is disabled, this seems to be a tossup - some fonts
+ // look better with hinting, some without, so leave hinting on
+ if (FT_Load_Glyph(ff->face, gid,
+ aa ? FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP
+ : FT_LOAD_DEFAULT)) {
+ return -1;
+ }
#endif
+ }
// 64.0 is 1 in 26.6 format
return ff->face->glyph->metrics.horiAdvance / 64.0 / size;
diff --git a/splash/SplashFTFont.h b/splash/SplashFTFont.h
index 804d89f..1881d8e 100644
--- a/splash/SplashFTFont.h
+++ b/splash/SplashFTFont.h
@@ -12,6 +12,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2007-2008 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2009 Petr Gajdos <pgajdos at novell.com>
//
// 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
@@ -67,6 +68,7 @@ private:
FT_Matrix textMatrix;
SplashCoord textScale;
double size;
+ GBool noah;
};
#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
diff --git a/splash/SplashFTFontEngine.cc b/splash/SplashFTFontEngine.cc
index 2296f5d..e7e3197 100644
--- a/splash/SplashFTFontEngine.cc
+++ b/splash/SplashFTFontEngine.cc
@@ -13,6 +13,7 @@
//
// Copyright (C) 2006 Takashi Iwai <tiwai at suse.de>
// Copyright (C) 2009 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2009 Petr Gajdos <pgajdos at novell.com>
//
// 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
@@ -57,10 +58,11 @@ static void fileWrite(void *stream, char *data, int len) {
// SplashFTFontEngine
//------------------------------------------------------------------------
-SplashFTFontEngine::SplashFTFontEngine(GBool aaA, FT_Library libA) {
+SplashFTFontEngine::SplashFTFontEngine(GBool aaA, GBool noahA, FT_Library libA) {
FT_Int major, minor, patch;
aa = aaA;
+ noah = noahA;
lib = libA;
// as of FT 2.1.8, CID fonts are indexed by CID instead of GID
@@ -69,13 +71,13 @@ SplashFTFontEngine::SplashFTFontEngine(GBool aaA, FT_Library libA) {
(major == 2 && (minor > 1 || (minor == 1 && patch > 7)));
}
-SplashFTFontEngine *SplashFTFontEngine::init(GBool aaA) {
+SplashFTFontEngine *SplashFTFontEngine::init(GBool aaA, GBool noahA) {
FT_Library libA;
if (FT_Init_FreeType(&libA)) {
return NULL;
}
- return new SplashFTFontEngine(aaA, libA);
+ return new SplashFTFontEngine(aaA, noahA, libA);
}
SplashFTFontEngine::~SplashFTFontEngine() {
diff --git a/splash/SplashFTFontEngine.h b/splash/SplashFTFontEngine.h
index 5bfe14a..2d4699c 100644
--- a/splash/SplashFTFontEngine.h
+++ b/splash/SplashFTFontEngine.h
@@ -12,6 +12,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2006 Takashi Iwai <tiwai at suse.de>
+// Copyright (C) 2009 Petr Gajdos <pgajdos at novell.com>
//
// 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
@@ -42,7 +43,7 @@ class SplashFontSrc;
class SplashFTFontEngine {
public:
- static SplashFTFontEngine *init(GBool aaA);
+ static SplashFTFontEngine *init(GBool aaA, GBool noahA);
~SplashFTFontEngine();
@@ -57,9 +58,10 @@ public:
private:
- SplashFTFontEngine(GBool aaA, FT_Library libA);
+ SplashFTFontEngine(GBool aaA, GBool noahA, FT_Library libA);
GBool aa;
+ GBool noah;
FT_Library lib;
GBool useCIDs;
diff --git a/splash/SplashFontEngine.cc b/splash/SplashFontEngine.cc
index 7487224..b089c88 100644
--- a/splash/SplashFontEngine.cc
+++ b/splash/SplashFontEngine.cc
@@ -12,6 +12,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2006 Takashi Iwai <tiwai at suse.de>
+// Copyright (C) 2009 Petr Gajdos <pgajdos at novell.com>
//
// 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
@@ -65,6 +66,7 @@ SplashFontEngine::SplashFontEngine(
#endif
#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
GBool enableFreeType,
+ GBool noah,
#endif
GBool aa) {
int i;
@@ -82,7 +84,7 @@ SplashFontEngine::SplashFontEngine(
#endif
#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
if (enableFreeType) {
- ftEngine = SplashFTFontEngine::init(aa);
+ ftEngine = SplashFTFontEngine::init(aa, noah);
} else {
ftEngine = NULL;
}
diff --git a/splash/SplashFontEngine.h b/splash/SplashFontEngine.h
index a28813d..009de60 100644
--- a/splash/SplashFontEngine.h
+++ b/splash/SplashFontEngine.h
@@ -12,6 +12,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2006 Takashi Iwai <tiwai at suse.de>
+// Copyright (C) 2009 Petr Gajdos <pgajdos at novell.com>
//
// 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
@@ -54,6 +55,7 @@ public:
#endif
#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
GBool enableFreeType,
+ GBool noah,
#endif
GBool aa);
More information about the poppler
mailing list