[poppler] Branch 'xpdf303merge' - 2 commits - splash/SplashFTFontFile.cc splash/SplashFTFontFile.h splash/SplashT1Font.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Thu Oct 13 03:22:44 PDT 2011


 splash/SplashFTFontFile.cc |    9 +++++----
 splash/SplashFTFontFile.h  |    3 ++-
 splash/SplashT1Font.cc     |   39 +++++++++++++++++++++------------------
 3 files changed, 28 insertions(+), 23 deletions(-)

New commits:
commit 087757866de13b6164967a1d241d3c0e47065f1a
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu Oct 13 12:18:52 2011 +0200

    xpdf303: Merge SplashT1Font::getGlyphPath changes

diff --git a/splash/SplashT1Font.cc b/splash/SplashT1Font.cc
index 89813de..0fdfaaf 100644
--- a/splash/SplashT1Font.cc
+++ b/splash/SplashT1Font.cc
@@ -239,13 +239,12 @@ SplashPath *SplashT1Font::getGlyphPath(int c) {
   T1_OUTLINE *outline;
   T1_PATHSEGMENT *seg;
   T1_BEZIERSEGMENT *bez;
-  SplashCoord x, y, x1, y1;
+  int x, y, x1, y1;
   GBool needClose;
 
   if (outlineID < 0) {
     outlineID = T1_CopyFont(((SplashT1FontFile *)fontFile)->t1libID);
-    outlineSize = (float)splashSqrt(textMat[2]*textMat[2] +
-				    textMat[3]*textMat[3]);
+    outlineSize = (float)splashDist(0, 0, textMat[2], textMat[3]);
     matrix.cxx = (double)textMat[0] / outlineSize;
     matrix.cxy = (double)textMat[1] / outlineSize;
     matrix.cyx = (double)textMat[2] / outlineSize;
@@ -259,8 +258,11 @@ SplashPath *SplashT1Font::getGlyphPath(int c) {
 
   path = new SplashPath();
   if ((outline = T1_GetCharOutline(outlineID, c, outlineSize, NULL))) {
-    x = 0;
-    y = 0;
+    // NB: t1lib uses integer coordinates here; we keep a running
+    // (x,y) total as integers, so that the final point in the path is
+    // exactly the same as the first point, thus avoiding weird
+    // mitered join glitches
+    x = y = 0;
     needClose = gFalse;
     for (seg = outline; seg; seg = seg->link) {
       switch (seg->type) {
@@ -269,25 +271,26 @@ SplashPath *SplashT1Font::getGlyphPath(int c) {
 	  path->close();
 	  needClose = gFalse;
 	}
-	x += seg->dest.x * outlineMul;
-	y += seg->dest.y * outlineMul;
-	path->moveTo(x, -y);
+	x += seg->dest.x;
+	y += seg->dest.y;
+	path->moveTo(outlineMul * x, -outlineMul * y);
 	break;
       case T1_PATHTYPE_LINE:
-	x += seg->dest.x * outlineMul;
-	y += seg->dest.y * outlineMul;
-	path->lineTo(x, -y);
+	x += seg->dest.x;
+	y += seg->dest.y;
+	path->lineTo(outlineMul * x, -outlineMul * y);
 	needClose = gTrue;
 	break;
       case T1_PATHTYPE_BEZIER:
 	bez = (T1_BEZIERSEGMENT *)seg;
-	x1 = x + (SplashCoord)(bez->dest.x * outlineMul);
-	y1 = y + (SplashCoord)(bez->dest.y * outlineMul);
-	path->curveTo(x + (SplashCoord)(bez->B.x * outlineMul),
-		      -(y + (SplashCoord)(bez->B.y * outlineMul)),
-		      x + (SplashCoord)(bez->C.x * outlineMul),
-		      -(y + (SplashCoord)(bez->C.y * outlineMul)),
-		      x1, -y1);
+	x1 = x + bez->dest.x;
+	y1 = y + bez->dest.y;
+	path->curveTo(outlineMul * (x + bez->B.x),
+		      -outlineMul * (y + bez->B.y),
+		      outlineMul * (x + bez->C.x),
+		      -outlineMul * (y + bez->C.y),
+		      outlineMul * x1,
+		      -outlineMul * y1);
 	x = x1;
 	y = y1;
 	needClose = gTrue;
commit c84f46ee16a8dcc6e2cad2359df621cc6cdb8fa5
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu Oct 13 12:16:14 2011 +0200

    xpdf303: Add GBool type1 to SplashFTFontFile

diff --git a/splash/SplashFTFontFile.cc b/splash/SplashFTFontFile.cc
index 5bedb1a..34f6ce5 100644
--- a/splash/SplashFTFontFile.cc
+++ b/splash/SplashFTFontFile.cc
@@ -61,7 +61,7 @@ SplashFontFile *SplashFTFontFile::loadType1Font(SplashFTFontEngine *engineA,
   }
 
   return new SplashFTFontFile(engineA, idA, src,
-			      faceA, codeToGIDA, 256, gFalse);
+			      faceA, codeToGIDA, 256, gFalse, gTrue);
 }
 
 SplashFontFile *SplashFTFontFile::loadCIDFont(SplashFTFontEngine *engineA,
@@ -80,7 +80,7 @@ SplashFontFile *SplashFTFontFile::loadCIDFont(SplashFTFontEngine *engineA,
   }
 
   return new SplashFTFontFile(engineA, idA, src,
-			      faceA, codeToGIDA, codeToGIDLenA, gFalse);
+			      faceA, codeToGIDA, codeToGIDLenA, gFalse, gFalse);
 }
 
 SplashFontFile *SplashFTFontFile::loadTrueTypeFont(SplashFTFontEngine *engineA,
@@ -100,7 +100,7 @@ SplashFontFile *SplashFTFontFile::loadTrueTypeFont(SplashFTFontEngine *engineA,
   }
 
   return new SplashFTFontFile(engineA, idA, src,
-			      faceA, codeToGIDA, codeToGIDLenA, gTrue);
+			      faceA, codeToGIDA, codeToGIDLenA, gTrue, gFalse);
 }
 
 SplashFTFontFile::SplashFTFontFile(SplashFTFontEngine *engineA,
@@ -108,7 +108,7 @@ SplashFTFontFile::SplashFTFontFile(SplashFTFontEngine *engineA,
 				   SplashFontSrc *src,
 				   FT_Face faceA,
 				   int *codeToGIDA, int codeToGIDLenA,
-				   GBool trueTypeA):
+				   GBool trueTypeA, GBool type1A):
   SplashFontFile(idA, src)
 {
   engine = engineA;
@@ -116,6 +116,7 @@ SplashFTFontFile::SplashFTFontFile(SplashFTFontEngine *engineA,
   codeToGID = codeToGIDA;
   codeToGIDLen = codeToGIDLenA;
   trueType = trueTypeA;
+  type1 = type1A;
 }
 
 SplashFTFontFile::~SplashFTFontFile() {
diff --git a/splash/SplashFTFontFile.h b/splash/SplashFTFontFile.h
index f4a9ebd..d642af0 100644
--- a/splash/SplashFTFontFile.h
+++ b/splash/SplashFTFontFile.h
@@ -69,13 +69,14 @@ private:
 		   SplashFontSrc *src,
 		   FT_Face faceA,
 		   int *codeToGIDA, int codeToGIDLenA,
-		   GBool trueTypeA);
+		   GBool trueTypeA, GBool type1A);
 
   SplashFTFontEngine *engine;
   FT_Face face;
   int *codeToGID;
   int codeToGIDLen;
   GBool trueType;
+  GBool type1;
 
   friend class SplashFTFont;
 };


More information about the poppler mailing list