diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-01-16 14:44:56 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-01-16 14:44:56 +0000 |
commit | c0b77e85fa6f50dcb376db6dad932c2147cff804 (patch) | |
tree | 8bb1fad58bf10bfa14106cbfc345ef0669d1fa00 /Build/source/texk/makejvf | |
parent | 3fa84a3afddbb0384c56c6ed1de16132a71b30a5 (diff) |
upTeX 1.00 - from TANAKA Takuji <KXD02663@nifty.ne.jp>
git-svn-id: svn://tug.org/texlive/trunk@25119 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/makejvf')
-rw-r--r-- | Build/source/texk/makejvf/ChangeLog | 8 | ||||
-rw-r--r-- | Build/source/texk/makejvf/Makefile.am | 9 | ||||
-rw-r--r-- | Build/source/texk/makejvf/Makefile.in | 7 | ||||
-rw-r--r-- | Build/source/texk/makejvf/Makefile.orig | 30 | ||||
-rw-r--r-- | Build/source/texk/makejvf/main.c | 91 | ||||
-rw-r--r-- | Build/source/texk/makejvf/makejvf.h | 6 | ||||
-rw-r--r-- | Build/source/texk/makejvf/write.c | 475 |
7 files changed, 571 insertions, 55 deletions
diff --git a/Build/source/texk/makejvf/ChangeLog b/Build/source/texk/makejvf/ChangeLog index a0976987ac4..837a124c60d 100644 --- a/Build/source/texk/makejvf/ChangeLog +++ b/Build/source/texk/makejvf/ChangeLog @@ -1,3 +1,11 @@ +2012-01-16 Peter Breitenlohner <peb@mppmu.mpg.de> + + Update for upTeX-1.00. From TANAKA Takuji <KXD02663@nifty.ne.jp>. + * uniblock.[ch]: New files. + * main.c, makejvf.h, write.c: Use the new files. + * Makefile.am (makejvf_SOURCES): Add the new files. + (EXTRA_DIST): Drop Makefile.orig. + 2011-04-19 Peter Breitenlohner <peb@mppmu.mpg.de> Avoid 'differ in signedness' warnings. diff --git a/Build/source/texk/makejvf/Makefile.am b/Build/source/texk/makejvf/Makefile.am index 628a6580a0c..82498272198 100644 --- a/Build/source/texk/makejvf/Makefile.am +++ b/Build/source/texk/makejvf/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am for the TeX Live subdirectory texk/makejvfk/ ## -## Copyright (C) 2010 Peter Breitenlohner <tex-live@tug.org> +## Copyright (C) 2010, 2012 Peter Breitenlohner <tex-live@tug.org> ## You may freely use, modify and/or distribute this file. ## ACLOCAL_AMFLAGS = -I ../../m4 @@ -11,7 +11,7 @@ AM_CFLAGS = $(WARNING_CFLAGS) bin_PROGRAMS = makejvf makejvf_SOURCES = \ - main.c makejvf.h tfmread.c tool.c write.c + main.c makejvf.h tfmread.c tool.c uniblock.c uniblock.h write.c $(makejvf_OBJECTS): $(KPATHSEA_DEPEND) $(PTEXENC_DEPEND) @@ -37,8 +37,3 @@ EXTRA_DIST += \ DISTCLEANFILES = min10.vf rml.tfm rmlv.tfm tmin10.vf -## Eventually delete this file -## -EXTRA_DIST += \ - Makefile.orig - diff --git a/Build/source/texk/makejvf/Makefile.in b/Build/source/texk/makejvf/Makefile.in index 703b1ff4ccc..f22ec84cad4 100644 --- a/Build/source/texk/makejvf/Makefile.in +++ b/Build/source/texk/makejvf/Makefile.in @@ -71,7 +71,7 @@ CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am_makejvf_OBJECTS = main.$(OBJEXT) tfmread.$(OBJEXT) tool.$(OBJEXT) \ - write.$(OBJEXT) + uniblock.$(OBJEXT) write.$(OBJEXT) makejvf_OBJECTS = $(am_makejvf_OBJECTS) makejvf_LDADD = $(LDADD) am__DEPENDENCIES_1 = @@ -234,12 +234,12 @@ ACLOCAL_AMFLAGS = -I ../../m4 INCLUDES = $(PTEXENC_INCLUDES) $(KPATHSEA_INCLUDES) AM_CFLAGS = $(WARNING_CFLAGS) makejvf_SOURCES = \ - main.c makejvf.h tfmread.c tool.c write.c + main.c makejvf.h tfmread.c tool.c uniblock.c uniblock.h write.c LDADD = $(PTEXENC_LIBS) $(KPATHSEA_LIBS) EXTRA_DIST = COPYRIGHT COPYRIGHT.jis Changes.txt README.txt \ tests/min10.tfm tests/min10.vf tests/rml.tfm tests/rmlv.tfm \ - tests/tmin10.tfm tests/tmin10.vf Makefile.orig + tests/tmin10.tfm tests/tmin10.vf dist_check_SCRIPTS = makejvf.test TESTS = makejvf.test DISTCLEANFILES = min10.vf rml.tfm rmlv.tfm tmin10.vf @@ -353,6 +353,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfmread.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tool.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uniblock.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/write.Po@am__quote@ .c.o: diff --git a/Build/source/texk/makejvf/Makefile.orig b/Build/source/texk/makejvf/Makefile.orig deleted file mode 100644 index f4b836129cf..00000000000 --- a/Build/source/texk/makejvf/Makefile.orig +++ /dev/null @@ -1,30 +0,0 @@ -CC = gcc -CCLD =$(CC) -PROGRAM = makejvf - -# インストール先を DISTDIR に指定する -DISTDIR = /usr/local/bin - -CFLAGS = -O -PROGLINK = $(CC) $(OBJS) -o $(PROGRAM) - -OBJS = main.o tfmread.o tool.o write.o - -link_command = $(CCLD) -o $(PROGRAM) $(LDFLAGS) - -$(PROGRAM): $(OBJS) $(kpathsea) - $(PROGLINK) - -main.o:main.c -tfmread.o:tfmread.c -tool.o:tool.c -write.o:write.c - -install: $(PROGRAM) - install -C -m 755 $? $(DISTDIR) - -clean: - rm -f *.o makejvf - -distclean: - rm -f *.o *.core *.tfm *.vf *.tex *.dvi *.ps $(PROGRAM) diff --git a/Build/source/texk/makejvf/main.c b/Build/source/texk/makejvf/main.c index 132fb35b13a..60cb5a73446 100644 --- a/Build/source/texk/makejvf/main.c +++ b/Build/source/texk/makejvf/main.c @@ -5,14 +5,17 @@ #include <kpathsea/config.h> #include <ptexenc/ptexenc.h> #include "makejvf.h" +#include "uniblock.h" FILE *vfp,*afp=NULL; -char *atfmname,*vtfmname,*afmname,*vfname,*kanatfm; -int kanatume=-1,chotai=0,baseshift=0,minute=0; +char *atfmname,*vtfmname,*afmname,*vfname,*kanatfm,*jistfm,*ucsqtfm; +int kanatume=-1,chotai=0,baseshift=0,minute=0,useset3=0,hankana=0,fidzero=0; +long ucs=0; int main(int argc, char ** argv) { - int i,j; + int i,j,ib; + long ch; set_enc_string(NULL, "EUC"); if (argc < 3) { @@ -66,6 +69,48 @@ int main(int argc, char ** argv) case 'm': minute=1; break; + case 'u': + argv++; + if (!strcmp(*argv,"gb")) + ucs = ENTRY_G; + else if (!strcmp(*argv,"cns")) + ucs = ENTRY_C; + else if (!strcmp(*argv,"jisq")) + ucs = ENTRY_JQ; + else if (!strcmp(*argv,"jis")) + ucs = ENTRY_J; + else if (!strcmp(*argv,"ks")) + ucs = ENTRY_K; + else { + fprintf(stderr,"Charset is not set\n"); + ucs = ENTRY_NO; + } + break; + case '3': + useset3=1; + break; + case 'J': + if ((*argv)[2]!='\0') { + jistfm = strdup(&(*argv)[2]); + } + else { + jistfm = strdup(*(++argv)); + } + break; + case 'U': + if ((*argv)[2]!='\0') { + ucsqtfm = strdup(&(*argv)[2]); + } + else { + ucsqtfm = strdup(*(++argv)); + } + break; + case 'H': + hankana=1; + break; + case 'i': + fidzero=1; + break; default: usage(); exit(0); @@ -111,11 +156,35 @@ int main(int argc, char ** argv) maketfm(kanatfm); } + if (jistfm) { + if (!strcmp(&jistfm[strlen(jistfm)-4],".tfm")) { + jistfm[strlen(jistfm)-4] = '\0'; + } + maketfm(jistfm); + } + + if (ucsqtfm) { + if (!strcmp(&ucsqtfm[strlen(ucsqtfm)-4],".tfm")) { + ucsqtfm[strlen(ucsqtfm)-4] = '\0'; + } + maketfm(ucsqtfm); + } + vfp = vfopen(vfname); - for (i=0;i<94;i++) - for (j=0;j<94;j++) - writevf((0x21+i)*256+(0x21+j),vfp); + if (ucs) { + ib=0; + for (i=0;i<(useset3+1);i++) + for (j=0;j<65536;j++) { + ch=i*2*65536+j; + if (search_cjk_entry(&ib,ch,ucs)) + writevfu(ch,vfp); + } + } else { + for (i=0;i<94;i++) + for (j=0;j<94;j++) + writevf((0x21+i)*256+(0x21+j),vfp); + } vfclose(vfp); @@ -124,7 +193,7 @@ int main(int argc, char ** argv) void usage(void) { - fputs2("MAKEJVF ver.1.1a -- make Japanese VF file.\n", stderr); + fputs2("MAKEJVF ver.1.1a-u1.00 -- make Japanese VF file.\n", stderr); fputs2("%% makejvf [<options>] <TFMfile> <PSfontTFM>\n", stderr); fputs2("options:\n", stderr); fputs2("-C 長体モード\n", stderr); @@ -136,4 +205,12 @@ void usage(void) fputs2("-a <AFMfile> AFMファイル名(かな詰め時に使用)\n", stderr); fputs2("-k <数値> かな詰めマージン指定\n", stderr); fputs2(" 文字幅を1000として整数で指定。-aオプションと共に使用\n", stderr); + fputs2("-u <Charset> UCS mode\n", stderr); + fputs2(" <Charset> gb : GB, cns : CNS, ks : KS\n", stderr); + fputs2(" jis : JIS, jisq : JIS quote only\n", stderr); + fputs2("-J <TFMfile> JIS encoded PS font TFM name for quote, double quote with UCS mode\n", stderr); + fputs2("-U <TFMfile> UCS encoded PS font TFM name for quote, double quote with UCS mode\n", stderr); + 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); } diff --git a/Build/source/texk/makejvf/makejvf.h b/Build/source/texk/makejvf/makejvf.h index da6ab06963a..6ab054acef0 100644 --- a/Build/source/texk/makejvf/makejvf.h +++ b/Build/source/texk/makejvf/makejvf.h @@ -1,9 +1,10 @@ -extern char *vtfmname,*kanatfm; +extern char *vtfmname,*kanatfm,*jistfm,*ucsqtfm; extern int unit,zh,zw,jfm_id; -extern int kanatume,chotai,baseshift,minute; +extern int kanatume,chotai,baseshift,minute,hankana,fidzero; extern FILE *afp; +extern long ucs; /* main.c */ void usage(void); @@ -27,5 +28,6 @@ int fputstr(char *str, int byte, FILE *fp); /* write.c */ FILE *vfopen(char *name); void writevf(int code, FILE *fp); +void writevfu(int code, FILE *fp); void vfclose(FILE *fp); void maketfm(char *name); diff --git a/Build/source/texk/makejvf/write.c b/Build/source/texk/makejvf/write.c index 0ef2617aa78..2cd309f30dc 100644 --- a/Build/source/texk/makejvf/write.c +++ b/Build/source/texk/makejvf/write.c @@ -3,11 +3,14 @@ #include <kpathsea/config.h> #include "makejvf.h" +#include "uniblock.h" FILE *vfopen(char *name) { FILE *fp; + int fidshift=0; + if (fidzero) fidshift=-1; fp = fopen(name,"w"); if (fp == NULL) { fprintf(stderr,"I cannot create VF file, %s.",name); @@ -21,7 +24,7 @@ FILE *vfopen(char *name) fputnum(10*(1<<20),4,fp); /* TFM design size */ fputc(243,fp); /* fnt_def1 */ - fputc(1,fp); /* Font ID */ + fputc(1+fidshift,fp); /* Font ID */ fputnum(0,4,fp); /* TFM check sum */ if (chotai) fputnum(zh,4,fp); /* font design size (scaled) */ @@ -34,7 +37,7 @@ FILE *vfopen(char *name) if (kanatfm) { fputc(243,fp); /* fnt_def1 */ - fputc(2,fp); /* Font ID */ + fputc(2+fidshift,fp); /* Font ID */ fputnum(0,4,fp); /* TFM check sum */ if (chotai) fputnum(zh,4,fp); /* font design size (scaled) */ @@ -46,6 +49,33 @@ FILE *vfopen(char *name) fputstr(kanatfm,strlen(kanatfm),fp); /* directory + fontname */ } + if (ucsqtfm) { + fputc(243,fp); /* fnt_def1 */ + fputc(3+fidshift,fp); /* Font ID */ + fputnum(0,4,fp); /* TFM check sum */ + if (chotai) + fputnum(zh,4,fp); /* font design size (scaled) */ + else + fputnum(zw,4,fp); /* font design size (scaled) */ + fputnum(10*(1<<20),4,fp); /* font design size */ + fputc(0,fp); /* directory length */ + fputc(strlen(ucsqtfm),fp); /* fontname length */ + fputstr(ucsqtfm,strlen(ucsqtfm),fp); /* directory + fontname */ + } + else if (jistfm) { + fputc(243,fp); /* fnt_def1 */ + fputc(3+fidshift,fp); /* Font ID */ + fputnum(0,4,fp); /* TFM check sum */ + if (chotai) + fputnum(zh,4,fp); /* font design size (scaled) */ + else + fputnum(zw,4,fp); /* font design size (scaled) */ + fputnum(10*(1<<20),4,fp); /* font design size */ + fputc(0,fp); /* directory length */ + fputc(strlen(jistfm),fp); /* fontname length */ + fputstr(jistfm,strlen(jistfm),fp); /* directory + fontname */ + } + return fp; } @@ -53,6 +83,9 @@ void writevf(int code, FILE *fp) { int cc,cc2,cc3,cc4,w,skip=0,skip2=0,height=1000; char buf[256],buf2[256]; + int fidshift=0; + + if (fidzero) fidshift=-1; w = jfmread(code); @@ -109,7 +142,7 @@ void writevf(int code, FILE *fp) fputc(157+numcount(skip2)-1,fp); /* DOWN */ fputnum2(skip2,fp); } - if (kanatfm) fputc(173,fp); /* FONT_NUM_2 */ + if (kanatfm) fputc(173+fidshift,fp); /* FONT_NUM_2 */ fputc(129,fp); /* SET2 */ if (code == 0x2146) fputnum(0x216c,2,fp); /* char code */ @@ -189,7 +222,7 @@ void writevf(int code, FILE *fp) fputc(239,fp); /* XXX1 */ fputc(88,fp); fputs("ps: gsave currentpoint currentpoint translate 180 neg rotate neg exch neg exch translate",fp); - if (kanatfm) fputc(173,fp); /* FONT_NUM_2 */ + if (kanatfm) fputc(173+fidshift,fp); /* FONT_NUM_2 */ fputc(129,fp); /* SET2 */ if (code == 0x2147) fputnum(0x216c,2,fp); /* char code */ @@ -328,14 +361,444 @@ void writevf(int code, FILE *fp) } if (kanatfm) { if (code <= 0x2576) - fputc(173,fp); /* FONT_NUM_2 */ + fputc(173+fidshift,fp); /* FONT_NUM_2 */ else - fputc(172,fp); /* FONT_NUM_1 */ + fputc(172+fidshift,fp); /* FONT_NUM_1 */ } fputc(129,fp); /* SET2 */ fputnum(code,2,fp); /* char code */ } +void writevfu(int code, FILE *fp) +{ + int cc,cc2,cc3,cc4,w,skip=0,skip2=0,height=1000; + char buf[256],buf2[256]; + int fidshift=0; + + if (fidzero) fidshift=-1; + + w = jfmread(code); + + fputc(242,fp); /* long_char */ + + skip2=baseshift; + switch (code) { + case 0x2018: /* ‘ */ + case 0x201c: /* “ */ + if (jfm_id == 9 && minute) { /* 縦書き時はミニュートへ変換 */ + if (afp) { + if (code == 0x2018) + sprintf(buf2,"CH <2032>"); + else + sprintf(buf2,"CH <2033>"); + rewind(afp); + while (fgets(buf,255,afp)!=NULL) { + if (jfm_id==9 && !strncmp(buf,"FontBBox ",9)) { + sscanf(&buf[9],"%d %d %d %d",&cc,&cc2,&cc3,&cc4); + height=cc4; + } + if (!strncmp(buf,buf2,strlen(buf2))) { + sscanf(&buf[14],"%d %d %d %d",&cc,&cc2,&cc3,&cc4); + skip=(int)(w+((double)(cc2-height)/1000.0-0.05)*zw); + break; + } + } + } + else + skip=(int)((0.1)*zw); + if (code == 0x2018) { + skip2+=-(int)((0.65)*zh); + } + else { + skip2+=-(int)((0.6)*zh); + } + + if (kanatfm) + cc=4; + else + cc=3; + if (skip) + cc+=numcount(skip)+1; + if (skip2) + cc+=numcount(skip2)+1; + fputnum(cc,4,fp); + fputnum(code,4,fp); /* char code */ + fputnum(w,4,fp); /* char width */ + if (skip) { + fputc(143+numcount(skip)-1,fp); /* RIGHT */ + fputnum2(skip,fp); + } + if (skip2) { + fputc(157+numcount(skip2)-1,fp); /* DOWN */ + fputnum2(skip2,fp); + } + if (kanatfm) fputc(173+fidshift,fp); /* FONT_NUM_2 */ + if (code == 0x2018) + fputnum(0x2032,2,fp); /* char code */ + else + fputnum(0x2033,2,fp); /* char code */ + return; + } + else if (ucsqtfm) { /* UniJIS-UCS2-H系へ変換 */ + cc=4; + skip = -(zw-w); + if (skip) + cc+=numcount(skip)+1; + if (skip2) + cc+=numcount(skip2)+1; + fputnum(cc,4,fp); + fputnum(code,4,fp); /* char code */ + fputnum(w,4,fp); /* char width */ + if (skip) { + fputc(143+numcount(skip)-1,fp); /* RIGHT */ + fputnum2(skip,fp); + } + if (skip2) { + fputc(157+numcount(skip2)-1,fp); /* DOWN */ + fputnum2(skip2,fp); + } + fputc(174+fidshift,fp); /* FONT_NUM_3 */ + fputc(129,fp); /* SET2 */ + fputnum(code,2,fp); /* char code */ + return; + } + else if (jfm_id == 11 && jistfm) { /* 横書き時はJIS系へ変換 */ + /* UCS U+2018 → JIS 0x2146, UCS U+201C → JIS 0x2148 */ + cc=4; + skip = -(zw-w); + if (skip) + cc+=numcount(skip)+1; + if (skip2) + cc+=numcount(skip2)+1; + fputnum(cc,4,fp); + fputnum(code,4,fp); /* char code */ + fputnum(w,4,fp); /* char width */ + if (skip) { + fputc(143+numcount(skip)-1,fp); /* RIGHT */ + fputnum2(skip,fp); + } + if (skip2) { + fputc(157+numcount(skip2)-1,fp); /* DOWN */ + fputnum2(skip2,fp); + } + fputc(174+fidshift,fp); /* FONT_NUM_3 */ + fputc(129,fp); /* SET2 */ + if (code == 0x2018) + fputnum(0x2146,2,fp); /* char code */ + else + fputnum(0x2148,2,fp); /* char code */ + return; + } + case 0xFF08: /* ( */ + case 0x3014: /* 〔 */ + case 0xFF3B: /* [ */ + case 0xFF5B: /* { */ + case 0x3008: /* 〈 */ + case 0x300A: /* 《 */ + case 0x300C: /* 「 */ + case 0x300E: /* 『 */ + case 0x3010: /* 【 */ + case 0xFF5F: /* JIS X 0213 1-02-54 始め二重バーレーン */ + case 0x3018: /* JIS X 0213 1-02-56 始め二重亀甲括弧 */ + case 0x3016: /* JIS X 0213 1-02-58 始めすみ付き括弧(白) */ + case 0x301D: /* JIS X 0213 1-13-64 始めダブルミニュート */ + if (ucs != ENTRY_JQ) + skip = -(zw-w); + if (kanatfm) + cc=4; + else + cc=3; + if (skip) + cc+=numcount(skip)+1; + if (skip2) + cc+=numcount(skip2)+1; + fputnum(cc,4,fp); + break; + case 0x2019: /* ’ */ + case 0x201d: /* ” */ + if (jfm_id == 9 && minute) { /* 縦書き時はミニュートへ変換 */ + if (afp) { + if (code == 0x2019) + sprintf(buf2,"CH <216C>"); + else + sprintf(buf2,"CH <216D>"); + rewind(afp); + while (fgets(buf,255,afp)!=NULL) { + if (jfm_id==9 && !strncmp(buf,"FontBBox ",9)) { + sscanf(&buf[9],"%d %d %d %d",&cc,&cc2,&cc3,&cc4); + height=cc4; + } + if (!strncmp(buf,buf2,strlen(buf2))) { + sscanf(&buf[14],"%d %d %d %d",&cc,&cc2,&cc3,&cc4); + skip=(int)(((double)(height-cc2)/1000.0+0.05)*zw); + break; + } + } + } + else + skip=(int)((0.4)*zw); + if (code == 0x2019) { + skip2+=(int)((0.65)*zh); + } + else { + skip2+=(int)((0.6)*zh); + } + + if (kanatfm) + cc=4; + else + cc=3; + if (skip) + cc+=numcount(skip)+1; + if (skip2) + cc+=numcount(skip2)+1; + fputnum(cc+2+88+2+32,4,fp); + fputnum(code,4,fp); /* char code */ + fputnum(w,4,fp); /* char width */ + if (skip) { + fputc(143+numcount(skip)-1,fp); /* RIGHT */ + fputnum2(skip,fp); + } + if (skip2) { + fputc(157+numcount(skip2)-1,fp); /* DOWN */ + fputnum2(skip2,fp); + } + fputc(239,fp); /* XXX1 */ + fputc(88,fp); + fputs("ps: gsave currentpoint currentpoint translate 180 neg rotate neg exch neg exch translate",fp); + if (kanatfm) fputc(173+fidshift,fp); /* FONT_NUM_2 */ + fputc(129,fp); /* SET2 */ + if (code == 0x2019) + fputnum(0x2032,2,fp); /* char code */ + else + fputnum(0x2033,2,fp); /* char code */ + fputc(239,fp); /* XXX1 */ + fputc(32,fp); + fputs("ps: currentpoint grestore moveto",fp); + return; + } + else if (ucsqtfm) { /* UniJIS-UCS2-H系へ変換 */ + cc=4; + if (skip2) + cc+=numcount(skip2)+1; + fputnum(cc,4,fp); + fputnum(code,4,fp); /* char code */ + fputnum(w,4,fp); /* char width */ + if (skip2) { + fputc(157+numcount(skip2)-1,fp); /* DOWN */ + fputnum2(skip2,fp); + } + fputc(174+fidshift,fp); /* FONT_NUM_3 */ + fputc(129,fp); /* SET2 */ + fputnum(code,2,fp); /* char code */ + return; + } + else if (jfm_id == 11 && jistfm) { /* 横書き時はJIS系へ変換 */ + /* UCS U+2019 → JIS 0x2147, UCS U+201D → JIS 0x2149 */ + cc=4; + if (skip2) + cc+=numcount(skip2)+1; + fputnum(cc,4,fp); + fputnum(code,4,fp); /* char code */ + fputnum(w,4,fp); /* char width */ + if (skip2) { + fputc(157+numcount(skip2)-1,fp); /* DOWN */ + fputnum2(skip2,fp); + } + fputc(174+fidshift,fp); /* FONT_NUM_3 */ + fputc(129,fp); /* SET2 */ + if (code == 0x2019) + fputnum(0x2147,2,fp); /* char code */ + else + fputnum(0x2149,2,fp); /* char code */ + return; + } + case 0x3000: /* spc */ + case 0x3001: /* 、 */ + case 0x3002: /* 。 */ + case 0xFF0C: /* , */ + case 0xFF0E: /* . */ + case 0x309B: /* ゛ */ + case 0x309C: /* ゜ */ + case 0xFF09: /* ) */ + case 0x3015: /* 〕 */ + case 0xFF3D: /* ] */ + case 0xFF5D: /* } */ + case 0x3009: /* 〉 */ + case 0x300B: /* 》 */ + case 0x300D: /* 」 */ + case 0x300F: /* 』 */ + case 0x3011: /* 】 */ + case 0xFF60: /* JIS X 0213 1-02-55 終わり二重バーレーン */ + case 0x3019: /* JIS X 0213 1-02-57 終わり二重亀甲括弧 */ + case 0x3017: /* JIS X 0213 1-02-59 終わりすみ付き括弧(白) */ + case 0x301F: /* JIS X 0213 1-13-65 終わりダブルミニュート */ + case 0x00B0: /* ° */ + case 0x2032: /* ′ */ + case 0x2033: /* ″ */ + if (kanatfm) + cc=4; + else + cc=3; + if (skip2) + cc+=numcount(skip2)+1; + fputnum(cc,4,fp); + break; + case 0xFF61: case 0xFF62: case 0xFF63: case 0xFF64: case 0xFF65: case 0xFF66: case 0xFF67: + case 0xFF68: case 0xFF69: case 0xFF6A: case 0xFF6B: case 0xFF6C: case 0xFF6D: case 0xFF6E: case 0xFF6F: + case 0xFF70: case 0xFF71: case 0xFF72: case 0xFF73: case 0xFF74: case 0xFF75: case 0xFF76: case 0xFF77: + case 0xFF78: case 0xFF79: case 0xFF7A: case 0xFF7B: case 0xFF7C: case 0xFF7D: case 0xFF7E: case 0xFF7F: + case 0xFF80: case 0xFF81: case 0xFF82: case 0xFF83: case 0xFF84: case 0xFF85: case 0xFF86: case 0xFF87: + case 0xFF88: case 0xFF89: case 0xFF8A: case 0xFF8B: case 0xFF8C: case 0xFF8D: case 0xFF8E: case 0xFF8F: + case 0xFF90: case 0xFF91: case 0xFF92: case 0xFF93: case 0xFF94: case 0xFF95: case 0xFF96: case 0xFF97: + case 0xFF98: case 0xFF99: case 0xFF9A: case 0xFF9B: case 0xFF9C: case 0xFF9D: case 0xFF9E: case 0xFF9F: + if (jfm_id == 11 && hankana) { /* 半角片仮名、横書き時 */ + cc=3; + if (skip2) + cc+=numcount(skip2)+1; + fputnum(cc,4,fp); + fputnum(code,4,fp); /* char code */ + fputnum(w,4,fp); /* char width */ + if (skip2) { + fputc(157+numcount(skip2)-1,fp); /* DOWN */ + fputnum2(skip2,fp); + } + fputc(129,fp); /* SET2 */ + fputnum(code,2,fp); /* char code */ + return; + } + default: + if (w != zw) { + if (((code >= 0x3041 && code <= 0x30F6) || code == 0x30FC ) && kanatume>=0) { + sprintf(buf2,"CH <%X>",code); + rewind(afp); + while (fgets(buf,255,afp)!=NULL) { + if (jfm_id==9 && !strncmp(buf,"FontBBox ",9)) { + sscanf(&buf[9],"%d %d %d %d",&cc,&cc2,&cc3,&cc4); + height=cc4; + } + if (!strncmp(buf,buf2,strlen(buf2))) { + sscanf(&buf[14],"%d %d %d %d",&cc,&cc2,&cc3,&cc4); + if (jfm_id==9) { + switch (code) { + case 0x3041: + case 0x3043: + case 0x3045: + case 0x3047: + case 0x3049: + case 0x3063: + case 0x3083: + case 0x3085: + case 0x3087: + case 0x308E: + case 0x30A1: + case 0x30A3: + case 0x30A5: + case 0x30A7: + case 0x30A9: + case 0x30C3: + case 0x30E3: + case 0x30E5: + case 0x30E7: + case 0x30EE: + case 0x30F5: + case 0x30F6: + case 0x3095: /* JIS X 0213 1-04-85 小書き平仮名か */ + case 0x3096: /* JIS X 0213 1-04-86 小書き平仮名け */ + case 0x31F0: /* JIS X 0213 1-06-78 小書き片仮名ク */ + case 0x31F1: /* JIS X 0213 1-06-79 小書き片仮名シ */ + case 0x31F2: /* JIS X 0213 1-06-80 小書き片仮名ス */ + case 0x31F3: /* JIS X 0213 1-06-81 小書き片仮名ト */ + case 0x31F4: /* JIS X 0213 1-06-82 小書き片仮名ヌ */ + case 0x31F5: /* JIS X 0213 1-06-83 小書き片仮名ハ */ + case 0x31F6: /* JIS X 0213 1-06-84 小書き片仮名ヒ */ + case 0x31F7: /* JIS X 0213 1-06-85 小書き片仮名フ */ + case 0x31F8: /* JIS X 0213 1-06-86 小書き片仮名ヘ */ + case 0x31F9: /* JIS X 0213 1-06-87 小書き片仮名ホ */ + case 0x31FA: /* JIS X 0213 1-06-89 小書き片仮名ム */ + case 0x31FB: /* JIS X 0213 1-06-90 小書き片仮名ラ */ + case 0x31FC: /* JIS X 0213 1-06-91 小書き片仮名リ */ + case 0x31FD: /* JIS X 0213 1-06-92 小書き片仮名ル */ + case 0x31FE: /* JIS X 0213 1-06-93 小書き片仮名レ */ + case 0x31FF: /* JIS X 0213 1-06-94 小書き片仮名ロ */ + skip=-(int)(((double)(1000-(cc4-cc2)-kanatume*2)/2/1000.0)*zw); + break; + case 0x30FC: + skip=-(int)((double)(cc-kanatume)/1000.0*zw); + break; + default: + skip=-(int)(((double)(height-cc4-kanatume)/1000.0)*zw); + break; + } + } + else { + skip=-(int)(((double)(cc-kanatume)/1000.0)*zw); + } + if (kanatfm) + cc=4; + else + cc=3; + if (skip) + cc+=numcount(skip)+1; + if (skip2) + cc+=numcount(skip2)+1; + fputnum(cc,4,fp); + break; + } + } + } + else { + skip = -(zw-w)/2; + if (kanatfm) + cc=4; + else + cc=3; + if (skip) + cc+=numcount(skip)+1; + if (skip2) + cc+=numcount(skip2)+1; + fputnum(cc,4,fp); + } + } + else { + if (kanatfm || code>=0x10000) + cc=4; + else + cc=3; + if (skip) + cc+=numcount(skip)+1; + if (skip2) + cc+=numcount(skip2)+1; + fputnum(cc,4,fp); + } + break; + } + + fputnum(code,4,fp); /* char code */ + fputnum(w,4,fp); /* char width */ + if (skip) { + fputc(143+numcount(skip)-1,fp); /* RIGHT */ + fputnum2(skip,fp); + } + if (skip2) { + fputc(157+numcount(skip2)-1,fp); /* DOWN */ + fputnum2(skip2,fp); + } + if (kanatfm) { + if (code <= 0x30F6) + fputc(173+fidshift,fp); /* FONT_NUM_2 */ + else + fputc(172+fidshift,fp); /* FONT_NUM_1 */ + } + if (code>=0x10000) { + fputc(130,fp); /* SET3 */ + fputnum(code,3,fp); /* char code */ + } else { + fputc(129,fp); /* SET2 */ + fputnum(code,2,fp); /* char code */ + } +} + void vfclose(FILE *fp) { int i,cc; |