texlive[45152] Build/source/texk/makejvf: texk/makejvf: Support a

commits+takuji at tug.org commits+takuji at tug.org
Mon Aug 28 16:03:06 CEST 2017


Revision: 45152
          http://tug.org/svn/texlive?view=revision&revision=45152
Author:   takuji
Date:     2017-08-28 16:03:06 +0200 (Mon, 28 Aug 2017)
Log Message:
-----------
texk/makejvf: Support a configuration file (version 20170828)

Modified Paths:
--------------
    trunk/Build/source/texk/makejvf/ChangeLog
    trunk/Build/source/texk/makejvf/Makefile.am
    trunk/Build/source/texk/makejvf/Makefile.in
    trunk/Build/source/texk/makejvf/main.c
    trunk/Build/source/texk/makejvf/makejvf.h
    trunk/Build/source/texk/makejvf/uniblock.c
    trunk/Build/source/texk/makejvf/uniblock.h
    trunk/Build/source/texk/makejvf/version.h
    trunk/Build/source/texk/makejvf/write.c

Added Paths:
-----------
    trunk/Build/source/texk/makejvf/usrtable.c
    trunk/Build/source/texk/makejvf/usrtable.h

Modified: trunk/Build/source/texk/makejvf/ChangeLog
===================================================================
--- trunk/Build/source/texk/makejvf/ChangeLog	2017-08-28 13:42:12 UTC (rev 45151)
+++ trunk/Build/source/texk/makejvf/ChangeLog	2017-08-28 14:03:06 UTC (rev 45152)
@@ -1,3 +1,12 @@
+2017-08-28  TANAKA Takuji  <ttk at t-lab.opal.ne.jp>
+
+	makejvf version 20170828.
+	Largely contributed by H. Yamashita-san.
+	* usrtable.[ch]: New files to support a configuration file.
+	* main.c, write.c, uniblock.[ch], makejvf.h: Support a configuration file.
+	* Makefile.{am,in}: Add usrtable.[ch].
+	* version.h: Bump version.
+
 2017-08-01  Hironobu Yamashita  <h.y.acetaminophen at gmail.com>
 
 	makejvf version 20170801.

Modified: trunk/Build/source/texk/makejvf/Makefile.am
===================================================================
--- trunk/Build/source/texk/makejvf/Makefile.am	2017-08-28 13:42:12 UTC (rev 45151)
+++ trunk/Build/source/texk/makejvf/Makefile.am	2017-08-28 14:03:06 UTC (rev 45152)
@@ -10,7 +10,8 @@
 bin_PROGRAMS = makejvf
 
 makejvf_SOURCES = \
-	main.c makejvf.h tfmread.c tool.c uniblock.c uniblock.h version.h write.c
+	main.c makejvf.h tfmread.c tool.c \
+	uniblock.c uniblock.h usrtable.c usrtable.h version.h write.c
 
 $(makejvf_OBJECTS): $(KPATHSEA_DEPEND) $(PTEXENC_DEPEND)
 

Modified: trunk/Build/source/texk/makejvf/Makefile.in
===================================================================
--- trunk/Build/source/texk/makejvf/Makefile.in	2017-08-28 13:42:12 UTC (rev 45151)
+++ trunk/Build/source/texk/makejvf/Makefile.in	2017-08-28 14:03:06 UTC (rev 45152)
@@ -113,8 +113,9 @@
 CONFIG_CLEAN_VPATH_FILES =
 am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
 PROGRAMS = $(bin_PROGRAMS)
-am_makejvf_OBJECTS = main.$(OBJEXT) tfmread.$(OBJEXT) tool.$(OBJEXT) \
-	uniblock.$(OBJEXT) write.$(OBJEXT)
+am_makejvf_OBJECTS = main.$(OBJEXT) tfmread.$(OBJEXT) \
+	tool.$(OBJEXT) uniblock.$(OBJEXT) usrtable.$(OBJEXT) \
+	write.$(OBJEXT)
 makejvf_OBJECTS = $(am_makejvf_OBJECTS)
 makejvf_LDADD = $(LDADD)
 am__DEPENDENCIES_1 =
@@ -549,7 +550,8 @@
 AM_CPPFLAGS = $(PTEXENC_INCLUDES) $(KPATHSEA_INCLUDES)
 AM_CFLAGS = $(WARNING_CFLAGS)
 makejvf_SOURCES = \
-	main.c makejvf.h tfmread.c tool.c uniblock.c uniblock.h version.h write.c
+	main.c makejvf.h tfmread.c tool.c \
+	uniblock.c uniblock.h usrtable.c usrtable.h version.h write.c
 
 LDADD = $(PTEXENC_LIBS) $(KPATHSEA_LIBS)
 EXTRA_DIST = COPYRIGHT COPYRIGHT.jis Changes.txt README.txt \
@@ -676,6 +678,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tfmread.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tool.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/uniblock.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/usrtable.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/write.Po at am__quote@
 
 .c.o:

Modified: trunk/Build/source/texk/makejvf/main.c
===================================================================
--- trunk/Build/source/texk/makejvf/main.c	2017-08-28 13:42:12 UTC (rev 45151)
+++ trunk/Build/source/texk/makejvf/main.c	2017-08-28 14:03:06 UTC (rev 45152)
@@ -3,6 +3,7 @@
 #include "version.h"
 #include "makejvf.h"
 #include "uniblock.h"
+#include "usrtable.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -9,7 +10,7 @@
 #include <string.h>
 
 FILE *vfp,*afp=NULL;
-char *atfmname,*vtfmname,*afmname,*vfname,*kanatfm,*jistfm,*ucsqtfm;
+char *atfmname,*vtfmname,*afmname,*vfname,*kanatfm,*jistfm,*ucsqtfm,*usertable;
 int kanatume=-1,chotai=0,baseshift=0,minute=0,useset3=0,hankana=0,fidzero=0,enhanced=0;
 int pstfm_nt;
 long ucs=0;
@@ -16,14 +17,14 @@
 
 int main(int argc, char ** argv)
 {
-	int i,j,ib;
+	int i,j;
 	int c;
-	long ch;
+	long ch,ch_max;
 
 	kpse_set_program_name(argv[0], "makejvf");
 	set_enc_string("sjis", "euc");
 
-	while ((c = getopt (argc, argv, "k:K:Ca:b:mu:3J:U:Hie")) != -1)
+	while ((c = getopt (argc, argv, "k:K:Ca:b:mu:3J:U:Hiet:")) != -1)
 		switch (c) {
 
 
@@ -67,8 +68,10 @@
 				ucs = ENTRY_J;
 			else if (!strcmp(optarg, "ks"))
 				ucs = ENTRY_K;
+			else if (!strcmp(optarg, "custom"))
+				ucs = ENTRY_CUSTOM;
 			else {
-				fprintf(stderr,"Charset is not set\n");
+				fprintf(stderr,"[Warning] Charset is not set.\n");
 				ucs = ENTRY_NO;
 			}
 			break;
@@ -90,6 +93,9 @@
 		case 'e':
 			enhanced=1;
 			break;
+		case 't':
+			usertable = xstrdup(optarg);
+			break;
 		default:
 			usage();
 			exit(0);
@@ -125,17 +131,30 @@
 
 	tfmget(atfmname);
 
+	if (usertable) {
+		get_usertable(usertable);
+	}
+	if (ucs!=ENTRY_CUSTOM && usertable_charset_max>0) {
+		fprintf(stderr,
+			"[Warning] Custom charset is defined in usertable\n"
+			"[Warning]   but it will be ignored.\n");
+	}
+	if (ucs==ENTRY_CUSTOM && usertable_charset_max<1) {
+		fprintf(stderr,"No custom charset definition in usertable.\n");
+		exit(101);
+	}
+
 	vfp = vfopen(vfname);
 
 	pstfm_nt=1; /* initialize */
 	if (ucs) {
-		ib=0;
-		for (i=0;i<(useset3*2+1);i++)
-			for (j=0;j<65536;j++) {
-				ch=i*65536+j;
-				if (search_cjk_entry(&ib,ch,ucs))
-					writevfu(ch,vfp);
-			}
+		if (ucs==ENTRY_CUSTOM) ch_max=usertable_charset[usertable_charset_max-1].max;
+		else if (useset3) ch_max=0x2FFFF;
+		else ch_max=0xFFFF;
+		for (ch=0;ch<=ch_max;ch++) {
+			if (search_cjk_entry(ch,ucs))
+				writevfu(ch,vfp);
+		}
 	} else {
 		for (i=0;i<94;i++)
 			for (j=0;j<94;j++)
@@ -196,5 +215,6 @@
 	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("-t <CNFfile> use <CNFfile> as a configuration file\n", stderr);
 	fprintf(stderr, "Email bug reports to %s.\n", BUG_ADDRESS);
 }

Modified: trunk/Build/source/texk/makejvf/makejvf.h
===================================================================
--- trunk/Build/source/texk/makejvf/makejvf.h	2017-08-28 13:42:12 UTC (rev 45151)
+++ trunk/Build/source/texk/makejvf/makejvf.h	2017-08-28 14:03:06 UTC (rev 45152)
@@ -1,6 +1,4 @@
-
-
-extern char *vtfmname,*kanatfm,*jistfm,*ucsqtfm;
+extern char *vtfmname,*kanatfm,*jistfm,*ucsqtfm,*usertable;
 extern int unit,zh,zw,jfm_id,rightamount;
 extern int kanatume,chotai,baseshift,minute,hankana,fidzero,enhanced;
 extern int pstfm_nt;

Modified: trunk/Build/source/texk/makejvf/uniblock.c
===================================================================
--- trunk/Build/source/texk/makejvf/uniblock.c	2017-08-28 13:42:12 UTC (rev 45151)
+++ trunk/Build/source/texk/makejvf/uniblock.c	2017-08-28 14:03:06 UTC (rev 45152)
@@ -1,10 +1,12 @@
+#include "uniblock.h"
+#include "usrtable.h"
 
 #ifdef DEBUG
 #include <stdio.h>
+int usertable_charset_max=0;
+struct USERTABLE_CHARSET usertable_charset[MAX_CHAR_TABLE];
 #endif
 
-#include "uniblock.h"
-
 int uniblock_iskanji;
 struct ublock {
   long min, max, cjk;
@@ -306,16 +308,22 @@
 };
 
 
-int search_cjk_entry(int *ib, long ch, long cjk) {
+int search_cjk_entry(long ch, long cjk) {
+  static int ib = 0, ic = 0;
   uniblock_iskanji = 0; /* initialize */
-  if (cjk==ENTRY_NO) return 1;
   if (cjk==ENTRY_JQ) return
 	(ch==U_OPEN_SQUOTE || ch==U_CLOSE_SQUOTE
 	 || ch==U_OPEN_DQUOTE || ch==U_CLOSE_DQUOTE);
-  while(ublock_data[*ib].max<ch) (*ib)++;
-  if (ublock_data[*ib].min<=ch && ch<=ublock_data[*ib].max) {
-    uniblock_iskanji = ublock_data[*ib].kanji;
-    return ublock_data[*ib].cjk & cjk;
+  while(ublock_data[ib].max<ch) ib++;
+  if (ublock_data[ib].min<=ch && ch<=ublock_data[ib].max)
+    uniblock_iskanji = ublock_data[ib].kanji;
+  if (cjk==ENTRY_NO) {
+    return 1;
+  } else if (cjk==ENTRY_CUSTOM) {
+    while(usertable_charset[ic].max<ch) ic++;
+    return (usertable_charset[ic].min<=ch && ch<=usertable_charset[ic].max);
+  } else if (ublock_data[ib].min<=ch && ch<=ublock_data[ib].max) {
+    return ublock_data[ib].cjk & cjk;
   } else {
     return 0;
   }
@@ -322,18 +330,26 @@
 }
 
 
+/* for unit test                                      */
+/*   ex. $ gcc -g -o uniblock.test uniblock.c -DDEBUG */
 #ifdef DEBUG
 int main() {
   long ch;
-  int ib;
 
-  ib=0;
+  /* trial inputs */
+  usertable_charset_max=2;
+  usertable_charset[0].min=0xFFF0;
+  usertable_charset[0].max=0xFFF3;
+  usertable_charset[1].min=0xFFF8;
+  usertable_charset[1].max=0xFFFB;
+
   for (ch=0x0;ch<0x10000;ch++) {
-    printf(" %05x %2d %2d %2d %2d %2d\n", ch, ib,
-	   search_cjk_entry(&ib,ch,ENTRY_G),
-	   search_cjk_entry(&ib,ch,ENTRY_C),
-	   search_cjk_entry(&ib,ch,ENTRY_J),
-	   search_cjk_entry(&ib,ch,ENTRY_K));
+    printf(" %05x %1d G:%2d C:%2d J:%2d K:%2d custom:%2d\n", ch, uniblock_iskanji,
+	   search_cjk_entry(ch,ENTRY_G),
+	   search_cjk_entry(ch,ENTRY_C),
+	   search_cjk_entry(ch,ENTRY_J),
+	   search_cjk_entry(ch,ENTRY_K),
+	   search_cjk_entry(ch,ENTRY_CUSTOM));
   }
 
 }

Modified: trunk/Build/source/texk/makejvf/uniblock.h
===================================================================
--- trunk/Build/source/texk/makejvf/uniblock.h	2017-08-28 13:42:12 UTC (rev 45151)
+++ trunk/Build/source/texk/makejvf/uniblock.h	2017-08-28 14:03:06 UTC (rev 45152)
@@ -1,8 +1,9 @@
 
 #define ENTRY_NO    0x01
+#define ENTRY_CUSTOM   0x10000
 /* for JIS, quote only */
+#define ENTRY_JQ    0x1000
 /* for GB, CNS, JIS, KS */
-#define ENTRY_JQ    0x1000
 #define ENTRY_G     0x02
 #define ENTRY_C     0x04
 #define ENTRY_J     0x08
@@ -19,7 +20,7 @@
 #define ENTRY_CJK           ENTRY_C|ENTRY_J|ENTRY_K
 #define ENTRY_GCJK  ENTRY_G|ENTRY_C|ENTRY_J|ENTRY_K
 
-extern int search_cjk_entry(int *ib, long ch, long cjk);
+extern int search_cjk_entry(long ch, long cjk);
 extern int uniblock_iskanji;
 
 #define U_OPEN_SQUOTE   0x2018

Added: trunk/Build/source/texk/makejvf/usrtable.c
===================================================================
--- trunk/Build/source/texk/makejvf/usrtable.c	                        (rev 0)
+++ trunk/Build/source/texk/makejvf/usrtable.c	2017-08-28 14:03:06 UTC (rev 45152)
@@ -0,0 +1,125 @@
+#ifndef DEBUG
+#include <kpathsea/config.h>
+#include "makejvf.h"
+#endif
+
+#include "usrtable.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef DEBUG
+#include <string.h>
+#endif
+
+int usertable_replace_max=0,usertable_move_max=0,usertable_charset_max=0;
+struct USERTABLE_REPLACE usertable_replace[MAX_TABLE];
+struct USERTABLE_MOVE usertable_move[MAX_TABLE];
+struct USERTABLE_CHARSET usertable_charset[MAX_CHAR_TABLE];
+
+void get_usertable(char *name)
+{
+	FILE *fp;
+	char *tok,*endptr,buf[BUF_SIZE],str0[8],str1[8];
+	int charset_mode=0,l;
+	long char_max=-2,ch0,ch1;
+
+	fp = fopen(name,"r");
+	if (fp == NULL) {
+		fprintf(stderr,"Cannot find %s!\n",name);
+		exit(1);
+	}
+	for (l = 0; fgets(buf, BUF_SIZE, fp) != NULL; l++) {
+		if (endptr=strchr(buf, '%')) strcpy(endptr,"\n");  /* ignore after '%'  */
+		if (!strncmp(buf, "\n", 1)) continue;              /* ignore empty line */
+		tok = strtok(buf, "\t");
+		if (!strcmp(tok, "REPLACE")) {
+			if (usertable_replace_max >= MAX_TABLE) goto buferr;
+			usertable_replace[usertable_replace_max].codepoint = strtol(strtok(NULL, "\t\n"), &endptr, 16);
+			if (*endptr != '\0') goto taberr;
+			usertable_replace[usertable_replace_max].newcodepoint = strtol(strtok(NULL, "\t\n"), &endptr, 16);
+			if (*endptr != '\0') goto taberr;
+			if (strtok(NULL, "\t\n") != NULL) goto taberr;
+			usertable_replace_max++;
+			continue;
+		}
+		if (!strcmp(tok, "MOVE")) {
+			if (usertable_move_max >= MAX_TABLE) goto buferr;
+			usertable_move[usertable_move_max].codepoint = strtol(strtok(NULL, "\t\n"), &endptr, 16);
+			if (*endptr != '\0') goto taberr;
+			usertable_move[usertable_move_max].moveright = strtod(strtok(NULL, "\t\n"), &endptr);
+			if (*endptr != '\0') goto taberr;
+			usertable_move[usertable_move_max].movedown = strtod(strtok(NULL, "\t\n"), &endptr);
+			if (*endptr != '\0') goto taberr;
+			if (strtok(NULL, "\t\n") != NULL) goto taberr;
+			usertable_move_max++;
+			continue;
+		}
+		if ((!strcmp(tok, "+") && charset_mode) || !strcmp(tok, "CHARSET")) {
+			charset_mode = 1;
+			while (tok=strtok(NULL, ",\t\n")) {
+				if (endptr=strstr(tok,"..")) {
+					*endptr = '\0';
+					if (sscanf(tok,     "%7s",str0) != 1) goto taberr;
+					if (sscanf(endptr+2,"%7s",str1) != 1) goto taberr;
+					ch0 = strtol(str0, &endptr, 16);
+					if (*endptr != '\0' || ch0<=char_max) goto taberr;
+					ch1 = strtol(str1, &endptr, 16);
+					if (*endptr != '\0' || ch1<=ch0) goto taberr;
+				} else {
+					if (sscanf(tok,"%7s",str0) != 1) goto taberr;
+					ch0 = strtol(str0, &endptr, 16);
+					if (*endptr != '\0' || ch0<=char_max) goto taberr;
+					ch1 = ch0;
+				}
+				if (char_max==ch0-1) {
+					usertable_charset[usertable_charset_max-1].max = ch1;
+				} else {
+					if (usertable_charset_max >= MAX_CHAR_TABLE) goto buferr;
+					usertable_charset[usertable_charset_max].min = ch0;
+					usertable_charset[usertable_charset_max].max = ch1;
+					usertable_charset_max++;
+				}
+				char_max = ch1;
+			}
+			continue;
+		}
+		fprintf(stderr, "Unknown setting %s found in %s (line %d)!\n", tok, name, l+1);
+		exit(1);
+	}
+	fclose(fp);
+	return;
+taberr:
+	fprintf(stderr, "Error in user-defined table file %s (line %d)!\n", name, l+1);
+	exit(1);
+buferr:
+	fprintf(stderr, "User-defined table in %s is too large!\n", name);
+	exit(1);
+}
+
+
+/* for unit test                                      */
+/*   ex. $ gcc -g -o usrtable.test usrtable.c -DDEBUG */
+#ifdef DEBUG
+int main() {
+  int i;
+  long ch0,ch1;
+  char name[]="test_user_table";
+  get_usertable(name);
+
+  if (usertable_replace_max>0) {
+    printf("REPLACE::\n");
+    for(i=0;i<usertable_replace_max;i++)
+      printf("%6d:  %06x -> %06x\n", i, usertable_replace[i].codepoint, usertable_replace[i].newcodepoint);
+  }
+  if (usertable_move_max>0) {
+    printf("MOVE::\n");
+    for(i=0;i<usertable_move_max;i++)
+      printf("%6d:  %06x | %lf, %lf\n", i, usertable_move[i].codepoint, usertable_move[i].moveright, usertable_move[i].movedown);
+  }
+  if (usertable_charset_max>0) {
+    printf("CHARSET::\n");
+    for(i=0;i<usertable_charset_max;i++)
+      printf("%6d:  %06x .. %06x\n", i, usertable_charset[i].min, usertable_charset[i].max);
+  }
+}
+#endif


Property changes on: trunk/Build/source/texk/makejvf/usrtable.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Build/source/texk/makejvf/usrtable.h
===================================================================
--- trunk/Build/source/texk/makejvf/usrtable.h	                        (rev 0)
+++ trunk/Build/source/texk/makejvf/usrtable.h	2017-08-28 14:03:06 UTC (rev 45152)
@@ -0,0 +1,23 @@
+#define BUF_SIZE 1024
+#define MAX_TABLE 1024
+#define MAX_CHAR_TABLE 32768
+extern int usertable_replace_max,usertable_move_max,usertable_charset_max;
+
+struct USERTABLE_REPLACE {
+	int codepoint;
+	int newcodepoint;
+};
+extern struct USERTABLE_REPLACE usertable_replace[];
+struct USERTABLE_MOVE {
+	int codepoint;
+	double moveright;
+	double movedown;
+};
+extern struct USERTABLE_MOVE usertable_move[];
+struct USERTABLE_CHARSET {
+	long min, max;
+};
+extern struct USERTABLE_CHARSET usertable_charset[];
+
+/* usrtable.c */
+void get_usertable(char *name);


Property changes on: trunk/Build/source/texk/makejvf/usrtable.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Build/source/texk/makejvf/version.h
===================================================================
--- trunk/Build/source/texk/makejvf/version.h	2017-08-28 13:42:12 UTC (rev 45151)
+++ trunk/Build/source/texk/makejvf/version.h	2017-08-28 14:03:06 UTC (rev 45152)
@@ -1,2 +1,2 @@
-#define VERSION "20170801"
+#define VERSION "20170828"
 #define BUG_ADDRESS "issue at texjp.org"

Modified: trunk/Build/source/texk/makejvf/write.c
===================================================================
--- trunk/Build/source/texk/makejvf/write.c	2017-08-28 13:42:12 UTC (rev 45151)
+++ trunk/Build/source/texk/makejvf/write.c	2017-08-28 14:03:06 UTC (rev 45152)
@@ -1,6 +1,7 @@
 #include <kpathsea/config.h>
 #include "makejvf.h"
 #include "uniblock.h"
+#include "usrtable.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -85,7 +86,8 @@
 {
 	int cc,cc2,cc3,cc4,w,skip=0,skip2=0,height=1000;
 	char buf[256],buf2[256];
-	int fidshift=0;
+	int fidshift=0,l;
+	int outcode=code;
 
 	if (fidzero) fidshift=-1;
 
@@ -306,6 +308,19 @@
 		break;
 	}
 
+	for (l = 0; l < usertable_replace_max; l++) {
+		if (code == usertable_replace[l].codepoint) {
+			outcode = usertable_replace[l].newcodepoint;
+			break;
+		}
+	}
+	for (l = 0; l < usertable_move_max; l++) {
+		if (code == usertable_move[l].codepoint) {
+			skip = usertable_move[l].moveright * zw;
+			skip2 = usertable_move[l].movedown * zh;
+			goto outputj;
+		}
+	}
 	if (skip != -rightamount && enhanced) {
 		fprintf(stderr,
 			"[Warning] Conflicting MOVERIGHT value for code %x,\n"
@@ -314,6 +329,8 @@
 			code, skip, -rightamount);
 		skip=-rightamount;
 	}
+
+outputj:
 	if (kanatfm)
 		cc=4;
 	else
@@ -340,7 +357,7 @@
 			fputc(172+fidshift,fp); /* FONT_NUM_1 */
 	}
 	fputc(129,fp); /* SET2 */
-	fputnum(code,2,fp); /* char code */
+	fputnum(outcode,2,fp); /* char code */
 }
 
 void writevfu(int code, FILE *fp)
@@ -347,7 +364,8 @@
 {
 	int cc,cc2,cc3,cc4,w,skip=0,skip2=0,height=1000;
 	char buf[256],buf2[256];
-	int fidshift=0;
+	int fidshift=0,l;
+	int outcode=code;
 
 	if (fidzero) fidshift=-1;
 
@@ -691,6 +709,19 @@
 		break;
 	}
 
+	for (l = 0; l < usertable_replace_max; l++) {
+		if (code == usertable_replace[l].codepoint) {
+			outcode = usertable_replace[l].newcodepoint;
+			break;
+		}
+	}
+	for (l = 0; l < usertable_move_max; l++) {
+		if (code == usertable_move[l].codepoint) {
+			skip = usertable_move[l].moveright * zw;
+			skip2 = usertable_move[l].movedown * zh;
+			goto outputu;
+		}
+	}
 	if (skip != -rightamount && enhanced) {
 		fprintf(stderr,
 			"[Warning] Conflicting MOVERIGHT value for code %x,\n"
@@ -699,11 +730,13 @@
 			code, skip, -rightamount);
 		skip=-rightamount;
 	}
+
+outputu:
 	if (kanatfm)
 		cc=4;
 	else
 		cc=3;
-	if (code>=0x10000)
+	if (outcode>=0x10000)
 		cc+=1;
 	if (skip)
 		cc+=numcount(skip)+1;
@@ -726,12 +759,12 @@
 		else
 			fputc(172+fidshift,fp); /* FONT_NUM_1 */
 	}
-	if (code>=0x10000) {
+	if (outcode>=0x10000) {
 		fputc(130,fp); /* SET3 */
-		fputnum(code,3,fp); /* char code */
+		fputnum(outcode,3,fp); /* char code */
 	} else {
 		fputc(129,fp); /* SET2 */
-		fputnum(code,2,fp); /* char code */
+		fputnum(outcode,2,fp); /* char code */
 	}
 }
 



More information about the tex-live-commits mailing list