diff options
author | Norikatsu Shigemura <nork@FreeBSD.org> | 2004-04-19 10:55:30 +0000 |
---|---|---|
committer | Norikatsu Shigemura <nork@FreeBSD.org> | 2004-04-19 10:55:30 +0000 |
commit | 83f729088fde99ec65f6516eb19c567a5145a9dc (patch) | |
tree | b9ee0817d255bdcbcb563338f227534494bd9770 /graphics/xpdf | |
parent | remove broken by upgrading to 2.1.b (diff) |
o Fix broken handling True Type (multibyte) fonts.
o Accordingly bump PORTREVISION.
Obtained from: Debian-JP and Vine Linux(VineSeed)
Approved by: dougb (maintainer)
Notes
Notes:
svn path=/head/; revision=107566
Diffstat (limited to 'graphics/xpdf')
-rw-r--r-- | graphics/xpdf/Makefile | 1 | ||||
-rw-r--r-- | graphics/xpdf/files/patch-truetype.patch | 352 |
2 files changed, 353 insertions, 0 deletions
diff --git a/graphics/xpdf/Makefile b/graphics/xpdf/Makefile index 4a552ac1596c..1134a558a634 100644 --- a/graphics/xpdf/Makefile +++ b/graphics/xpdf/Makefile @@ -7,6 +7,7 @@ PORTNAME= xpdf PORTVERSION= 3.00 +PORTREVISION= 1 CATEGORIES= graphics print MASTER_SITES= ftp://ftp.foolabs.com/pub/xpdf/ \ ${MASTER_SITE_TEX_CTAN} diff --git a/graphics/xpdf/files/patch-truetype.patch b/graphics/xpdf/files/patch-truetype.patch new file mode 100644 index 000000000000..2337ed71f198 --- /dev/null +++ b/graphics/xpdf/files/patch-truetype.patch @@ -0,0 +1,352 @@ +--- splash/Splash.cc.orig Thu Jan 22 10:26:44 2004 ++++ splash/Splash.cc Fri Mar 5 21:37:59 2004 +@@ -952,7 +952,7 @@ + } + + SplashError Splash::fillChar(SplashCoord x, SplashCoord y, +- int c, SplashFont *font) { ++ int c, SplashFont *font, Unicode *u) { + SplashGlyphBitmap glyph; + int x0, y0, xFrac, yFrac; + SplashError err; +@@ -965,7 +965,7 @@ + xFrac = splashFloor((x - x0) * splashFontFraction); + y0 = splashFloor(y); + yFrac = splashFloor((y - y0) * splashFontFraction); +- if (!font->getGlyph(c, xFrac, yFrac, &glyph)) { ++ if (!font->getGlyph(c, xFrac, yFrac, &glyph, u)) { + return splashErrNoGlyph; + } + err = fillGlyph(x, y, &glyph); +--- splash/Splash.h.orig Thu Jan 22 10:26:44 2004 ++++ splash/Splash.h Fri Mar 5 21:37:59 2004 +@@ -104,7 +104,7 @@ + SplashError xorFill(SplashPath *path, GBool eo); + + // Draw a character, using the current fill pattern. +- SplashError fillChar(SplashCoord x, SplashCoord y, int c, SplashFont *font); ++ SplashError fillChar(SplashCoord x, SplashCoord y, int c, SplashFont *font, Unicode *u); + + // Draw a glyph, using the current fill pattern. This function does + // not free any data, i.e., it ignores glyph->freeData. +--- splash/SplashFTFont.cc.orig Thu Jan 22 10:26:44 2004 ++++ splash/SplashFTFont.cc Fri Mar 5 21:37:59 2004 +@@ -125,12 +125,12 @@ + } + + GBool SplashFTFont::getGlyph(int c, int xFrac, int yFrac, +- SplashGlyphBitmap *bitmap) { +- return SplashFont::getGlyph(c, xFrac, 0, bitmap); ++ SplashGlyphBitmap *bitmap, Unicode *u) { ++ return SplashFont::getGlyph(c, xFrac, 0, bitmap, u); + } + + GBool SplashFTFont::makeGlyph(int c, int xFrac, int yFrac, +- SplashGlyphBitmap *bitmap) { ++ SplashGlyphBitmap *bitmap, Unicode *u) { + SplashFTFontFile *ff; + FT_Vector offset; + FT_GlyphSlot slot; +@@ -147,11 +147,21 @@ + FT_Set_Transform(ff->face, &matrix, &offset); + slot = ff->face->glyph; + ++#if 1 + if (ff->codeToGID && c < ff->codeToGIDLen) { + gid = (FT_UInt)ff->codeToGID[c]; ++ } else if (ff->modeUnicode) { ++ gid = FT_Get_Char_Index(ff->face, (FT_ULong)*u); + } else { + gid = (FT_UInt)c; + } ++#else ++ if (ff->codeToGID && c < ff->codeToGIDLen) { ++ gid = (FT_UInt)ff->codeToGID[c]; ++ } else { ++ gid = (FT_UInt)c; ++ } ++#endif + + // if we have the FT2 bytecode interpreter, autohinting won't be used + #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER +@@ -196,7 +206,7 @@ + return gTrue; + } + +-SplashPath *SplashFTFont::getGlyphPath(int c) { ++SplashPath *SplashFTFont::getGlyphPath(int c, Unicode *u) { + static FT_Outline_Funcs outlineFuncs = { + &glyphPathMoveTo, + &glyphPathLineTo, +@@ -214,11 +224,21 @@ + ff->face->size = sizeObj; + FT_Set_Transform(ff->face, &matrix, NULL); + slot = ff->face->glyph; ++#if 1 ++ if (ff->codeToGID && c < ff->codeToGIDLen) { ++ gid = (FT_UInt)ff->codeToGID[c]; ++ } else if (ff->modeUnicode) { ++ gid = FT_Get_Char_Index(ff->face, (FT_ULong)*u); ++ } else { ++ gid = (FT_UInt)c; ++ } ++#else + if (ff->codeToGID && c < ff->codeToGIDLen) { + gid = ff->codeToGID[c]; + } else { + gid = (FT_UInt)c; + } ++#endif + if (FT_Load_Glyph(ff->face, gid, FT_LOAD_DEFAULT)) { + return NULL; + } +--- splash/SplashFTFont.h.orig Thu Jan 22 10:26:44 2004 ++++ splash/SplashFTFont.h Fri Mar 5 21:37:59 2004 +@@ -33,15 +33,15 @@ + + // Munge xFrac and yFrac before calling SplashFont::getGlyph. + virtual GBool getGlyph(int c, int xFrac, int yFrac, +- SplashGlyphBitmap *bitmap); ++ SplashGlyphBitmap *bitmap, Unicode *u); + + // Rasterize a glyph. The <xFrac> and <yFrac> values are the same + // as described for getGlyph. + virtual GBool makeGlyph(int c, int xFrac, int yFrac, +- SplashGlyphBitmap *bitmap); ++ SplashGlyphBitmap *bitmap, Unicode *u); + + // Return the path for a glyph. +- virtual SplashPath *getGlyphPath(int c); ++ virtual SplashPath *getGlyphPath(int c, Unicode *u); + + private: + +--- splash/SplashFTFontEngine.cc.orig Thu Jan 22 10:26:44 2004 ++++ splash/SplashFTFontEngine.cc Fri Mar 5 21:38:00 2004 +@@ -107,7 +107,12 @@ + SplashFontFile *ret; + + if (!(ff = FoFiTrueType::load(fileName))) { +- return NULL; ++ ret = SplashFTFontFile::loadTrueTypeFont(this, idA, ++ fileName, gTrue, ++ codeToGID, codeToGIDLen); ++ ++ delete ff; ++ return ret; + } + tmpFileName = NULL; + if (!openTempFile(&tmpFileName, &tmpFile, "wb", NULL)) { +--- splash/SplashFTFontFile.cc.orig Thu Jan 22 10:26:44 2004 ++++ splash/SplashFTFontFile.cc Fri Mar 5 21:38:00 2004 +@@ -43,7 +43,7 @@ + } + + return new SplashFTFontFile(engineA, idA, fileNameA, deleteFileA, +- faceA, codeToGIDA, 256); ++ faceA, gFalse, codeToGIDA, 256); + } + + SplashFontFile *SplashFTFontFile::loadCIDFont(SplashFTFontEngine *engineA, +@@ -59,7 +59,7 @@ + } + + return new SplashFTFontFile(engineA, idA, fileNameA, deleteFileA, +- faceA, codeToGIDA, codeToGIDLenA); ++ faceA, gFalse, codeToGIDA, codeToGIDLenA); + } + + SplashFontFile *SplashFTFontFile::loadTrueTypeFont(SplashFTFontEngine *engineA, +@@ -69,19 +69,39 @@ + Gushort *codeToGIDA, + int codeToGIDLenA) { + FT_Face faceA; ++ GBool modeUnicodeA = gFalse; + + if (FT_New_Face(engineA->lib, fileNameA, 0, &faceA)) { + return NULL; + } + ++#if 1 ++ if (!codeToGIDLenA) { ++ int i; ++ modeUnicodeA = gTrue; ++ ++ for (i = 0; i < faceA->num_charmaps; ++i) { ++ if ((faceA->charmaps[i]->platform_id == 3 && ++ faceA->charmaps[i]->encoding_id == 1) || ++ faceA->charmaps[i]->platform_id == 0) { ++ break; ++ } ++ } ++ if (i == faceA->num_charmaps) { ++ i = 0; ++ } ++ if (i) FT_Set_Charmap(faceA, faceA->charmaps[i]); ++ } ++#endif ++ + return new SplashFTFontFile(engineA, idA, fileNameA, deleteFileA, +- faceA, codeToGIDA, codeToGIDLenA); ++ faceA, modeUnicodeA, codeToGIDA, codeToGIDLenA); + } + + SplashFTFontFile::SplashFTFontFile(SplashFTFontEngine *engineA, + SplashFontFileID *idA, + char *fileNameA, GBool deleteFileA, +- FT_Face faceA, ++ FT_Face faceA, GBool modeUnicodeA, + Gushort *codeToGIDA, int codeToGIDLenA): + SplashFontFile(idA, fileNameA, deleteFileA) + { +@@ -89,6 +109,7 @@ + face = faceA; + codeToGID = codeToGIDA; + codeToGIDLen = codeToGIDLenA; ++ modeUnicode = modeUnicodeA; + } + + SplashFTFontFile::~SplashFTFontFile() { +--- splash/SplashFTFontFile.h.orig Thu Jan 22 10:26:44 2004 ++++ splash/SplashFTFontFile.h Fri Mar 5 21:38:00 2004 +@@ -53,13 +53,14 @@ + SplashFTFontFile(SplashFTFontEngine *engineA, + SplashFontFileID *idA, + char *fileNameA, GBool deleteFileA, +- FT_Face faceA, ++ FT_Face faceA, GBool modeUnicodeA, + Gushort *codeToGIDA, int codeToGIDLenA); + + SplashFTFontEngine *engine; + FT_Face face; + Gushort *codeToGID; + int codeToGIDLen; ++ GBool modeUnicode; + + friend class SplashFTFont; + }; +--- splash/SplashFont.cc.orig Thu Jan 22 10:26:44 2004 ++++ splash/SplashFont.cc Fri Mar 5 21:38:00 2004 +@@ -89,7 +89,7 @@ + } + + GBool SplashFont::getGlyph(int c, int xFrac, int yFrac, +- SplashGlyphBitmap *bitmap) { ++ SplashGlyphBitmap *bitmap, Unicode *u) { + SplashGlyphBitmap bitmap2; + int size; + Guchar *p; +@@ -122,7 +122,7 @@ + } + + // generate the glyph bitmap +- if (!makeGlyph(c, xFrac, yFrac, &bitmap2)) { ++ if (!makeGlyph(c, xFrac, yFrac, &bitmap2, u)) { + return gFalse; + } + +--- splash/SplashFont.h.orig Thu Jan 22 10:26:44 2004 ++++ splash/SplashFont.h Fri Mar 5 21:38:00 2004 +@@ -61,15 +61,15 @@ + // should override this to zero out xFrac and/or yFrac if they don't + // support fractional coordinates. + virtual GBool getGlyph(int c, int xFrac, int yFrac, +- SplashGlyphBitmap *bitmap); ++ SplashGlyphBitmap *bitmap, Unicode *u); + + // Rasterize a glyph. The <xFrac> and <yFrac> values are the same + // as described for getGlyph. + virtual GBool makeGlyph(int c, int xFrac, int yFrac, +- SplashGlyphBitmap *bitmap) = 0; ++ SplashGlyphBitmap *bitmap, Unicode *u) = 0; + + // Return the path for a glyph. +- virtual SplashPath *getGlyphPath(int c) = 0; ++ virtual SplashPath *getGlyphPath(int c, Unicode *u) = 0; + + protected: + +--- splash/SplashT1Font.cc.orig Thu Jan 22 10:26:44 2004 ++++ splash/SplashT1Font.cc Fri Mar 5 21:38:00 2004 +@@ -171,12 +171,12 @@ + } + + GBool SplashT1Font::getGlyph(int c, int xFrac, int yFrac, +- SplashGlyphBitmap *bitmap) { +- return SplashFont::getGlyph(c, 0, 0, bitmap); ++ SplashGlyphBitmap *bitmap, Unicode *u) { ++ return SplashFont::getGlyph(c, 0, 0, bitmap, u); + } + + GBool SplashT1Font::makeGlyph(int c, int xFrac, int yFrac, +- SplashGlyphBitmap *bitmap) { ++ SplashGlyphBitmap *bitmap, Unicode *u) { + GLYPH *glyph; + int n, i; + +@@ -209,7 +209,7 @@ + return gTrue; + } + +-SplashPath *SplashT1Font::getGlyphPath(int c) { ++SplashPath *SplashT1Font::getGlyphPath(int c, Unicode *u) { + SplashPath *path; + T1_OUTLINE *outline; + T1_PATHSEGMENT *seg; +--- splash/SplashT1Font.h.orig Thu Jan 22 10:26:44 2004 ++++ splash/SplashT1Font.h Fri Mar 5 21:38:00 2004 +@@ -30,15 +30,15 @@ + + // Munge xFrac and yFrac before calling SplashFont::getGlyph. + virtual GBool getGlyph(int c, int xFrac, int yFrac, +- SplashGlyphBitmap *bitmap); ++ SplashGlyphBitmap *bitmap, Unicode *u); + + // Rasterize a glyph. The <xFrac> and <yFrac> values are the same + // as described for getGlyph. + virtual GBool makeGlyph(int c, int xFrac, int yFrac, +- SplashGlyphBitmap *bitmap); ++ SplashGlyphBitmap *bitmap, Unicode *u); + + // Return the path for a glyph. +- virtual SplashPath *getGlyphPath(int c); ++ virtual SplashPath *getGlyphPath(int c, Unicode *u); + + private: + +--- splash/SplashTypes.h.orig Thu Jan 22 10:26:44 2004 ++++ splash/SplashTypes.h Fri Mar 5 21:38:00 2004 +@@ -9,6 +9,7 @@ + + #include <aconf.h> + #include "gtypes.h" ++#include "../xpdf/CharTypes.h" + + //------------------------------------------------------------------------ + // coordinates +--- xpdf/SplashOutputDev.cc.orig Thu Jan 22 10:26:45 2004 ++++ xpdf/SplashOutputDev.cc Fri Mar 5 21:38:00 2004 +@@ -823,12 +823,12 @@ + + // fill + if (!(render & 1)) { +- splash->fillChar((SplashCoord)x1, (SplashCoord)y1, code, font); ++ splash->fillChar((SplashCoord)x1, (SplashCoord)y1, code, font, u); + } + + // stroke + if ((render & 3) == 1 || (render & 3) == 2) { +- if ((path = font->getGlyphPath(code))) { ++ if ((path = font->getGlyphPath(code, u))) { + path->offset((SplashCoord)x1, (SplashCoord)y1); + splash->stroke(path); + delete path; +@@ -837,7 +837,7 @@ + + // clip + if (render & 4) { +- path = font->getGlyphPath(code); ++ path = font->getGlyphPath(code, u); + path->offset((SplashCoord)x1, (SplashCoord)y1); + if (textClipPath) { + textClipPath->append(path); |