summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHironobu Yamashita <h.y.acetaminophen@gmail.com>2017-07-16 03:19:50 +0000
committerHironobu Yamashita <h.y.acetaminophen@gmail.com>2017-07-16 03:19:50 +0000
commit85eb8925e6fb9546abdd206a07fa98e5388932cc (patch)
tree4f29b0e4c399a8ca001885d11460e56a9d23949c
parent0cc8cd788ababceacfde0bd3b48840fd9fc5cb7a (diff)
makejvf: Add enhanced mode (version 20170716)
git-svn-id: svn://tug.org/texlive/trunk@44817 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/makejvf/COPYRIGHT4
-rw-r--r--Build/source/texk/makejvf/ChangeLog9
-rw-r--r--Build/source/texk/makejvf/main.c12
-rw-r--r--Build/source/texk/makejvf/makejvf.h3
-rw-r--r--Build/source/texk/makejvf/tfmread.c47
-rw-r--r--Build/source/texk/makejvf/write.c16
6 files changed, 81 insertions, 10 deletions
diff --git a/Build/source/texk/makejvf/COPYRIGHT b/Build/source/texk/makejvf/COPYRIGHT
index 9f2495ecb04..10a11ecc128 100644
--- a/Build/source/texk/makejvf/COPYRIGHT
+++ b/Build/source/texk/makejvf/COPYRIGHT
@@ -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
diff --git a/Build/source/texk/makejvf/ChangeLog b/Build/source/texk/makejvf/ChangeLog
index b6f2c1af91e..f2692aed769 100644
--- a/Build/source/texk/makejvf/ChangeLog
+++ b/Build/source/texk/makejvf/ChangeLog
@@ -1,3 +1,12 @@
+2017-07-16 Hironobu Yamashita <h.y.acetaminophen@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@gmail.com>
* main.c, makejvf.h, uniblock.[ch], write.c: Move more non-Kanji
diff --git a/Build/source/texk/makejvf/main.c b/Build/source/texk/makejvf/main.c
index 8b733a33ff4..45b8141a458 100644
--- a/Build/source/texk/makejvf/main.c
+++ b/Build/source/texk/makejvf/main.c
@@ -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 @@ int main(int argc, char ** argv)
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 @@ int main(int argc, char ** argv)
case 'i':
fidzero=1;
break;
+ case 'e':
+ enhanced=1;
+ break;
default:
usage();
exit(0);
@@ -170,7 +173,7 @@ int main(int argc, char ** argv)
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 長体モード\n", stderr);
@@ -190,4 +193,7 @@ void usage(void)
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@texjp.org.\n", stderr);
}
diff --git a/Build/source/texk/makejvf/makejvf.h b/Build/source/texk/makejvf/makejvf.h
index 3fab5b32ad3..17dc32a729b 100644
--- a/Build/source/texk/makejvf/makejvf.h
+++ b/Build/source/texk/makejvf/makejvf.h
@@ -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;
diff --git a/Build/source/texk/makejvf/tfmread.c b/Build/source/texk/makejvf/tfmread.c
index 7af673d4304..f2f7573107b 100644
--- a/Build/source/texk/makejvf/tfmread.c
+++ b/Build/source/texk/makejvf/tfmread.c
@@ -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 @@ int jfmread(int kcode)
}
}
+ /* 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 @@ int tfmidx(FILE *fp)
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);
diff --git a/Build/source/texk/makejvf/write.c b/Build/source/texk/makejvf/write.c
index ac7641e3c64..2e4c07332f2 100644
--- a/Build/source/texk/makejvf/write.c
+++ b/Build/source/texk/makejvf/write.c
@@ -306,6 +306,14 @@ void writevf(int code, FILE *fp)
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 @@ void writevfu(int code, FILE *fp)
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