texlive[44817] Build/source/texk/makejvf: makejvf: Add enhanced mode

commits+hironobu at tug.org commits+hironobu at tug.org
Sun Jul 16 05:19:50 CEST 2017


Revision: 44817
          http://tug.org/svn/texlive?view=revision&revision=44817
Author:   hironobu
Date:     2017-07-16 05:19:50 +0200 (Sun, 16 Jul 2017)
Log Message:
-----------
makejvf: Add enhanced mode (version 20170716)

Modified Paths:
--------------
    trunk/Build/source/texk/makejvf/COPYRIGHT
    trunk/Build/source/texk/makejvf/ChangeLog
    trunk/Build/source/texk/makejvf/main.c
    trunk/Build/source/texk/makejvf/makejvf.h
    trunk/Build/source/texk/makejvf/tfmread.c
    trunk/Build/source/texk/makejvf/write.c

Modified: trunk/Build/source/texk/makejvf/COPYRIGHT
===================================================================
--- trunk/Build/source/texk/makejvf/COPYRIGHT	2017-07-16 00:17:48 UTC (rev 44816)
+++ trunk/Build/source/texk/makejvf/COPYRIGHT	2017-07-16 03:19:50 UTC (rev 44817)
@@ -1,4 +1,6 @@
-Copyright (C) 2009 ASCII MEDIA WORKS.
+Copyright (C) 2009 ASCII MEDIA WORKS
+Copyright (C) 2010-2017 Takuji TANAKA
+Copyright (C) 2017 Japanese TeX Development Community
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without

Modified: trunk/Build/source/texk/makejvf/ChangeLog
===================================================================
--- trunk/Build/source/texk/makejvf/ChangeLog	2017-07-16 00:17:48 UTC (rev 44816)
+++ trunk/Build/source/texk/makejvf/ChangeLog	2017-07-16 03:19:50 UTC (rev 44817)
@@ -1,3 +1,12 @@
+2017-07-16  Hironobu Yamashita  <h.y.acetaminophen at gmail.com>
+
+	makejvf version 20170716.
+	* COPYRIGHT: Add Takuji Tanaka and Japanese TeX Development
+	Community to the author.
+	* main.c, makejvf.h, tfmread.c, write.c: Add enhanced mode;
+	If -e option is specified, horizontal shift amount for each
+	characters are determined from glue/kern table of input JFM.
+
 2017-07-15  Hironobu Yamashita  <h.y.acetaminophen at gmail.com>
 
 	* main.c, makejvf.h, uniblock.[ch], write.c: Move more non-Kanji

Modified: trunk/Build/source/texk/makejvf/main.c
===================================================================
--- trunk/Build/source/texk/makejvf/main.c	2017-07-16 00:17:48 UTC (rev 44816)
+++ trunk/Build/source/texk/makejvf/main.c	2017-07-16 03:19:50 UTC (rev 44817)
@@ -9,7 +9,7 @@
 
 FILE *vfp,*afp=NULL;
 char *atfmname,*vtfmname,*afmname,*vfname,*kanatfm,*jistfm,*ucsqtfm;
-int kanatume=-1,chotai=0,baseshift=0,minute=0,useset3=0,hankana=0,fidzero=0;
+int kanatume=-1,chotai=0,baseshift=0,minute=0,useset3=0,hankana=0,fidzero=0,enhanced=0;
 int pstfm_nt;
 long ucs=0;
 
@@ -22,7 +22,7 @@
 	kpse_set_program_name(argv[0], "makejvf");
 	set_enc_string("sjis", "euc");
 
-	while ((c = getopt (argc, argv, "k:K:Ca:b:mu:3J:U:Hi")) != -1)
+	while ((c = getopt (argc, argv, "k:K:Ca:b:mu:3J:U:Hie")) != -1)
 		switch (c) {
 
 
@@ -86,6 +86,9 @@
 		case 'i':
 			fidzero=1;
 			break;
+		case 'e':
+			enhanced=1;
+			break;
 		default:
 			usage();
 			exit(0);
@@ -170,7 +173,7 @@
 
 void usage(void)
 {
-	fputs2("MAKEJVF ver.1.1a-u1.22 -- make Japanese VF file.\n", stderr);
+	fputs2("MAKEJVF version 20170716 -- make Japanese VF file.\n", stderr);
 	fputs2("%% makejvf [<options>] <TFMfile> <PSfontTFM>\n", stderr);
 	fputs2("options:\n", stderr);
 	fputs2("-C           Ĺ\xC2Υ⡼\xA5\xC9\n", stderr);
@@ -190,4 +193,7 @@
 	fputs2("-3           use set3 (with UCS mode)\n", stderr);
 	fputs2("-H           use half-width katakana (with UCS mode)\n", stderr);
 	fputs2("-i           font ID from No.0\n", stderr);
+	fputs2("-e           enhanced mode; the horizontal shift amount is determined\n", stderr);
+	fputs2("             from the glue/kern table of <TFMfile> input\n", stderr);
+	fputs2("Email bug reports to issue at texjp.org.\n", stderr);
 }

Modified: trunk/Build/source/texk/makejvf/makejvf.h
===================================================================
--- trunk/Build/source/texk/makejvf/makejvf.h	2017-07-16 00:17:48 UTC (rev 44816)
+++ trunk/Build/source/texk/makejvf/makejvf.h	2017-07-16 03:19:50 UTC (rev 44817)
@@ -2,7 +2,8 @@
 
 extern char *vtfmname,*kanatfm,*jistfm,*ucsqtfm;
 extern int unit,zh,zw,jfm_id;
-extern int kanatume,chotai,baseshift,minute,hankana,fidzero;
+extern unsigned int rightamount;
+extern int kanatume,chotai,baseshift,minute,hankana,fidzero,enhanced;
 extern int pstfm_nt;
 extern FILE *afp;
 extern long ucs;

Modified: trunk/Build/source/texk/makejvf/tfmread.c
===================================================================
--- trunk/Build/source/texk/makejvf/tfmread.c	2017-07-16 00:17:48 UTC (rev 44816)
+++ trunk/Build/source/texk/makejvf/tfmread.c	2017-07-16 03:19:50 UTC (rev 44817)
@@ -6,12 +6,13 @@
 #include <string.h>
 
 int nt,unit,zh,zw,jfm_id;
-int *width,*height,*depth,*italic,*glue_kern,*kern,*glue,*param;
-unsigned char *header,*char_type,*char_info;
+int *width,*height,*depth,*italic,*param;
+unsigned int rightamount;
+unsigned char *header,*char_type,*char_info,*glue_kern,*kern,*glue;
 
 int jfmread(int kcode)
 {
-	int i,ctype = 0,w_ind,w;
+	int i,ctype = 0,w_ind,w,gk_ind,k_ind,g_ind;
 
 	for (i = 0 ; i < nt ; i++) {
 		if (upair(&char_type[i*4]) == kcode) {
@@ -20,10 +21,31 @@
 		}
 	}
 
+	/* get character width of <kcode> */
 	w_ind = char_info[ctype*4];
-
 	w = width[w_ind];
 
+	/* get natural length of JFM glue between <type0> and <type of kcode> */
+	gk_ind = char_info[0*4+3]; /* remainder for type 0 */
+	rightamount = 0;
+	if (ctype >0) {
+		for (i = 0 ; i < 65536 ; i++) {
+			if (glue_kern[(gk_ind+i)*4+1] == ctype) {
+				if (glue_kern[(gk_ind+i)*4+2] >= 128) {
+					k_ind = glue_kern[(gk_ind+i)*4+3];
+					rightamount = mquad(&kern[k_ind*4]);
+				}
+				else {
+					g_ind = glue_kern[(gk_ind+i)*4+3];
+					rightamount = mquad(&glue[3*g_ind*4]);
+				}
+				break;
+			}
+			if (glue_kern[(gk_ind+i)*4] >= 128)
+				break;
+		}
+	}
+
 	return(w);
 }
 
@@ -96,7 +118,22 @@
 		for (i = 0 ; i < nd ; i++) {
 			depth[i] = fquad(fp);
 		}
-		fseek(fp,(ni+nl+nk+ng)*4,SEEK_CUR);
+		italic = xmalloc(ni*sizeof(int));
+		for (i = 0 ; i < ni ; i++) {
+			italic[i] = fquad(fp);
+		}
+		glue_kern = xmalloc(nl*4);
+		for (i = 0 ; i < nl*4 ; i++) {
+			glue_kern[i] = fgetc(fp);
+		}
+		kern = xmalloc(nk*4);
+		for (i = 0 ; i < nk*4 ; i++) {
+			kern[i] = fgetc(fp);
+		}
+		glue = xmalloc(ng*4);
+		for (i = 0 ; i < ng*4 ; i++) {
+			glue[i] = fgetc(fp);
+		}
 		param = xmalloc(np*sizeof(int));
 		for (i = 0 ; i < np ; i++) {
 			param[i] = fquad(fp);

Modified: trunk/Build/source/texk/makejvf/write.c
===================================================================
--- trunk/Build/source/texk/makejvf/write.c	2017-07-16 00:17:48 UTC (rev 44816)
+++ trunk/Build/source/texk/makejvf/write.c	2017-07-16 03:19:50 UTC (rev 44817)
@@ -306,6 +306,14 @@
 		break;
 	}
 
+	if (skip != -rightamount && enhanced) {
+		fprintf(stderr,
+			"[Warning] Conflicting MOVERIGHT value for code %x,\n"
+			"[Warning]   makejvf default:    %08x\n"
+			"[Warning]   suggested from JFM: %08x <= I'll use this ...\n",
+			code, skip, -rightamount);
+		skip=-rightamount;
+	}
 	if (kanatfm)
 		cc=4;
 	else
@@ -686,6 +694,14 @@
 		break;
 	}
 
+	if (skip != -rightamount && enhanced) {
+		fprintf(stderr,
+			"[Warning] Conflicting MOVERIGHT value for code %x,\n"
+			"[Warning]   makejvf default:    %08x\n"
+			"[Warning]   suggested from JFM: %08x <= I'll use this ...\n",
+			code, skip, -rightamount);
+		skip=-rightamount;
+	}
 	if (kanatfm)
 		cc=4;
 	else



More information about the tex-live-commits mailing list