[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

pkgsrc/print/xpdf japanese font



>                                            千葉市中央区長洲
>                                                    藤原  誠
かなり古い話ですが、
| To: netbsd@re.soum.co.jp, tech-pkg-ja@jp.netbsd.org
| From: 藤原 誠/ Makoto Fujiwara <makoto@ki.nu>
| Subject: xpdf -> for Japanese pTeX/pLaTeX documents ?
| Date: Tue, 18 Jan 2005 22:53:12 +0900

藤> xpdf というのもありますね。
藤> (実は今は僕は日本語が表示出来ていないのですが)

この件、どなたかに教わって、次のような変更をしたら、日本語
の表示が出来ています。

どこかの srpm にあったものだと思います。
自分でも忘れてしまいそうなので、こちらにお送りしておきます。

やはり copyright を調べないと send-pr は出来ないですよね ?
---
(藤原)

Index: distinfo
===================================================================
RCS file: /e/owada/cvsync/pkgsrc/print/xpdf/distinfo,v
retrieving revision 1.17
diff -u -r1.17 distinfo
--- distinfo	22 Dec 2004 21:24:44 -0000	1.17
+++ distinfo	6 Feb 2005 05:00:29 -0000
@@ -22,3 +22,4 @@
 SHA1 (patch-an) = bf579a07e9b9868ed8d6a6450484c47ce9acaef0
 SHA1 (patch-ao) = fd25cab0255d24c4b55907b031f5f4ec68411576
 SHA1 (patch-ap) = 51d05bb8978003308e14274fc1ada4f1ace6d766
+SHA1 (patch-aq) = ddb65b5694f400dae263e29ca729ee680875ae8e
--- /dev/null	2005-04-12 00:11:16.000000000 +0900
+++ patches/patch-aq	2005-02-06 14:00:14.000000000 +0900
@@ -0,0 +1,96 @@
+--- xpdf/CharCodeToUnicode.h.orig	2004-01-22 10:26:45.000000000 +0900
++++ xpdf/CharCodeToUnicode.h	2005-02-05 08:20:29.000000000 +0900
+@@ -67,6 +67,10 @@
+   // Map a CharCode to Unicode.
+   int mapToUnicode(CharCode c, Unicode *u, int size);
+ 
++  // Return the mapping's length, i.e., one more than the max char
++  // code supported by the mapping.
++  CharCode getLength() { return mapLen; }
++
+ private:
+ 
+   void parseCMap1(int (*getCharFunc)(void *), void *data, int nBits);
+--- xpdf/SplashOutputDev.cc.orig	2004-01-22 10:26:45.000000000 +0900
++++ xpdf/SplashOutputDev.cc	2005-02-05 08:20:29.000000000 +0900
+@@ -497,15 +497,18 @@
+   FILE *tmpFile;
+   Gushort *codeToGID;
+   DisplayFontParam *dfp;
++  CharCodeToUnicode *ctu;
+   double m11, m12, m21, m22, w1, w2;
+   SplashCoord mat[4];
+   char *name;
+-  int c, substIdx, n, code;
++  Unicode uBuf[8];
++  int c, substIdx, n, code, cmap;
+ 
+   needFontUpdate = gFalse;
+   font = NULL;
+   tmpFileName = NULL;
+   substIdx = -1;
++  dfp = NULL;
+ 
+   if (!(gfxFont = state->getFont())) {
+     goto err1;
+@@ -544,7 +547,6 @@
+     } else if (!(fileName = gfxFont->getExtFontFile())) {
+ 
+       // look for a display font mapping or a substitute font
+-      dfp = NULL;
+       if (gfxFont->isCIDFont()) {
+ 	if (((GfxCIDFont *)gfxFont)->getCollection()) {
+ 	  dfp = globalParams->
+@@ -650,10 +652,48 @@
+       }
+       break;
+     case fontCIDType2:
+-      n = ((GfxCIDFont *)gfxFont)->getCIDToGIDLen();
+-      codeToGID = (Gushort *)gmalloc(n * sizeof(Gushort));
+-      memcpy(codeToGID, ((GfxCIDFont *)gfxFont)->getCIDToGID(),
+-	     n * sizeof(Gushort));
++      codeToGID = NULL;
++      n = 0;
++      if (dfp) {
++	// create a CID-to-GID mapping, via Unicode
++	if ((ctu = ((GfxCIDFont *)gfxFont)->getToUnicode())) {
++	  if ((ff = FoFiTrueType::load(fileName->getCString()))) {
++	    // look for a Unicode cmap
++	    for (cmap = 0; cmap < ff->getNumCmaps(); ++cmap) {
++	      if ((ff->getCmapPlatform(cmap) == 3 &&
++		   ff->getCmapEncoding(cmap) == 1) ||
++		  ff->getCmapPlatform(cmap) == 0) {
++		break;
++	      }
++	    }
++	    if (cmap < ff->getNumCmaps()) {
++	      // map CID -> Unicode -> GID
++	      n = ctu->getLength();
++	      codeToGID = (Gushort *)gmalloc(n * sizeof(Gushort));
++	      for (code = 0; code < n; ++code) {
++		if (ctu->mapToUnicode(code, uBuf, 8) > 0) {
++		  codeToGID[code] = ff->mapCodeToGID(cmap, uBuf[0]);
++		} else {
++		  codeToGID[code] = 0;
++		}
++	      }
++	    }
++	    delete ff;
++	  }
++	  ctu->decRefCnt();
++	} else {
++	  error(-1, "Couldn't find a mapping to Unicode for font '%s'",
++		gfxFont->getName() ? gfxFont->getName()->getCString()
++		                   : "(unnamed)");
++	}
++      } else {
++	if (((GfxCIDFont *)gfxFont)->getCIDToGID()) {
++	  n = ((GfxCIDFont *)gfxFont)->getCIDToGIDLen();
++	  codeToGID = (Gushort *)gmalloc(n * sizeof(Gushort));
++	  memcpy(codeToGID, ((GfxCIDFont *)gfxFont)->getCIDToGID(),
++		 n * sizeof(Gushort));
++	}
++      }
+       if (!(fontFile = fontEngine->loadTrueTypeFont(
+ 			   id,
+ 			   fileName->getCString(),