Commit b8c9b179 authored by Albert Astals Cid's avatar Albert Astals Cid

[xpdf303] Adapt better to what we did and what xpdf303 does

parent ea6bc195
......@@ -116,7 +116,6 @@ void ArthurOutputDev::startDoc(XRef *xrefA) {
#endif
#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
globalParams->getEnableFreeType(),
!globalParams->getDisableFreeTypeHinting(),
isHintingEnabled,
isSlightHinting,
#endif
......
......@@ -597,7 +597,6 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir)
textPageBreaks = gTrue;
textKeepTinyChars = gFalse;
enableFreeType = gTrue;
disableFreeTypeHinting = gFalse;
antialias = gTrue;
vectorAntialias = gTrue;
antialiasPrinting = gFalse;
......@@ -1667,15 +1666,6 @@ GBool GlobalParams::getEnableFreeType() {
return f;
}
GBool GlobalParams::getDisableFreeTypeHinting() {
GBool f;
lockGlobalParams;
f = disableFreeTypeHinting;
unlockGlobalParams;
return f;
}
GBool GlobalParams::getAntialias() {
GBool f;
......
......@@ -174,7 +174,6 @@ public:
GBool getTextPageBreaks();
GBool getTextKeepTinyChars();
GBool getEnableFreeType();
GBool getDisableFreeTypeHinting();
GBool getAntialias();
GBool getVectorAntialias();
GBool getAntialiasPrinting();
......
......@@ -1162,7 +1162,6 @@ SplashOutputDev::SplashOutputDev(SplashColorMode colorModeA,
vectorAntialias = allowAntialias &&
globalParams->getVectorAntialias() &&
colorMode != splashModeMono1;
enableAutoHinting = !globalParams->getDisableFreeTypeHinting();
enableFreeTypeHinting = gFalse;
enableSlightHinting = gFalse;
setupScreenParams(72.0, 72.0);
......@@ -1277,7 +1276,6 @@ void SplashOutputDev::startDoc(PDFDoc *docA) {
#endif
#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
globalParams->getEnableFreeType(),
enableAutoHinting,
enableFreeTypeHinting,
enableSlightHinting,
#endif
......@@ -3837,7 +3835,6 @@ void SplashOutputDev::setVectorAntialias(GBool vaa) {
void SplashOutputDev::setFreeTypeHinting(GBool enable, GBool enableSlightHintingA)
{
enableAutoHinting = gFalse;
enableFreeTypeHinting = enable;
enableSlightHinting = enableSlightHintingA;
}
......
......@@ -383,7 +383,6 @@ private:
GBool bitmapUpsideDown;
GBool allowAntialias;
GBool vectorAntialias;
GBool enableAutoHinting;
GBool enableFreeTypeHinting;
GBool enableSlightHinting;
GBool reverseVideo; // reverse video mode
......
......@@ -58,7 +58,6 @@ 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),
enableAutoHinting(fontFileA->engine->enableAutoHinting),
enableFreeTypeHinting(fontFileA->engine->enableFreeTypeHinting),
enableSlightHinting(fontFileA->engine->enableSlightHinting)
{
......@@ -233,30 +232,29 @@ GBool SplashFTFont::getGlyph(int c, int xFrac, int yFrac,
return SplashFont::getGlyph(c, xFrac, 0, bitmap, x0, y0, clip, clipRes);
}
static FT_Int32 getFTLoadFlags(GBool type1, GBool trueType, GBool aa,
GBool enableAutoHinting, GBool enableFreeTypeHinting, GBool enableSlightHinting)
static FT_Int32 getFTLoadFlags(GBool type1, GBool trueType, GBool aa, GBool enableFreeTypeHinting, GBool enableSlightHinting)
{
int ret = FT_LOAD_DEFAULT;
if (aa)
ret |= FT_LOAD_NO_BITMAP;
if (enableAutoHinting) {
if (trueType) {
// 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 (aa) {
ret |= FT_LOAD_NO_AUTOHINT;
}
} else if (type1) {
// Type 1 fonts seem to look better with 'light' hinting mode
if (enableFreeTypeHinting) {
if (enableSlightHinting) {
ret |= FT_LOAD_TARGET_LIGHT;
} else {
if (trueType) {
// 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 (aa) {
ret |= FT_LOAD_NO_AUTOHINT;
}
} else if (type1) {
// Type 1 fonts seem to look better with 'light' hinting mode
ret |= FT_LOAD_TARGET_LIGHT;
}
}
} else if (enableFreeTypeHinting) {
if (enableSlightHinting)
ret |= FT_LOAD_TARGET_LIGHT;
} else {
ret |= FT_LOAD_NO_HINTING;
}
......@@ -287,7 +285,7 @@ GBool SplashFTFont::makeGlyph(int c, int xFrac, int yFrac,
gid = (FT_UInt)c;
}
if (FT_Load_Glyph(ff->face, gid, getFTLoadFlags(ff->type1, ff->trueType, aa, enableAutoHinting, enableFreeTypeHinting, enableSlightHinting))) {
if (FT_Load_Glyph(ff->face, gid, getFTLoadFlags(ff->type1, ff->trueType, aa, enableFreeTypeHinting, enableSlightHinting))) {
return gFalse;
}
......@@ -376,7 +374,7 @@ double SplashFTFont::getGlyphAdvance(int c)
return -1;
}
if (FT_Load_Glyph(ff->face, gid, getFTLoadFlags(ff->type1, ff->trueType, aa, enableAutoHinting, enableFreeTypeHinting, enableSlightHinting))) {
if (FT_Load_Glyph(ff->face, gid, getFTLoadFlags(ff->type1, ff->trueType, aa, enableFreeTypeHinting, enableSlightHinting))) {
return -1;
}
......@@ -424,7 +422,7 @@ SplashPath *SplashFTFont::getGlyphPath(int c) {
// skip the TrueType notdef glyph
return NULL;
}
if (FT_Load_Glyph(ff->face, gid, getFTLoadFlags(ff->type1, ff->trueType, aa, enableAutoHinting, enableFreeTypeHinting, enableSlightHinting))) {
if (FT_Load_Glyph(ff->face, gid, getFTLoadFlags(ff->type1, ff->trueType, aa, enableFreeTypeHinting, enableSlightHinting))) {
return NULL;
}
if (FT_Get_Glyph(slot, &glyph)) {
......
......@@ -71,7 +71,6 @@ private:
FT_Matrix textMatrix;
SplashCoord textScale;
int size;
GBool enableAutoHinting;
GBool enableFreeTypeHinting;
GBool enableSlightHinting;
};
......
......@@ -59,12 +59,11 @@ static void fileWrite(void *stream, const char *data, int len) {
// SplashFTFontEngine
//------------------------------------------------------------------------
SplashFTFontEngine::SplashFTFontEngine(GBool aaA, GBool enableAutoHintingA, GBool enableFreeTypeHintingA,
SplashFTFontEngine::SplashFTFontEngine(GBool aaA, GBool enableFreeTypeHintingA,
GBool enableSlightHintingA, FT_Library libA) {
FT_Int major, minor, patch;
aa = aaA;
enableAutoHinting = enableAutoHintingA;
enableFreeTypeHinting = enableFreeTypeHintingA;
enableSlightHinting = enableSlightHintingA;
lib = libA;
......@@ -75,14 +74,14 @@ SplashFTFontEngine::SplashFTFontEngine(GBool aaA, GBool enableAutoHintingA, GBoo
(major == 2 && (minor > 1 || (minor == 1 && patch > 7)));
}
SplashFTFontEngine *SplashFTFontEngine::init(GBool aaA, GBool enableAutoHintingA, GBool enableFreeTypeHintingA,
SplashFTFontEngine *SplashFTFontEngine::init(GBool aaA, GBool enableFreeTypeHintingA,
GBool enableSlightHintingA) {
FT_Library libA;
if (FT_Init_FreeType(&libA)) {
return NULL;
}
return new SplashFTFontEngine(aaA, enableAutoHintingA, enableFreeTypeHintingA, enableSlightHintingA, libA);
return new SplashFTFontEngine(aaA, enableFreeTypeHintingA, enableSlightHintingA, libA);
}
SplashFTFontEngine::~SplashFTFontEngine() {
......
......@@ -45,7 +45,7 @@ class SplashFontSrc;
class SplashFTFontEngine {
public:
static SplashFTFontEngine *init(GBool aaA, GBool enableAutoHintingA, GBool enableFreeTypeHintingA, GBool enableSlightHinting);
static SplashFTFontEngine *init(GBool aaA, GBool enableFreeTypeHintingA, GBool enableSlightHinting);
~SplashFTFontEngine();
......@@ -61,10 +61,9 @@ public:
private:
SplashFTFontEngine(GBool aaA, GBool enableAutoHintingA, GBool enableFreeTypeHintingA, GBool enableSlightHintingA, FT_Library libA);
SplashFTFontEngine(GBool aaA, GBool enableFreeTypeHintingA, GBool enableSlightHintingA, FT_Library libA);
GBool aa;
GBool enableAutoHinting;
GBool enableFreeTypeHinting;
GBool enableSlightHinting;
FT_Library lib;
......
......@@ -69,7 +69,6 @@ SplashFontEngine::SplashFontEngine(
#endif
#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
GBool enableFreeType,
GBool enableAutoHinting,
GBool enableFreeTypeHinting,
GBool enableSlightHinting,
#endif
......@@ -89,7 +88,7 @@ SplashFontEngine::SplashFontEngine(
#endif
#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
if (enableFreeType) {
ftEngine = SplashFTFontEngine::init(aa, enableAutoHinting, enableFreeTypeHinting, enableSlightHinting);
ftEngine = SplashFTFontEngine::init(aa, enableFreeTypeHinting, enableSlightHinting);
} else {
ftEngine = NULL;
}
......
......@@ -58,7 +58,6 @@ public:
#endif
#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
GBool enableFreeType,
GBool enabbleAutoHinting,
GBool enableFreeTypeHinting,
GBool enableSlightHinting,
#endif
......
......@@ -369,7 +369,7 @@ int main(int argc, char *argv[]) {
#if SPLASH_CMYK
(jpegcmyk || overprint) ? splashModeCMYK8 :
#endif
splashModeRGB8, 4,
splashModeBGR8, 4,
gFalse, paperColor);
splashOut->startDoc(doc);
if (sz != 0) w = h = sz;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment