summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
authorHironobu Yamashita <h.y.acetaminophen@gmail.com>2017-07-17 02:30:36 +0000
committerHironobu Yamashita <h.y.acetaminophen@gmail.com>2017-07-17 02:30:36 +0000
commit87f4648d57d75c89f84182ebba973924a8a66a46 (patch)
tree278fddfb32a7ac32b87738df2fcb7cb299f3d143 /Build/source
parent3b9640944b02d59559834f77f83b15810788e0da (diff)
makejvf: Improve enhanced mode (version 20170717)
git-svn-id: svn://tug.org/texlive/trunk@44827 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r--Build/source/texk/makejvf/ChangeLog11
-rw-r--r--Build/source/texk/makejvf/Makefile.am3
-rw-r--r--Build/source/texk/makejvf/Makefile.in2
-rw-r--r--Build/source/texk/makejvf/main.c5
-rw-r--r--Build/source/texk/makejvf/makejvf.136
-rw-r--r--Build/source/texk/makejvf/makejvf.h2
-rw-r--r--Build/source/texk/makejvf/tfmread.c59
-rw-r--r--Build/source/texk/makejvf/write.c5
8 files changed, 101 insertions, 22 deletions
diff --git a/Build/source/texk/makejvf/ChangeLog b/Build/source/texk/makejvf/ChangeLog
index f2692aed769..9a9517b712b 100644
--- a/Build/source/texk/makejvf/ChangeLog
+++ b/Build/source/texk/makejvf/ChangeLog
@@ -1,3 +1,14 @@
+2017-07-17 Hironobu Yamashita <h.y.acetaminophen@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@gmail.com>
makejvf version 20170716.
diff --git a/Build/source/texk/makejvf/Makefile.am b/Build/source/texk/makejvf/Makefile.am
index 8fbaf99cb96..27826b46b6f 100644
--- a/Build/source/texk/makejvf/Makefile.am
+++ b/Build/source/texk/makejvf/Makefile.am
@@ -1,6 +1,7 @@
## Makefile.am for the TeX Live subdirectory texk/makejvfk/
##
## Copyright (C) 2010-2015 Peter Breitenlohner <tex-live@tug.org>
+## Copyright (C) 2016-2017 Japanese TeX Development Community <issue@texjp.org>
## You may freely use, modify and/or distribute this file.
##
AM_CPPFLAGS = $(PTEXENC_INCLUDES) $(KPATHSEA_INCLUDES)
@@ -9,7 +10,7 @@ AM_CFLAGS = $(WARNING_CFLAGS)
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)
diff --git a/Build/source/texk/makejvf/Makefile.in b/Build/source/texk/makejvf/Makefile.in
index e59c05ed0c2..33f3d6f89f5 100644
--- a/Build/source/texk/makejvf/Makefile.in
+++ b/Build/source/texk/makejvf/Makefile.in
@@ -549,7 +549,7 @@ top_srcdir = @top_srcdir@
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 \
diff --git a/Build/source/texk/makejvf/main.c b/Build/source/texk/makejvf/main.c
index 45b8141a458..4d3c3f63516 100644
--- a/Build/source/texk/makejvf/main.c
+++ b/Build/source/texk/makejvf/main.c
@@ -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 @@ int main(int argc, char ** argv)
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 長体モード\n", stderr);
@@ -195,5 +196,5 @@ void usage(void)
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@texjp.org.\n", stderr);
+ fprintf(stderr, "Email bug reports to %s.\n", BUG_ADDRESS);
}
diff --git a/Build/source/texk/makejvf/makejvf.1 b/Build/source/texk/makejvf/makejvf.1
index 34c4ceb28a4..c3ae8b786e1 100644
--- a/Build/source/texk/makejvf/makejvf.1
+++ b/Build/source/texk/makejvf/makejvf.1
@@ -6,8 +6,25 @@ makejvf \- Make Japanese VF file from Japanese \*(TX TFM file
.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 @@ Use half-width Katakana (with UCS mode)
.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
diff --git a/Build/source/texk/makejvf/makejvf.h b/Build/source/texk/makejvf/makejvf.h
index 17dc32a729b..252c66a5911 100644
--- a/Build/source/texk/makejvf/makejvf.h
+++ b/Build/source/texk/makejvf/makejvf.h
@@ -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;
diff --git a/Build/source/texk/makejvf/tfmread.c b/Build/source/texk/makejvf/tfmread.c
index f2f7573107b..64c72cfb3a6 100644
--- a/Build/source/texk/makejvf/tfmread.c
+++ b/Build/source/texk/makejvf/tfmread.c
@@ -13,6 +13,7 @@ unsigned char *header,*char_type,*char_info,*glue_kern,*kern,*glue;
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 @@ int jfmread(int 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]);
+ 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);
diff --git a/Build/source/texk/makejvf/write.c b/Build/source/texk/makejvf/write.c
index 2e4c07332f2..1acfbb99a2b 100644
--- a/Build/source/texk/makejvf/write.c
+++ b/Build/source/texk/makejvf/write.c
@@ -89,7 +89,7 @@ void writevf(int code, FILE *fp)
if (fidzero) fidshift=-1;
- w = jfmread(code);
+ w = jfmread(code); /* rightamount is also obtained */
fputc(242,fp); /* long_char */
@@ -351,7 +351,7 @@ void writevfu(int code, FILE *fp)
if (fidzero) fidshift=-1;
- w = jfmread(code);
+ w = jfmread(code); /* rightamount is also obtained */
fputc(242,fp); /* long_char */
@@ -614,6 +614,7 @@ void writevfu(int code, FILE *fp)
if (jfm_id == 11 && hankana) { /* 半角片仮名、横書き時 */
pstfm_codes[pstfm_nt-1]=code;
pstfm_nt+=1;
+ rightamount=0; /* discard jfmread() result */
break;
}
default: