texlive[44827] Build/source/texk/makejvf: makejvf: Improve enhanced

commits+hironobu at tug.org commits+hironobu at tug.org
Mon Jul 17 04:30:37 CEST 2017


Revision: 44827
          http://tug.org/svn/texlive?view=revision&revision=44827
Author:   hironobu
Date:     2017-07-17 04:30:36 +0200 (Mon, 17 Jul 2017)
Log Message:
-----------
makejvf: Improve enhanced mode (version 20170717)

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.1
    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/ChangeLog
===================================================================
--- trunk/Build/source/texk/makejvf/ChangeLog	2017-07-17 00:21:32 UTC (rev 44826)
+++ trunk/Build/source/texk/makejvf/ChangeLog	2017-07-17 02:30:36 UTC (rev 44827)
@@ -1,3 +1,14 @@
+2017-07-17  Hironobu Yamashita  <h.y.acetaminophen at gmail.com>
+
+	makejvf version 20170717.
+	* Makefile.am: Add version.h.
+	* main.c: Move version declaration to version.h.
+	* makejvf.h, tfmread.c, write.c: Improve enhanced mode;
+	More compatible with normal mode, by reading glue/kern table
+	more deliberately.
+	* version.h: Added.
+	* makejvf.1: Update.
+
 2017-07-16  Hironobu Yamashita  <h.y.acetaminophen at gmail.com>
 
 	makejvf version 20170716.

Modified: trunk/Build/source/texk/makejvf/Makefile.am
===================================================================
--- trunk/Build/source/texk/makejvf/Makefile.am	2017-07-17 00:21:32 UTC (rev 44826)
+++ trunk/Build/source/texk/makejvf/Makefile.am	2017-07-17 02:30:36 UTC (rev 44827)
@@ -1,6 +1,7 @@
 ## Makefile.am for the TeX Live subdirectory texk/makejvfk/
 ##
 ## Copyright (C) 2010-2015 Peter Breitenlohner <tex-live at tug.org>
+## Copyright (C) 2016-2017 Japanese TeX Development Community <issue at texjp.org>
 ## You may freely use, modify and/or distribute this file.
 ##
 AM_CPPFLAGS = $(PTEXENC_INCLUDES) $(KPATHSEA_INCLUDES)
@@ -9,7 +10,7 @@
 bin_PROGRAMS = makejvf
 
 makejvf_SOURCES = \
-	main.c makejvf.h tfmread.c tool.c uniblock.c uniblock.h write.c
+	main.c makejvf.h tfmread.c tool.c uniblock.c uniblock.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-07-17 00:21:32 UTC (rev 44826)
+++ trunk/Build/source/texk/makejvf/Makefile.in	2017-07-17 02:30:36 UTC (rev 44827)
@@ -549,7 +549,7 @@
 AM_CPPFLAGS = $(PTEXENC_INCLUDES) $(KPATHSEA_INCLUDES)
 AM_CFLAGS = $(WARNING_CFLAGS)
 makejvf_SOURCES = \
-	main.c makejvf.h tfmread.c tool.c uniblock.c uniblock.h write.c
+	main.c makejvf.h tfmread.c tool.c uniblock.c uniblock.h version.h write.c
 
 LDADD = $(PTEXENC_LIBS) $(KPATHSEA_LIBS)
 EXTRA_DIST = COPYRIGHT COPYRIGHT.jis Changes.txt README.txt \

Modified: trunk/Build/source/texk/makejvf/main.c
===================================================================
--- trunk/Build/source/texk/makejvf/main.c	2017-07-17 00:21:32 UTC (rev 44826)
+++ trunk/Build/source/texk/makejvf/main.c	2017-07-17 02:30:36 UTC (rev 44827)
@@ -1,5 +1,6 @@
 #include <kpathsea/kpathsea.h>
 #include <ptexenc/ptexenc.h>
+#include "version.h"
 #include "makejvf.h"
 #include "uniblock.h"
 
@@ -173,7 +174,7 @@
 
 void usage(void)
 {
-	fputs2("MAKEJVF version 20170716 -- make Japanese VF file.\n", stderr);
+	fprintf(stderr, "MAKEJVF version %s -- make Japanese VF file.\n", VERSION);
 	fputs2("%% makejvf [<options>] <TFMfile> <PSfontTFM>\n", stderr);
 	fputs2("options:\n", stderr);
 	fputs2("-C           Ĺ\xC2Υ⡼\xA5\xC9\n", stderr);
@@ -195,5 +196,5 @@
 	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);
+	fprintf(stderr, "Email bug reports to %s.\n", BUG_ADDRESS);
 }

Modified: trunk/Build/source/texk/makejvf/makejvf.1
===================================================================
--- trunk/Build/source/texk/makejvf/makejvf.1	2017-07-17 00:21:32 UTC (rev 44826)
+++ trunk/Build/source/texk/makejvf/makejvf.1	2017-07-17 02:30:36 UTC (rev 44827)
@@ -6,8 +6,25 @@
 .SH SYNOPSIS
 \fBmakejvf\fR [\fI<options>\fR] \fI<\*(TX TFM file>\fR \fI<TFM name of PS font>\fR
 .SH DESCRIPTION
-\fBmakejvf\fP is a tool to generate Japanese VF file from Japanese \*(TX TFM
+\fBmakejvf\fR is a tool to generate Japanese VF file from Japanese \*(TX TFM
 (JFM) file for use with dvips.
+.TP 5
+When processing Japanese texts, p\*(TX refers to JFM (min10.tfm, jis.tfm \
+etc.), which includes definitions of some different character widths and \
+metric glue/kerns. For most punctuations and quotation marks, the \
+character widths are truncated to less than 1 zw (zenkaku-width; the \
+width of ordinary Kanji characters), and metric glue/kerns are inserted \
+as a substitute.
+.TP 5
+On the other hand, in Japanese PS fonts, all punctuations and quotation \
+marks have the same character widths as ordinary Kanji characters. \
+For this reason, when dvips processes the resulting DVI, these characters \
+have to be shifted to the left by the amount of glue/kerns inserted.
+.TP 5
+To achieve this, Virtual fonts (VF) and PS TFM files are required; \
+VF should include the commands of shifting characters, and PS TFM should \
+have the exact character widths of PS fonts. \
+The program \fBmakejvf\fR can be used for this purpose.
 .SH OPTIONS
 .PP
 .TP 10
@@ -56,6 +73,23 @@
 .TP 10
 \fB-i\fR
 Start font ID from No. 0.
+.TP 10
+\fB-e\fR
+Enhanced mode; the horizontal shift amount is determined from the
+glue/kern table of input JFM file.
+.TP 10
+By default, \fBmakejvf\fR uses the hard-coded value as the horizontal \
+shift amount, which is (mostly) optimized for Japanese fonts. \
+When enhanced mode (option \fB-e\fR) is enabled, the shift amount is \
+determined from the input p\*(TX TFM (JFM) file, which is likely to \
+output most suitable VF for the JFM.
+.TP 10
+For most standard Japanese JFM (like jis.tfm and its derivatives), \
+the output VFs from both modes will have no significant difference. \
+For simplified/traditional Chinese JFM (like upschrm-h.tfm and \
+uptchcrm-h.tfm), the output VF from enhanced mode will be better. \
+For min10.tfm and its derivatives, enhanced mode should \fInever\fR be \
+enabled, since the characterization in min10.tfm is non-standard.
 .SH EXAMPLE
 .TP 5
 If you want to use min10 as Ryumin-Light-H, run

Modified: trunk/Build/source/texk/makejvf/makejvf.h
===================================================================
--- trunk/Build/source/texk/makejvf/makejvf.h	2017-07-17 00:21:32 UTC (rev 44826)
+++ trunk/Build/source/texk/makejvf/makejvf.h	2017-07-17 02:30:36 UTC (rev 44827)
@@ -1,5 +1,5 @@
 
-
+#define MAX_LIG_STEPS 32510
 extern char *vtfmname,*kanatfm,*jistfm,*ucsqtfm;
 extern int unit,zh,zw,jfm_id;
 extern unsigned int rightamount;

Modified: trunk/Build/source/texk/makejvf/tfmread.c
===================================================================
--- trunk/Build/source/texk/makejvf/tfmread.c	2017-07-17 00:21:32 UTC (rev 44826)
+++ trunk/Build/source/texk/makejvf/tfmread.c	2017-07-17 02:30:36 UTC (rev 44827)
@@ -13,6 +13,7 @@
 int jfmread(int kcode)
 {
 	int i,ctype = 0,w_ind,w,gk_ind,k_ind,g_ind;
+	unsigned int ll,rr;
 
 	for (i = 0 ; i < nt ; i++) {
 		if (upair(&char_type[i*4]) == kcode) {
@@ -25,25 +26,55 @@
 	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]);
+	if (w != zw) {
+		/* get natural length of JFM glue between <type0> and <type of kcode> */
+		gk_ind = char_info[0*4+3]; /* remainder for <type0> */
+		ll = 0;
+		if (ctype > 0) {
+			for (i = 0 ; i < MAX_LIG_STEPS ; 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];
+						ll = mquad(&kern[k_ind*4]);
+					}
+					else {
+						g_ind = glue_kern[(gk_ind+i)*4+3];
+						ll = mquad(&glue[3*g_ind*4]);
+					}
+					break;
 				}
-				else {
-					g_ind = glue_kern[(gk_ind+i)*4+3];
-					rightamount = mquad(&glue[3*g_ind*4]);
+				if (glue_kern[(gk_ind+i)*4] >= 128)
+					break;
+			}
+		}
+		/* get natural length of JFM glue between <type of kcode> and <type0> */
+		gk_ind = char_info[ctype*4+3]; /* remainder for <type of kcode> */
+		rr = 0;
+		if (ctype > 0) {
+			for (i = 0 ; i < MAX_LIG_STEPS ; i++) {
+				if (glue_kern[(gk_ind+i)*4+1] == 0) {
+					if (glue_kern[(gk_ind+i)*4+2] >= 128) {
+						k_ind = glue_kern[(gk_ind+i)*4+3];
+						rr = mquad(&kern[k_ind*4]);
+					}
+					else {
+						g_ind = glue_kern[(gk_ind+i)*4+3];
+						rr = mquad(&glue[3*g_ind*4]);
+					}
+					break;
 				}
-				break;
+				if (glue_kern[(gk_ind+i)*4] >= 128)
+					break;
 			}
-			if (glue_kern[(gk_ind+i)*4] >= 128)
-				break;
 		}
+		if (ll + w + rr == zw)
+			/* character width is truncated,
+			   and metric glue/kern is inserted as a substitute to fill zenkaku */
+			rightamount = ll;
+		else
+			/* character width is actually truncated */
+			rightamount = (zw - w)/2;
 	}
 
 	return(w);

Modified: trunk/Build/source/texk/makejvf/write.c
===================================================================
--- trunk/Build/source/texk/makejvf/write.c	2017-07-17 00:21:32 UTC (rev 44826)
+++ trunk/Build/source/texk/makejvf/write.c	2017-07-17 02:30:36 UTC (rev 44827)
@@ -89,7 +89,7 @@
 
 	if (fidzero) fidshift=-1;
 
-	w = jfmread(code);
+	w = jfmread(code); /* rightamount is also obtained */
 
 	fputc(242,fp); /* long_char */
 
@@ -351,7 +351,7 @@
 
 	if (fidzero) fidshift=-1;
 
-	w = jfmread(code);
+	w = jfmread(code); /* rightamount is also obtained */
 
 	fputc(242,fp); /* long_char */
 
@@ -614,6 +614,7 @@
 		if (jfm_id == 11 && hankana) { /* Ⱦ\xB3\xD1\xCAҲ\xBE̾\xA1\xA2\xB2\xA3\xBD񤭻\xFE */
 			pstfm_codes[pstfm_nt-1]=code;
 			pstfm_nt+=1;
+			rightamount=0; /* discard jfmread() result */
 			break;
 		}
 	default:



More information about the tex-live-commits mailing list