summaryrefslogtreecommitdiff
path: root/systems/msdos/jemtex2
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /systems/msdos/jemtex2
Initial commit
Diffstat (limited to 'systems/msdos/jemtex2')
-rw-r--r--systems/msdos/jemtex2/fontable.c178
-rw-r--r--systems/msdos/jemtex2/fontable.pas152
-rw-r--r--systems/msdos/jemtex2/jem2tex.c1317
-rw-r--r--systems/msdos/jemtex2/jem2tex.pas1209
-rw-r--r--systems/msdos/jemtex2/jguide.tex3660
-rw-r--r--systems/msdos/jemtex2/jis24bin0 -> 562032 bytes
-rw-r--r--systems/msdos/jemtex2/jis2mf.c996
-rw-r--r--systems/msdos/jemtex2/jis2mf.pas939
8 files changed, 8451 insertions, 0 deletions
diff --git a/systems/msdos/jemtex2/fontable.c b/systems/msdos/jemtex2/fontable.c
new file mode 100644
index 0000000000..6868f6e3b6
--- /dev/null
+++ b/systems/msdos/jemtex2/fontable.c
@@ -0,0 +1,178 @@
+/* -mt -f -A -K -G -O -w */
+/* Compile with Turbo-C 2.0 */
+/*
+ This program generates Japanese font tables
+
+ Author: Francois Jalbert
+ '
+ Date: November 1990
+
+ Version: 1.0
+
+ Date: April 1991
+
+ Version: 2.0
+
+ Modifications: - Added four kanjis.
+ - Run-time parameters now supplied.
+ - Extension is .JEM now.
+ - Page format changed slightly.
+ - Symbols now centered within tables.
+ - Switched to \clearpage since better for tables.
+*/
+
+#include <stdio.h>
+#ifdef __TURBOC__
+#include <process.h>
+#endif
+
+/* Highest Bitmap number in JIS24 */
+#define BitmapMax 7806
+/* Highest font number */
+#define FontMax 60
+/* Number of symbols in a font */
+#define SymbolMax 128
+#define SymbolMax1 127
+
+void FontTable(FILE *OutFile)
+{
+ int Bitmap;
+ int Font;
+ int Symbol;
+ unsigned char EUC1,EUC2;
+
+ fprintf(OutFile,"%%JEM2TEX /NoSpace /NoPercent /LaTeX /EUC /Extended /3.0\n");
+ fprintf(OutFile,"%%\n");
+ fprintf(OutFile,"\\documentstyle[12pt]{article}\n");
+ fprintf(OutFile,"\\pagestyle{plain}\n");
+ fprintf(OutFile,"\\setlength{\\oddsidemargin}{-0.5in} %%0.5in margin left-right\n");
+ fprintf(OutFile,"\\setlength{\\textwidth}{7.5in} %%8.5in-2*0.5in\n");
+ fprintf(OutFile,"\\setlength{\\topmargin}{-0.25in} %%0.75in margin top-bottom\n");
+ fprintf(OutFile,"\\setlength{\\textheight}{9.4in} %%11.0in-2*0.75in\n");
+ fprintf(OutFile,"\\setlength{\\footskip}{0.1in}\n");
+ fprintf(OutFile,"\\setlength{\\footheight}{0.1in}\n");
+ fprintf(OutFile,"\\setlength{\\headheight}{0pt}\n");
+ fprintf(OutFile,"\\setlength{\\headsep}{0pt}\n");
+ fprintf(OutFile,"\\setlength{\\topskip}{0pt}\n");
+ fprintf(OutFile,"\\setlength{\\parindent}{0pt}\n");
+ fprintf(OutFile,"\\setlength{\\tabcolsep}{4pt}\n");
+ fprintf(OutFile,"\\renewcommand{\\baselinestretch}{0.85}\n");
+ fprintf(OutFile,"\\begin{document}\n");
+ fprintf(OutFile,"\\begin{Large}\n");
+ fprintf(OutFile,"\n");
+ fprintf(OutFile,"\\vspace*{\\fill}\n");
+ fprintf(OutFile,"\n");
+ if (ferror(OutFile)) exit(1);
+ for (Bitmap=0 ; Bitmap<=BitmapMax ; Bitmap++) {
+ Symbol=Bitmap % SymbolMax;
+ Font=Bitmap / SymbolMax;
+ EUC1=(unsigned char)((Bitmap-1)/94);
+ EUC2=(unsigned char)((Bitmap-1)-94*(int)EUC1);
+ EUC1=EUC1+(unsigned char)'\xA1';
+ EUC2=EUC2+(unsigned char)'\xA1';
+ if (!Symbol) {
+ fprintf(OutFile,"\\begin{table}[h]\n");
+ fprintf(OutFile," \\centering\n");
+ fprintf(OutFile," \\begin{tabular}{r|cccccccccccccccc|l}\n");
+ fprintf(OutFile,
+ " Code & \\multicolumn{16}{c|}{Characters} & EUC \\\\ \\hline\n");
+ if (ferror(OutFile)) exit(1);
+ }
+ switch (Symbol % 16) {
+ case 0: fprintf(OutFile,"%6d ",Symbol);
+ if (ferror(OutFile)) exit(1);
+ break;
+ case 5: case 10: case 15: fprintf(OutFile," ");
+ if (ferror(OutFile)) exit(1);
+ break;
+ }
+ if (Bitmap) {
+ fprintf(OutFile,"&%c%c",EUC1,EUC2);
+ if (ferror(OutFile)) exit(1);
+ switch (Symbol % 16) {
+ case 4: case 9: case 14: fprintf(OutFile,"\n");
+ if (ferror(OutFile)) exit(1);
+ break;
+ default:if ((Symbol % 16)==15) {
+ fprintf(OutFile,"& %d,%d",EUC1,EUC2);
+ if ( (Symbol!=SymbolMax1) && (Bitmap!=BitmapMax) )
+ fprintf(OutFile," \\\\");
+ fprintf(OutFile,"\n");
+ if (ferror(OutFile)) exit(1);
+ }
+ else
+ if (Bitmap==BitmapMax) {
+ fprintf(OutFile,"\n");
+ if (ferror(OutFile)) exit(1);
+ }
+ break;
+ }
+ }
+ else {
+ fprintf(OutFile,"& ");
+ if (ferror(OutFile)) exit(1);
+ }
+ if ( (Symbol==SymbolMax1) || (Bitmap==BitmapMax) ) {
+ fprintf(OutFile," \\end{tabular}\n");
+ fprintf(OutFile,"\\caption{Font {\\tt kanji%c%c} (%d--%d).}\n",
+ ('a'+(Font/8)),('a'+(Font % 8)),(Bitmap-Symbol),Bitmap);
+ fprintf(OutFile,"\\end{table}\n");
+ fprintf(OutFile,"\n");
+ if (ferror(OutFile)) exit(1);
+ if (Bitmap==BitmapMax) {
+ fprintf(OutFile,"\\vspace*{\\fill}\n");
+ fprintf(OutFile,"\n");
+ if (ferror(OutFile)) exit(1);
+ }
+ else
+ if ((Font % 3)==2) {
+ fprintf(OutFile,"\\vspace*{\\fill}\n");
+ fprintf(OutFile,"\n");
+ fprintf(OutFile,"\\clearpage\n");
+ fprintf(OutFile,"\n");
+ fprintf(OutFile,"\\vspace*{\\fill}\n");
+ fprintf(OutFile,"\n");
+ if (ferror(OutFile)) exit(1);
+ }
+ }
+ }
+ fprintf(OutFile,"\\end{Large}\n");
+ fprintf(OutFile,"\\end{document}\n");
+ if (ferror(OutFile)) exit(1);
+}
+
+main()
+{
+ FILE *OutFile;
+
+ printf("\n");
+ printf("Japanese Font Tables Generation Program.\n");/*To make Borland happy*/
+ printf("Version 2.0 Copyright F. Jalbert 1991.\n");
+ printf("\n");
+ if (ferror(stdout)) exit(1);
+
+ printf("Creating Japanese file fontable.jem");
+ if ((OutFile=fopen("fontable.jem","wt"))==NULL) exit(1);
+ printf(".\n");
+ if (ferror(stdout)) exit(1);
+
+ printf("Generating font tables");
+ #ifndef __TURBOC__
+ printf("\n");
+ #endif
+ FontTable(OutFile);
+ printf(".\n");
+ if (ferror(stdout)) exit(1);
+
+ printf("Closing Japanese file fontable.jem");
+ if (fclose(OutFile)==EOF) exit(1);
+ printf(".\n");
+ printf("\n");
+ if (ferror(stdout)) exit(1);
+
+ printf("Japanese font tables generation completed.\n");
+ printf("\n");
+ if (ferror(stdout)) exit(1);
+
+ return(0);
+}
diff --git a/systems/msdos/jemtex2/fontable.pas b/systems/msdos/jemtex2/fontable.pas
new file mode 100644
index 0000000000..bdfa50c887
--- /dev/null
+++ b/systems/msdos/jemtex2/fontable.pas
@@ -0,0 +1,152 @@
+{$A-,B-,D-,E-,F-,I+,L-,N-,O-,R-,S-,V-}
+{Compile with Turbo-Pascal 5.0}
+Program Fontable(Input,Output);
+{
+ This program generates Japanese font tables
+
+ Author: Francois Jalbert
+ '
+ Date: November 1990
+
+ Version: 1.0
+
+ Date: April 1991
+
+ Version: 2.0
+
+ Modifications: - Added four kanjis.
+ - Run-time parameters now supplied.
+ - Extension is .JEM now.
+ - Page format changed slightly.
+ - Symbols now centered within tables.
+ - Switched to \clearpage since better for tables.
+}
+Const
+ {Highest Bitmap number in JIS24}
+ BitmapMax=7806;
+ {Highest font number}
+ FontMax=60;
+ {Number of symbols in a font}
+ SymbolMax=128;
+ SymbolMax1=127;
+
+Type
+ Bitmap0Range=0..BitmapMax;
+ Font0Range=0..FontMax;
+ Symbol0Range=0..SymbolMax1;
+
+Var OutFile:Text;
+
+Procedure FontTable(Var OutFile:Text);
+Var
+ Bitmap:Bitmap0Range;
+ Font:Font0Range;
+ Symbol:Symbol0Range;
+ EUC1,EUC2:Integer;
+Begin
+Writeln(OutFile,'%JEM2TEX /NoSpace /NoPercent /LaTeX /EUC /Extended /3.0');
+Writeln(OutFile,'%');
+Writeln(OutFile,'\documentstyle[12pt]{article}');
+Writeln(OutFile,'\pagestyle{plain}');
+Writeln(OutFile,'\setlength{\oddsidemargin}{-0.5in} %0.5in margin left-right');
+Writeln(OutFile,'\setlength{\textwidth}{7.5in} %8.5in-2*0.5in');
+Writeln(OutFile,'\setlength{\topmargin}{-0.25in} %0.75in margin top-bottom');
+Writeln(OutFile,'\setlength{\textheight}{9.4in} %11.0in-2*0.75in');
+Writeln(OutFile,'\setlength{\footskip}{0.1in}');
+Writeln(OutFile,'\setlength{\footheight}{0.1in}');
+Writeln(OutFile,'\setlength{\headheight}{0pt}');
+Writeln(OutFile,'\setlength{\headsep}{0pt}');
+Writeln(OutFile,'\setlength{\topskip}{0pt}');
+Writeln(OutFile,'\setlength{\parindent}{0pt}');
+Writeln(OutFile,'\setlength{\tabcolsep}{4pt}');
+Writeln(OutFile,'\renewcommand{\baselinestretch}{0.85}');
+Writeln(OutFile,'\begin{document}');
+Writeln(OutFile,'\begin{Large}');
+Writeln(OutFile);
+Writeln(OutFile,'\vspace*{\fill}');
+Writeln(OutFile);
+For Bitmap:=0 To BitmapMax Do
+ Begin
+ Symbol:=Bitmap Mod SymbolMax;
+ Font:=Bitmap Div SymbolMax;
+ EUC1:=Trunc( (Bitmap-1) Div 94 );
+ EUC2:=(Bitmap-1)-94*EUC1;
+ EUC1:=EUC1+161;
+ EUC2:=EUC2+161;
+ If Symbol=0 Then
+ Begin
+ Writeln(OutFile,'\begin{table}[h]');
+ Writeln(OutFile,' \centering');
+ Writeln(OutFile,' \begin{tabular}{r|cccccccccccccccc|l}');
+ Writeln(OutFile,' Code & \multicolumn{16}{c|}{Characters} & EUC \\ \hline')
+ End;
+ If (Symbol Mod 16)=0 Then Write(OutFile,Symbol:6,' ')
+ Else
+ If (Symbol Mod 16) in [5,10,15] Then Write(OutFile,' ');
+ If Bitmap=0 Then Write(OutFile,'& ')
+ Else
+ Begin
+ Write(OutFile,'&'+Chr(EUC1)+Chr(EUC2));
+ If (Symbol Mod 16) in [4,9,14] Then Writeln(OutFile)
+ Else
+ If (Symbol Mod 16)=15 Then
+ Begin
+ Write(OutFile,'& ',EUC1,',',EUC2);
+ If (Symbol<>SymbolMax1) And (Bitmap<>BitmapMax) Then
+ Write(OutFile,' \\');
+ Writeln(OutFile)
+ End
+ Else
+ If Bitmap=BitmapMax Then Writeln(OutFile)
+ End;
+ If (Symbol=SymbolMax1) Or (Bitmap=BitmapMax) Then
+ Begin
+ Writeln(OutFile,' \end{tabular}');
+ Writeln(OutFile,'\caption{Font {\tt kanji'+Chr(Ord('a')+(Font Div 8))+
+ Chr(Ord('a')+(Font Mod 8))+'} (',(Bitmap-Symbol),'--',Bitmap,').}');
+ Writeln(OutFile,'\end{table}');
+ Writeln(OutFile);
+ If Bitmap=BitmapMax Then
+ Begin
+ Writeln(OutFile,'\vspace*{\fill}');
+ Writeln(OutFile)
+ End
+ Else
+ If (Font Mod 3)=2 Then
+ Begin
+ Writeln(OutFile,'\vspace*{\fill}');
+ Writeln(OutFile);
+ Writeln(OutFile,'\clearpage');
+ Writeln(OutFile);
+ Writeln(OutFile,'\vspace*{\fill}');
+ Writeln(OutFile)
+ End
+ End
+ End;
+Writeln(OutFile,'\end{Large}');
+Writeln(OutFile,'\end{document}')
+End;
+
+Begin
+Writeln;
+Writeln('Japanese Font Tables Generation Program.'); {To make Borland happy}
+Writeln('Version 2.0 Copyright F. Jalbert 1991.');
+Writeln;
+
+Write('Creating Japanese file fontable.jem');
+Assign(OutFile,'fontable.jem');
+Rewrite(OutFile);
+Writeln('.');
+
+Write('Generating font tables');
+FontTable(OutFile);
+Writeln('.');
+
+Write('Closing Japanese file fontable.jem');
+Close(OutFile);
+Writeln('.');
+Writeln;
+
+Writeln('Japanese font tables generation completed.');
+Writeln
+End.
diff --git a/systems/msdos/jemtex2/jem2tex.c b/systems/msdos/jemtex2/jem2tex.c
new file mode 100644
index 0000000000..9bc0dc296f
--- /dev/null
+++ b/systems/msdos/jemtex2/jem2tex.c
@@ -0,0 +1,1317 @@
+/* -mt -f -A -K -G -O -w */
+/* Compile with Turbo-C 2.0 */
+/*
+ This program translates a .JEM file into a .TeX file
+
+ Author: Francois Jalbert
+ '
+ Date: November 1990
+
+ Version: 1.0
+
+ Date: January 1991
+
+ Version: 1.01
+
+ Modifications: - Added \hskip0pt plus0.1em between all Japanese symbols which
+ improved dramatically line breaks and inter-sentence spacing
+ since [La]TeX could only add glue between whole Japanese
+ sentences.
+ - Extra space after punctuation is now an option since it is
+ not desirable with MuTeX when the text is to go under the
+ staff.
+ - Font names now use only small letters to be compatible with
+ the fontlib program supplied with emTeX.
+ - Command line parameters now supported.
+ - Run-time parameters now supported.
+ - Updated and improved run-time messages.
+
+ Date: April 1991
+
+ Version: 2.00
+
+ Modifications: - Added four kanjis.
+ - If desired, only standard JIS '83 characters are allowed.
+ - If desired, a % is added at each Japanese end of line.
+ - Three file name extensions .JEM .JPN .JAP now supported.
+ - Default extension is .JEM and the program has been renamed.
+ - Three run-time parameter flags now supported.
+ - Japanese comments not translated anymore for reference.
+ - Hyphenation and glue handled separately for better control.
+ - More clever algorithm for Japanese hyphenation.
+ - Space after some punctuation now obtained with \eeee.
+ - Small space around some punctuation introduced with \eee.
+ - Tiny space between Japanese characters with \ee.
+ - Space between Japanese and Roman with \eeee and \eee.
+ - Symbols separated only by [La]TeX comments are now
+ recognized as consecutive.
+ - MS-kanji (Shift-JIS) now supported.
+
+ Error Levels: 0 - Normal termination.
+ 1 - Error.
+*/
+
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#ifdef __TURBOC__
+#include <process.h>
+#endif
+
+#define True 1
+#define False 0
+/* Highest Bitmap number in JIS24 */
+#define BitmapMax 7806
+/* Highest font number */
+#define FontMax 60 /* Floor of 7806 Div 128 */
+/* Highest size number */
+#define SizeMax 7 /* magsteps are 0, 0.5, 1, 2, 3, 4, 5 */
+/* DOS file name length */
+#define FileNameDOS 250 /* includes path */
+#define ExtensionDOS 4 /* includes . */
+#define TotalNameDOS 254
+/* File name extensions in priority order */
+char Extension1[]=".jem";
+char Extension2[]=".jpn";
+char Extension3[]=".jap";
+/* Run-time flag of all the same length */
+char RunFlag1[]="JEM2TEX";
+char RunFlag2[]="JPN2TEX";
+char RunFlag3[]="JAP2TEX";
+/* Parameter flag */
+#define Flag1 '/' /* DOS style */
+#define Flag2 '-' /* UNIX style */
+/* Parameter keywords in approximate decreasing length order */
+#define ParamMax 12
+char Space1[]="EXTRASPACE";
+char Space2[]="EXTRA";
+char Space3[]="SPACE";
+char NoSpace1[]="NOEXTRASPACE";
+char NoSpace2[]="NOEXTRA";
+char NoSpace3[]="NOSPACE";
+char Percent1[]="COMMENT";
+char Percent2[]="PERCENT";
+char Percent3[]="EOL";
+char NoPercent1[]="NOCOMMENT";
+char NoPercent2[]="NOPERCENT";
+char NoPercent3[]="NOEOL";
+char EUC1[]="EUC";
+char NoEUC1[]="MSKANJI";
+char NoEUC2[]="SHIFTJIS";
+char Extended1[]="EXTENDED";
+char Standard1[]="STANDARD";
+char LaTeX1[]="LATEX";
+char TeX1[]="MUTEX";
+char TeX2[]="TEX";
+char One1[]="1000";
+char Two1[]="1095";
+char Three1[]="1200";
+char Four1[]="1440";
+char Five1[]="1728";
+char Six1[]="2074";
+char Seven1[]="2488";
+char One2[]="0.0";
+char Two2[]="0.5";
+char Three2[]="1.0";
+char Four2[]="2.0";
+char Five2[]="3.0";
+char Six2[]="4.0";
+char Seven2[]="5.0";
+char One3[]="0";
+char Three3[]="1";
+char Four3[]="2";
+char Five3[]="3";
+char Six3[]="4";
+char Seven3[]="5";
+/* Comment line maximum length */
+#define CommentLineMax 254
+
+typedef char FileNameType[FileNameDOS+1];
+typedef char ExtensionType[ExtensionDOS+1];
+typedef char TotalNameType[TotalNameDOS+1];
+typedef char ParamType[ParamMax+1];
+typedef int FontType[FontMax+1];
+typedef FontType FontsType[SizeMax+1];
+typedef char CommentLineType[CommentLineMax+2]; /* note the 2 used */
+/* Run time parameters */
+struct RunTimeType {
+ FileNameType FileName;
+ ExtensionType Extension;
+ int ExtraSpace,Percent,LaTeX,EUC,Extended;
+ int Size;
+};
+/* Japanese punctuation information */
+struct PunctuationType {
+ /* Indicates .,!? present */
+ int OldMajorEOL,NewMajorEOL;
+ /* Indicates :; present */
+ int OldMinorEOL,NewMinorEOL;
+ /* Indicates `"([< and other openings present */
+ int OldOpening,NewOpening;
+ /* Indicates '")]> and other closings present */
+ int OldClosing,NewClosing;
+ /* Indicates Japanese center dot present */
+ int OldCenterDot,NewCenterDot;
+ /* Indicates Hiragana, Katakana, or Kanji present */
+ int OldJapanese,NewJapanese;
+};
+/* Scanning Information */
+struct ScanningType {
+ /* Current pass terminated */
+ int Done;
+ /* Indicates the current pass must produce output */
+ int Echo;
+ /* Indicates the current line is a comment */
+ int Comment;
+ /* Indicates current Bitmap immediately followed previous one */
+ int Immediate;
+ /* Indicates the last Roman character was a letter or digit */
+ int WasLetter;
+ /* Used for glue after a bitmap and before a roman */
+ int RomanMajorEOL,RomanMinorEOL,RomanOpening;
+ /* Non-comment Bitmap found */
+ int Found;
+ /* Processing the first character on the line which could be % */
+ int First;
+ /* Comment line which may contain Bitmaps */
+ CommentLineType CommentLine;
+ /* Current JIS24 Bitmap number */
+ int Bitmap;
+ /* Roman or first part of Bitmap read */
+ unsigned char Data1;
+};
+
+void Delete(char *String, int Length)
+/* Delete the first Length characters of String */
+{
+ int Index;
+
+ Index=0;
+ do String[Index]=String[Index+Length];
+ while (String[++Index]!='\0');
+}
+
+/*----------------------------- EchoParameters ------------------------------*/
+
+void EchoParameters(FILE *EchoFile, struct RunTimeType *RunTime)
+/* Echoes the current parameters in EchoFile */
+{
+ fprintf(EchoFile,"File=%s",RunTime->FileName);
+ if (RunTime->ExtraSpace) fprintf(EchoFile," Space");
+ else fprintf(EchoFile," No Space");
+ if (RunTime->Percent) fprintf(EchoFile," Added %%");
+ else fprintf(EchoFile," No Added %%");
+ if (RunTime->LaTeX) fprintf(EchoFile," LaTeX");
+ else fprintf(EchoFile," TeX");
+ if (RunTime->EUC) fprintf(EchoFile," EUC");
+ else fprintf(EchoFile," MS-kanji");
+ if (RunTime->Extended) fprintf(EchoFile," Extended");
+ else fprintf(EchoFile," Standard");
+ fprintf(EchoFile," Font Size=");
+ switch (RunTime->Size) {
+ case 1:fprintf(EchoFile,"1000"); break;
+ case 2:fprintf(EchoFile,"1095"); break;
+ case 3:fprintf(EchoFile,"1200"); break;
+ case 4:fprintf(EchoFile,"1440"); break;
+ case 5:fprintf(EchoFile,"1728"); break;
+ case 6:fprintf(EchoFile,"2074"); break;
+ case 7:fprintf(EchoFile,"2488"); break;
+ }
+ fprintf(EchoFile,".\n");
+ if (ferror(EchoFile)) exit(1);
+}
+
+/*------------------------------ GetParameters ------------------------------*/
+
+void SimpleQuery(char Title[], char ChoiceA[], char ChoiceB[], int *Answer)
+{
+ char JChar[2];
+ int Valid;
+
+ do {
+ Valid=True;
+ printf("%s:\n",Title);
+ printf(" a) %s\n",ChoiceA);
+ printf(" b) %s\n",ChoiceB);
+ printf("Your choice? ");
+ if (ferror(stdout)) exit(1);
+ if (gets(JChar)==NULL) exit(1);
+ if (strlen(JChar)>1) exit(1);
+ JChar[0]=toupper(JChar[0]);
+ if (JChar[0]=='A') *Answer=True;
+ else
+ if (JChar[0]=='B') *Answer=False;
+ else {
+ Valid=False;
+ if (putchar('\7')==EOF) exit(1);
+ }
+ } while (!Valid);
+ printf("\n");
+ if (ferror(stdout)) exit(1);
+}
+
+void SizeQuery(int *Size)
+{
+ char JChar[2];
+ int Valid;
+
+ do {
+ Valid=True;
+ printf("Japanese Font Size:\n");
+ printf(" a) 1000 magstep(0.0)\n");
+ printf(" b) 1095 magstep(0.5)\n");
+ printf(" c) 1200 magstep(1.0)\n");
+ printf(" d) 1440 magstep(2.0)\n");
+ printf(" e) 1728 magstep(3.0)\n");
+ printf(" f) 2074 magstep(4.5)\n");
+ printf(" g) 2488 magstep(5.0)\n");
+ printf("Your choice? ");
+ if (ferror(stdout)) exit(1);
+ if (gets(JChar)==NULL) exit(1);
+ if (strlen(JChar)>1) exit(1);
+ JChar[0]=toupper(JChar[0]);
+ if (('A'<=JChar[0]) && (JChar[0]<='G')) *Size=JChar[0]-'A'+1;
+ else {
+ Valid=False;
+ if (putchar('\7')==EOF) exit(1);
+ }
+ } while (!Valid);
+ printf("\n");
+ if (ferror(stdout)) exit(1);
+}
+
+void Manual(struct RunTimeType *RunTime)
+/* Get parameters from user */
+{
+ printf("Japanese file name? ");
+ if (ferror(stdout)) exit(1);
+ if (gets(RunTime->FileName)==NULL) exit(1);
+ if (strlen(RunTime->FileName)>FileNameDOS) {
+ /* File name too long */
+ printf("\7File name too long: %s...",RunTime->FileName);
+ exit(1);
+ }
+ printf("\n");
+ if (ferror(stdout)) exit(1);
+ SimpleQuery("Space around Japanese punctuation","Space","No space",
+ &RunTime->ExtraSpace);
+ SimpleQuery("Added % at Japanese end of lines","Added %","No added %",
+ &RunTime->Percent);
+ SimpleQuery("LaTeX or TeX (MuTeX) output","LaTeX","TeX",&RunTime->LaTeX);
+ SimpleQuery("EUC or MS-kanji (Shift-JIS) encoding","EUC","MS-kanji",
+ &RunTime->EUC);
+ SimpleQuery("Extended JIS '83 Bitmaps allowed","Extended","Standard",
+ &RunTime->Extended);
+ SizeQuery(&RunTime->Size);
+}
+
+void Automate(struct RunTimeType *RunTime, int argc, char *argv[])
+/* Get parameters from command line */
+{
+ int ParamIndex,ParamLength,Index;
+ ParamType Param;
+
+ /* Defaults */
+ strcpy(RunTime->FileName,"japanese");
+ RunTime->ExtraSpace=True;
+ RunTime->Percent=True;
+ RunTime->LaTeX=True;
+ RunTime->EUC=True;
+ RunTime->Extended=True;
+ RunTime->Size=4;
+ /* Scan command line parameters */
+ /* 0th is program's name, last is NULL */
+ for (ParamIndex=1 ; ParamIndex<argc ; ParamIndex++) {
+ ParamLength=strlen(argv[ParamIndex]);
+ if (ParamLength>ParamMax) {
+ /* Keyword too long */
+ printf("\7Invalid command line parameter: %s...",argv[ParamIndex]);
+ exit(1);
+ }
+ strcpy(Param,argv[ParamIndex]);
+ if ((Param[0]==Flag1) || (Param[0]==Flag2)) {
+ /* Not a filename */
+ /* Delete 1 char at the 1st position */
+ Delete(Param,1);
+ /* Convert to upper case */
+ for (Index=0 ; Index<ParamLength ; Index++)
+ Param[Index]=toupper(Param[Index]);
+ /* Scan known keywords */
+ if ( (!strcmp(Param,Space1)) || (!strcmp(Param,Space2)) ||
+ (!strcmp(Param,Space3)) ) RunTime->ExtraSpace=True;
+ else
+ if ( (!strcmp(Param,NoSpace1)) || (!strcmp(Param,NoSpace2)) ||
+ (!strcmp(Param,NoSpace3)) ) RunTime->ExtraSpace=False;
+ else
+ if ( (!strcmp(Param,Percent1)) || (!strcmp(Param,Percent2)) ||
+ (!strcmp(Param,Percent3)) ) RunTime->Percent=True;
+ else
+ if ( (!strcmp(Param,NoPercent1)) || (!strcmp(Param,NoPercent2)) ||
+ (!strcmp(Param,NoPercent3)) ) RunTime->Percent=False;
+ else
+ if (!strcmp(Param,EUC1)) RunTime->EUC=True;
+ else
+ if ((!strcmp(Param,NoEUC1))||(!strcmp(Param,NoEUC2))) RunTime->EUC=False;
+ else
+ if (!strcmp(Param,Extended1)) RunTime->Extended=True;
+ else
+ if (!strcmp(Param,Standard1)) RunTime->Extended=False;
+ else
+ if (!strcmp(Param,LaTeX1)) RunTime->LaTeX=True;
+ else
+ if ((!strcmp(Param,TeX1)) || (!strcmp(Param,TeX2))) RunTime->LaTeX=False;
+ else
+ if ( (!strcmp(Param,One1)) || (!strcmp(Param,One2)) ||
+ (!strcmp(Param,One3)) ) RunTime->Size=1;
+ else
+ if ( (!strcmp(Param,Two1)) || (!strcmp(Param,Two2)) ) RunTime->Size=2;
+ else
+ if ( (!strcmp(Param,Three1)) || (!strcmp(Param,Three2)) ||
+ (!strcmp(Param,Three3)) ) RunTime->Size=3;
+ else
+ if ( (!strcmp(Param,Four1)) || (!strcmp(Param,Four2)) ||
+ (!strcmp(Param,Four3)) ) RunTime->Size=4;
+ else
+ if ( (!strcmp(Param,Five1)) || (!strcmp(Param,Five2)) ||
+ (!strcmp(Param,Five3)) ) RunTime->Size=5;
+ else
+ if ( (!strcmp(Param,Six1)) || (!strcmp(Param,Six2)) ||
+ (!strcmp(Param,Six3)) ) RunTime->Size=6;
+ else
+ if ( (!strcmp(Param,Seven1)) || (!strcmp(Param,Seven2)) ||
+ (!strcmp(Param,Seven3)) ) RunTime->Size=7;
+ else {
+ /* Unknown keyword */
+ printf("\7Invalid command line parameter: %s...\n",Param);
+ exit(1);
+ }
+ }
+ else {
+ /* Must be a filename, we'll try to open it later */
+ if (ParamLength>FileNameDOS) {
+ /* File name too long */
+ printf("\7File name too long: %s...\n",Param);
+ exit(1);
+ }
+ strcpy(RunTime->FileName,Param);
+ }
+ }
+}
+
+void GetParameters(struct RunTimeType *RunTime, int argc, char *argv[])
+/* Get parameters from user or command line */
+/* Current parameter status is echoed on the console */
+{
+ /* 0th is program's name, last is NULL */
+ if (argc==1) Manual(RunTime);
+ else Automate(RunTime,argc,argv);
+ EchoParameters(stdout,RunTime);
+}
+
+/*------------------------------- OpenFile ----------------------------------*/
+
+int TryExtension(FILE *(*InFile), struct RunTimeType *RunTime,
+ ExtensionType TriedExtension)
+/* Tries to open FileName using TriedExtension */
+{
+ TotalNameType TotalName;
+
+ strcpy(RunTime->Extension,TriedExtension);
+ strcpy(TotalName,RunTime->FileName);
+ strcat(TotalName,TriedExtension);
+ *InFile=fopen(TotalName,"rt");
+ return(*InFile!=NULL);
+}
+
+void OpenFile(FILE *(*InFile), struct RunTimeType *RunTime)
+/* Tries to open FileName using all available extensions */
+{
+ if (TryExtension(InFile,RunTime,Extension1)) printf("%s",Extension1);
+ else
+ if (TryExtension(InFile,RunTime,Extension2)) printf("%s",Extension2);
+ else
+ if (TryExtension(InFile,RunTime,Extension3)) printf("%s",Extension3);
+ else {
+ printf(".\n");
+ printf("\7File not found...\n");
+ exit(1);
+ }
+}
+
+/*------------------------------- GetBitmap ---------------------------------*/
+
+void PerformScan(CommentLineType CommentLine, struct RunTimeType *RunTime,
+ int Echo, FILE *OutFile)
+/* Scans the comment line for run-time JEM2TEX parameters */
+/* Any Bitmap or unknown parameter stops the scan */
+/* Current parameter status is echoed in the .TeX file as a [La]TeX comment */
+{
+ int Index;
+
+ /* Delete 1 char at the 1st position which is % */
+ Delete(CommentLine,1);
+ /* Convert to upper case */
+ for (Index=0 ; Index<strlen(CommentLine) ; Index++)
+ CommentLine[Index]=toupper(CommentLine[Index]);
+ /* Add space at the line end to characterize premature termination */
+ /* Add sentinel at the line end to stop forthcoming loops */
+ strcat(CommentLine," %");
+ /* Delete leading blanks */
+ if (CommentLine[0]==' ')
+ do Delete(CommentLine,1);
+ while (CommentLine[0]==' ');
+ /* Look for run-time flag at the start of line */
+ if ( !strncmp(RunFlag1,CommentLine,strlen(RunFlag1)) ||
+ !strncmp(RunFlag2,CommentLine,strlen(RunFlag1)) ||
+ !strncmp(RunFlag3,CommentLine,strlen(RunFlag1)) ) {
+ /* Remove run-time flag */
+ Delete(CommentLine,strlen(RunFlag1));
+ /* Scan until sentinel reached */
+ do {
+ /* Delete leading blanks (inefficient) */
+ if (CommentLine[0]==' ')
+ do Delete(CommentLine,1);
+ while (CommentLine[0]==' ');
+ if ((CommentLine[0]==Flag1) || (CommentLine[0]==Flag2)) {
+ /* Valid run-time parameter flag */
+ /* Delete 1 char at the 1st position which is flag */
+ Delete(CommentLine,1);
+ /* Scan in decreasing length order */
+ if (!strncmp(Space1,CommentLine,strlen(Space1)))
+ { Delete(CommentLine,strlen(Space1)); RunTime->ExtraSpace=True; }
+ else
+ if (!strncmp(Space2,CommentLine,strlen(Space2)))
+ { Delete(CommentLine,strlen(Space2)); RunTime->ExtraSpace=True; }
+ else
+ if (!strncmp(Space3,CommentLine,strlen(Space3)))
+ { Delete(CommentLine,strlen(Space3)); RunTime->ExtraSpace=True; }
+ else
+ if (!strncmp(NoSpace1,CommentLine,strlen(NoSpace1)))
+ { Delete(CommentLine,strlen(NoSpace1)); RunTime->ExtraSpace=False; }
+ else
+ if (!strncmp(NoSpace2,CommentLine,strlen(NoSpace2)))
+ { Delete(CommentLine,strlen(NoSpace2)); RunTime->ExtraSpace=False; }
+ else
+ if (!strncmp(NoSpace3,CommentLine,strlen(NoSpace3)))
+ { Delete(CommentLine,strlen(NoSpace3)); RunTime->ExtraSpace=False; }
+ else
+ if (!strncmp(Percent1,CommentLine,strlen(Percent1)))
+ { Delete(CommentLine,strlen(Percent1)); RunTime->Percent=True; }
+ else
+ if (!strncmp(Percent2,CommentLine,strlen(Percent2)))
+ { Delete(CommentLine,strlen(Percent2)); RunTime->Percent=True; }
+ else
+ if (!strncmp(Percent3,CommentLine,strlen(Percent3)))
+ { Delete(CommentLine,strlen(Percent3)); RunTime->Percent=True; }
+ else
+ if (!strncmp(NoPercent1,CommentLine,strlen(NoPercent1)))
+ { Delete(CommentLine,strlen(NoPercent1)); RunTime->Percent=False; }
+ else
+ if (!strncmp(NoPercent2,CommentLine,strlen(NoPercent2)))
+ { Delete(CommentLine,strlen(NoPercent2)); RunTime->Percent=False; }
+ else
+ if (!strncmp(NoPercent3,CommentLine,strlen(NoPercent3)))
+ { Delete(CommentLine,strlen(NoPercent3)); RunTime->Percent=False; }
+ else
+ if (!strncmp(EUC1,CommentLine,strlen(EUC1)))
+ { Delete(CommentLine,strlen(EUC1)); RunTime->EUC=True; }
+ else
+ if (!strncmp(NoEUC1,CommentLine,strlen(NoEUC1)))
+ { Delete(CommentLine,strlen(NoEUC1)); RunTime->EUC=False; }
+ else
+ if (!strncmp(NoEUC2,CommentLine,strlen(NoEUC2)))
+ { Delete(CommentLine,strlen(NoEUC2)); RunTime->EUC=False; }
+ else
+ if (!strncmp(Extended1,CommentLine,strlen(Extended1)))
+ { Delete(CommentLine,strlen(Extended1)); RunTime->Extended=True; }
+ else
+ if (!strncmp(Standard1,CommentLine,strlen(Standard1)))
+ { Delete(CommentLine,strlen(Standard1)); RunTime->Extended=False; }
+ else
+ if (!strncmp(LaTeX1,CommentLine,strlen(LaTeX1)))
+ { Delete(CommentLine,strlen(LaTeX1)); RunTime->LaTeX=True; }
+ else
+ if (!strncmp(TeX1,CommentLine,strlen(TeX1)))
+ { Delete(CommentLine,strlen(TeX1)); RunTime->LaTeX=False; }
+ else
+ if (!strncmp(TeX2,CommentLine,strlen(TeX2)))
+ { Delete(CommentLine,strlen(TeX2)); RunTime->LaTeX=False; }
+ else
+ if (!strncmp(One1,CommentLine,strlen(One1)))
+ { Delete(CommentLine,strlen(One1)); RunTime->Size=1; }
+ else
+ if (!strncmp(Two1,CommentLine,strlen(Two1)))
+ { Delete(CommentLine,strlen(Two1)); RunTime->Size=2; }
+ else
+ if (!strncmp(Three1,CommentLine,strlen(Three1)))
+ { Delete(CommentLine,strlen(Three1)); RunTime->Size=3; }
+ else
+ if (!strncmp(Four1,CommentLine,strlen(Four1)))
+ { Delete(CommentLine,strlen(Four1)); RunTime->Size=4; }
+ else
+ if (!strncmp(Five1,CommentLine,strlen(Five1)))
+ { Delete(CommentLine,strlen(Five1)); RunTime->Size=5; }
+ else
+ if (!strncmp(Six1,CommentLine,strlen(Six1)))
+ { Delete(CommentLine,strlen(Six1)); RunTime->Size=6; }
+ else
+ if (!strncmp(Seven1,CommentLine,strlen(Seven1)))
+ { Delete(CommentLine,strlen(Seven1)); RunTime->Size=7; }
+ else
+ if (!strncmp(One2,CommentLine,strlen(One2)))
+ { Delete(CommentLine,strlen(One2)); RunTime->Size=1; }
+ else
+ if (!strncmp(Two2,CommentLine,strlen(Two2)))
+ { Delete(CommentLine,strlen(Two2)); RunTime->Size=2; }
+ else
+ if (!strncmp(Three2,CommentLine,strlen(Three2)))
+ { Delete(CommentLine,strlen(Three2)); RunTime->Size=3; }
+ else
+ if (!strncmp(Four2,CommentLine,strlen(Four2)))
+ { Delete(CommentLine,strlen(Four2)); RunTime->Size=4; }
+ else
+ if (!strncmp(Five2,CommentLine,strlen(Five2)))
+ { Delete(CommentLine,strlen(Five2)); RunTime->Size=5; }
+ else
+ if (!strncmp(Six2,CommentLine,strlen(Six2)))
+ { Delete(CommentLine,strlen(Six2)); RunTime->Size=6; }
+ else
+ if (!strncmp(Seven2,CommentLine,strlen(Seven2)))
+ { Delete(CommentLine,strlen(Seven2)); RunTime->Size=7; }
+ else
+ if (!strncmp(One3,CommentLine,strlen(One3)))
+ { Delete(CommentLine,strlen(One3)); RunTime->Size=1; }
+ else
+ if (!strncmp(Three3,CommentLine,strlen(Three3)))
+ { Delete(CommentLine,strlen(Three3)); RunTime->Size=3; }
+ else
+ if (!strncmp(Four3,CommentLine,strlen(Four3)))
+ { Delete(CommentLine,strlen(Four3)); RunTime->Size=4; }
+ else
+ if (!strncmp(Five3,CommentLine,strlen(Five3)))
+ { Delete(CommentLine,strlen(Five3)); RunTime->Size=5; }
+ else
+ if (!strncmp(Six3,CommentLine,strlen(Six3)))
+ { Delete(CommentLine,strlen(Six3)); RunTime->Size=6; }
+ else
+ if (!strncmp(Seven3,CommentLine,strlen(Seven3)))
+ { Delete(CommentLine,strlen(Seven3)); RunTime->Size=7; }
+ else
+ /* Unknown run-time parameter */
+ /* Terminate prematurely current scan */
+ strcpy(CommentLine,"%");
+ /* Echo status if allowed */
+ if ( Echo && strcmp(CommentLine,"%") ) {
+ fprintf(OutFile,"%");
+ if (ferror(OutFile)) exit(1);
+ EchoParameters(OutFile,RunTime);
+ }
+ }
+ else
+ /* Unknown run-time parameter flag */
+ /* Terminate prematurely current scan */
+ strcpy(CommentLine,"%");
+ } while (strlen(CommentLine)!=1);
+ }
+}
+
+void LineBreak(FILE *OutFile, int ExtraSpace, struct ScanningType *Scanning)
+/* The continuous chain of Bitmaps has just been interrupted by a line break */
+/* We know the next Roman character is equivalent to space, i.e. not a letter */
+/* A \eeee may be inserted if the previous Bitmap was a .,!? */
+/* A \eee may be inserted if the previous Bitmap was a :; center dot )]'" */
+/* If glue inserted make sure to leave a totally blank line as present before */
+{
+ Scanning->Immediate=False;
+ if (Scanning->Echo && ExtraSpace)
+ if (Scanning->RomanMajorEOL) {
+ fprintf(OutFile,"\\eeee\n");
+ if (ferror(OutFile)) exit(1);
+ }
+ else
+ if (Scanning->RomanMinorEOL) {
+ fprintf(OutFile,"\\eee\n");
+ if (ferror(OutFile)) exit(1);
+ }
+}
+
+void RomanBreak(FILE *OutFile, int ExtraSpace, struct ScanningType *Scanning)
+/* The continuous chain of Bitmaps has just been interrupted by a Roman */
+/* The next Roman character may be a letter so a \eee is possible */
+/* A \eeee may be inserted if the previous Bitmap was a .,!? */
+/* A \eee may be inserted if the previous Bitmap was a :; center dot )]'" */
+/* Curly brackets are used in \eee and \eeee when the next Roman is a letter */
+{
+ Scanning->Immediate=False;
+ if (Scanning->Echo && ExtraSpace)
+ if (Scanning->RomanMajorEOL) {
+ if (Scanning->WasLetter) fprintf(OutFile,"\\eeee{}");
+ else fprintf(OutFile,"\\eeee");
+ if (ferror(OutFile)) exit(1);
+ }
+ else
+ if (Scanning->RomanMinorEOL) {
+ if (Scanning->WasLetter) fprintf(OutFile,"\\eee{}");
+ else fprintf(OutFile,"\\eee");
+ if (ferror(OutFile)) exit(1);
+ }
+ else
+ if (Scanning->WasLetter && !Scanning->RomanOpening) {
+ fprintf(OutFile,"\\eee{}");
+ if (ferror(OutFile)) exit(1);
+ }
+}
+
+void GotUNIX(FILE *OutFile, struct ScanningType *Scanning,
+ struct RunTimeType *RunTime)
+/* Handles UNIX EOL */
+/* May add glue after the previous Bitmap and before this Roman */
+{
+ if (Scanning->Immediate)
+ if (Scanning->First)
+ LineBreak(OutFile,RunTime->ExtraSpace,Scanning);
+ else
+ if (!Scanning->Comment)
+ if (RunTime->Percent)
+ if (Scanning->Echo) {
+ fprintf(OutFile,"%");
+ if (ferror(OutFile)) exit(1);
+ }
+ else ;
+ else
+ LineBreak(OutFile,RunTime->ExtraSpace,Scanning);
+ if (Scanning->Echo) {
+ fprintf(OutFile,"\n");
+ if (ferror(OutFile)) exit(1);
+ }
+ if (Scanning->Comment)
+ if (!Scanning->First)
+ PerformScan(Scanning->CommentLine,RunTime,Scanning->Echo,OutFile);
+ else ;
+ else
+ Scanning->WasLetter=False;
+ Scanning->First=True;
+ Scanning->Comment=True;
+ strcpy(Scanning->CommentLine,"");
+}
+
+void GotDOS(FILE *OutFile, struct ScanningType *Scanning,
+ struct RunTimeType *RunTime, FILE *InFile)
+/* Handles DOS EOL */
+/* May add glue after the previous Bitmap and before this Roman */
+/* An error only stops the current pass to help the user determine its cause */
+{
+ unsigned char Data2;
+
+ GotUNIX(OutFile,Scanning,RunTime);
+ /* Line Feed must follow immediately */
+ fscanf(InFile,"%c",&Data2);
+ if (ferror(InFile)) exit(1);
+ if (feof(InFile)) {
+ clearerr(InFile);
+ Scanning->Done=True;
+ }
+ else
+ if (Data2!=(unsigned char)'\xA') Scanning->Done=True;
+ if (Scanning->Done) {
+ printf(".\n");
+ printf("\7Abnormal DOS end of line..");
+ if (ferror(stdout)) exit(1);
+ }
+}
+
+void ValidateBitmap(int Bitmap)
+/* Prints a warning when an extended or an empty Bitmap is used */
+{
+ int Invalid;
+
+ Invalid=False;
+ if ((109<=Bitmap) && (Bitmap<=119) ) Invalid=True;
+ else
+ if ((128<=Bitmap) && (Bitmap<=135) ) Invalid=True;
+ else
+ if ((143<=Bitmap) && (Bitmap<=153) ) Invalid=True;
+ else
+ if ((169<=Bitmap) && (Bitmap<=175) ) Invalid=True;
+ else
+ if ((184<=Bitmap) && (Bitmap<=203) ) Invalid=True;
+ else
+ if ((214<=Bitmap) && (Bitmap<=220) ) Invalid=True;
+ else
+ if ((247<=Bitmap) && (Bitmap<=252) ) Invalid=True;
+ else
+ if ((279<=Bitmap) && (Bitmap<=282) ) Invalid=True;
+ else
+ if (Bitmap==366) Invalid=True;
+ else
+ if ((463<=Bitmap) && (Bitmap<=470) ) Invalid=True;
+ else
+ if ((495<=Bitmap) && (Bitmap<=502) ) Invalid=True;
+ else
+ if ((527<=Bitmap) && (Bitmap<=564) ) Invalid=True;
+ else
+ if ((598<=Bitmap) && (Bitmap<=612) ) Invalid=True;
+ else
+ if ((646<=Bitmap) && (Bitmap<=658) ) Invalid=True;
+ else
+ if ((691<=Bitmap) && (Bitmap<=1410) ) Invalid=True;
+ else
+ if ((4376<=Bitmap) && (Bitmap<=4418) ) Invalid=True;
+ if (Invalid) {
+ printf(".\n");
+ printf("Warning! The non-standard JIS '83 Bitmap %d encountered",Bitmap);
+ if (ferror(stdout)) exit(1);
+ }
+}
+
+void GotBitmap(FILE *OutFile, int EUC, int Extended, FILE *InFile,
+ struct ScanningType *Scanning)
+/* Handles Bitmap */
+/* An error only stops the current pass to help the user determine its cause */
+/* If desired, non-standard Bitmaps are pointed out in the first pass */
+{
+ unsigned char Data2;
+ int CommentLength;
+
+ if (Scanning->First) {
+ /* First character on line */
+ Scanning->First=False;
+ Scanning->Comment=False;
+ }
+ fscanf(InFile,"%c",&Data2);
+ if (ferror(InFile)) exit(1);
+ if (feof(InFile)) {
+ clearerr(InFile);
+ Scanning->Done=True;
+ printf(".\n");
+ if (EUC) printf("\7Incomplete EUC character pair..");
+ else printf("\7Incomplete MS-kanji character pair..");
+ if (ferror(stdout)) exit(1);
+ }
+ else {
+ if (EUC)
+ if (((unsigned char)'\xA0'<Data2) && (Data2<(unsigned char)'\xFF'))
+ Scanning->Bitmap=94*(int)(Scanning->Data1-(unsigned char)'\xA1')+
+ (int)(Data2-(unsigned char)'\xA1')+1;
+ else {
+ Scanning->Done=True;
+ printf(".\n");
+ printf("\7Invalid EUC character pair..");
+ if (ferror(stdout)) exit(1);
+ }
+ else
+ if ((((unsigned char)'\x40'<=Data2) && (Data2<=(unsigned char)'\x7E')) ||
+ (((unsigned char)'\x80'<=Data2) && (Data2<=(unsigned char)'\xFC'))) {
+ if (Scanning->Data1>=(unsigned char)'\xE0')
+ Scanning->Bitmap=1+188*(int)(Scanning->Data1-(unsigned char)'\xC1');
+ else
+ Scanning->Bitmap=1+188*(int)(Scanning->Data1-(unsigned char)'\x81');
+ if (Data2>=(unsigned char)'\x80')
+ Scanning->Bitmap+=(int)(Data2-(unsigned char)'\x41');
+ else
+ Scanning->Bitmap+=(int)(Data2-(unsigned char)'\x40');
+ }
+ else {
+ Scanning->Done=True;
+ printf(".\n");
+ printf("\7Invalid MS-kanji character pair..");
+ if (ferror(stdout)) exit(1);
+ }
+ if (!Scanning->Done)
+ /* Bitmaps in comment skipped */
+ if (Scanning->Comment) {
+ CommentLength=strlen(Scanning->CommentLine);
+ if ((CommentLength+1)>=CommentLineMax) {
+ /* Comment too long */
+ printf(".\n");
+ printf("\7Comment too long: %s...\n",Scanning->CommentLine);
+ exit(1);
+ }
+ Scanning->CommentLine[CommentLength]=(char)Scanning->Data1;
+ Scanning->CommentLine[CommentLength+1]=(char)Data2;
+ Scanning->CommentLine[CommentLength+2]=(char)'\0';
+ if (Scanning->Echo) {
+ fprintf(OutFile,"%c%c",Scanning->Data1,Data2);
+ if (ferror(OutFile)) exit(1);
+ }
+ }
+ else
+ if ( (1<=Scanning->Bitmap) && (Scanning->Bitmap<=BitmapMax) ) {
+ Scanning->Found=True;
+ /* Point out non-standard Bitmaps in first pass */
+ if (!Scanning->Echo && !Extended) ValidateBitmap(Scanning->Bitmap);
+ }
+ else {
+ Scanning->Done=True;
+ printf(".\n");
+ printf("\7Bitmap %d does not exist..",Scanning->Bitmap);
+ if (ferror(stdout)) exit(1);
+ }
+ }
+}
+
+void GotRoman(FILE *OutFile, int ExtraSpace,struct ScanningType *Scanning)
+/* Handles roman */
+/* May add glue after the previous Bitmap and before this Roman */
+{
+ int CommentLength;
+
+ if (Scanning->First) {
+ /* First character on line */
+ Scanning->First=False;
+ if (Scanning->Data1!=(unsigned char)'%') Scanning->Comment=False;
+ }
+ if (Scanning->Comment) {
+ CommentLength=strlen(Scanning->CommentLine);
+ if (CommentLength==CommentLineMax) {
+ /* Comment too long */
+ printf(".\n");
+ printf("\7Comment too long: %s...\n",Scanning->CommentLine);
+ exit(1);
+ }
+ Scanning->CommentLine[CommentLength]=(char)Scanning->Data1;
+ Scanning->CommentLine[CommentLength+1]=(char)'\0';
+ }
+ else {
+ /* Determine if this roman is a letter or a number */
+ Scanning->WasLetter=isalnum(Scanning->Data1);
+ if (Scanning->Immediate) RomanBreak(OutFile,ExtraSpace,Scanning);
+ }
+ if (Scanning->Echo) {
+ fprintf(OutFile,"%c",Scanning->Data1);
+ if (ferror(OutFile)) exit(1);
+ }
+}
+
+void GetBitmap(FILE *InFile, FILE *OutFile, struct ScanningType *Scanning,
+ struct RunTimeType *RunTime)
+/* Scans input file and stops when a Bitmap is met */
+/* An error only stops the current pass to help the user determine its cause */
+/* Accepts UNIX LF or DOS CR/LF as end of line indicator in input file */
+/* Updates JemTeX parameters with run-time parameters */
+/* Comment indicates the line is a comment line and does not break continuity */
+/* Immediate indicates current Bitmap immediately followed previous Bitmap */
+/* If the next character encountered is Roman, glue may be inserted */
+/* If desired, will add % at Japanese end of lines to preserve continuity */
+{
+ /* No Bitmap found initially */
+ Scanning->Found=False;
+ /* Assume the next character is a Bitmap */
+ Scanning->WasLetter=False;
+ Scanning->Immediate=True;
+ /* Some non-comment Bitmap was met before or it's the first call to GetBitmap */
+ strcpy(Scanning->CommentLine,"");
+ /* Comment holds; it's the first call ever to GetBitmap; it's first character */
+ /* Comment fails; some non-comment Bitmap was met before; it isnt first char */
+ Scanning->First=Scanning->Comment;
+ do {
+ fscanf(InFile,"%c",&Scanning->Data1);
+ if (ferror(InFile)) exit(1);
+ if (feof(InFile)) {
+ /* File just finished */
+ clearerr(InFile);
+ Scanning->Done=True;
+ }
+ else {
+ /* More file coming */
+ if (Scanning->Data1==(unsigned char)'\xA')
+ GotUNIX(OutFile,Scanning,RunTime);
+ else
+ if (Scanning->Data1==(unsigned char)'\xC')
+ GotDOS(OutFile,Scanning,RunTime,InFile);
+ else
+ if (RunTime->EUC)
+ if (((unsigned char)'\xA0'<Scanning->Data1) &&
+ (Scanning->Data1<(unsigned char)'\xFF'))
+ GotBitmap(OutFile,RunTime->EUC,RunTime->Extended,InFile,Scanning);
+ else
+ GotRoman(OutFile,RunTime->ExtraSpace,Scanning);
+ else
+ if ( (((unsigned char)'\x81'<=Scanning->Data1) &&
+ (Scanning->Data1<=(unsigned char)'\x9F')) ||
+ (((unsigned char)'\xE0'<=Scanning->Data1) &&
+ (Scanning->Data1<=(unsigned char)'\xEA')) )
+ GotBitmap(OutFile,RunTime->EUC,RunTime->Extended,InFile,Scanning);
+ else
+ GotRoman(OutFile,RunTime->ExtraSpace,Scanning);
+ }
+ } while (!Scanning->Done && !Scanning->Found);
+}
+
+/*--------------------------------- GetFont ---------------------------------*/
+
+void GetFont(FILE *InFile, FontsType Fonts,
+ struct RunTimeType *InitialRunTime)
+/* Finds the Japanese fonts needed */
+/* The last state of LaTeX will prevail for forthcoming header and 2nd pass */
+{
+ /* Run time parameters */
+ struct RunTimeType RunTime;
+ /* Current font number */
+ int FontPtr;
+ int SizePtr;
+ /* Scanning information */
+ struct ScanningType Scanning;
+ /* Dummy since no output in first pass */
+ FILE *DummyOutFile=NULL;
+
+ strcpy(RunTime.FileName,InitialRunTime->FileName);
+ strcpy(RunTime.Extension,InitialRunTime->Extension);
+ RunTime.ExtraSpace=InitialRunTime->ExtraSpace;
+ RunTime.Percent=InitialRunTime->Percent;
+ RunTime.LaTeX=InitialRunTime->LaTeX;
+ RunTime.EUC=InitialRunTime->EUC;
+ RunTime.Extended=InitialRunTime->Extended;
+ RunTime.Size=InitialRunTime->Size;
+ /* No Japanese font needed so far */
+ for (SizePtr=1 ; SizePtr<=SizeMax ; SizePtr++)
+ for (FontPtr=0 ; FontPtr<=FontMax ; FontPtr++)
+ Fonts[SizePtr][FontPtr]=False;
+ /* Not reached EOF yet */
+ Scanning.Done=False;
+ /* No echo in first pass */
+ Scanning.Echo=False;
+ /* Dummy since no output in first pass */
+ Scanning.Immediate=False;
+ Scanning.WasLetter=False;
+ Scanning.RomanMajorEOL=False;
+ Scanning.RomanMinorEOL=False;
+ Scanning.RomanOpening=False;
+ /* Tell indirectly to GetBitmap that this is the first time it is called */
+ Scanning.Comment=True;
+ do {
+ /* Get the next Bitmap skipping over [La]TeX comments */
+ GetBitmap(InFile,DummyOutFile,&Scanning,&RunTime);
+ if (!Scanning.Done) Fonts[RunTime.Size][Scanning.Bitmap/128]=True;
+ } while (!Scanning.Done);
+ /* Last state of LaTeX prevails for the second pass */
+ InitialRunTime->LaTeX=RunTime.LaTeX;
+}
+
+/*---------------------------------- Header ---------------------------------*/
+
+void Header(FILE *OutFile, FontsType Fonts, int LaTeX)
+/* Writes [La]TeX header */
+{
+ int FontPtr;
+ int SizePtr;
+ char C0,C1,C2;
+ int Scale;
+
+ fprintf(OutFile,"\\tracingstats=1\n");
+ if (ferror(OutFile)) exit(1);
+ for (SizePtr=1 ; SizePtr<=SizeMax ; SizePtr++) {
+ C0='a'+(char)(SizePtr-1);
+ switch (SizePtr)
+ {
+ case 1:Scale=1000; break;
+ case 2:Scale=1095; break;
+ case 3:Scale=1200; break;
+ case 4:Scale=1440; break;
+ case 5:Scale=1728; break;
+ case 6:Scale=2074; break;
+ case 7:Scale=2488; break;
+ }
+ for (FontPtr=0 ; FontPtr<=FontMax ; FontPtr++)
+ if (Fonts[SizePtr][FontPtr]) {
+ C1='a'+(char)(FontPtr / 8);
+ C2='a'+(char)(FontPtr % 8);
+ if (LaTeX)
+ fprintf(OutFile,"\\newfont{\\k%c%c%c}{kanji%c%c scaled %d}\n",
+ C0,C1,C2,C1,C2,Scale);
+ else
+ fprintf(OutFile,"\\font\\k%c%c%c=kanji%c%c scaled %d\n",
+ C0,C1,C2,C1,C2,Scale);
+ if (ferror(OutFile)) exit(1);
+ }
+ }
+ if (LaTeX) {
+ fprintf(OutFile,"\\newcommand{\\kk}[2]{{#1\\symbol{#2}}}\n");
+ fprintf(OutFile,"\\newcommand{\\hh}{\\discretionary{}{}{}}\n");
+ fprintf(OutFile,"\\newcommand{\\ee}{\\nobreak\\hskip0pt plus.1em\\relax}\n");
+ fprintf(OutFile,"\\newcommand{\\eee}{\\nobreak\\hskip.3em plus.1em\\relax}\n");
+ fprintf(OutFile,"\\newcommand{\\eeee}{\\nobreak\\hskip.9em plus.1em minus.1em}\n");
+ }
+ else {
+ fprintf(OutFile,"\\def\\kk#1#2{{#1\\char#2}}\n");
+ fprintf(OutFile,"\\def\\hh{\\discretionary{}{}{}}\n");
+ fprintf(OutFile,"\\def\\ee{\\nobreak\\hskip0pt plus.1em\\relax}\n");
+ fprintf(OutFile,"\\def\\eee{\\nobreak\\hskip.3em plus.1em\\relax}\n");
+ fprintf(OutFile,"\\def\\eeee{\\nobreak\\hskip.9em plus.1em minus.1em}\n");
+ }
+ fprintf(OutFile,"\n");
+ if (ferror(OutFile)) exit(1);
+}
+
+/*--------------------------------- Convert ---------------------------------*/
+
+void BitmapType(int Bitmap, struct PunctuationType *Punctuation)
+/* Finds characteristics of current Bitmap */
+{
+ Punctuation->OldMajorEOL=Punctuation->NewMajorEOL;
+ Punctuation->OldMinorEOL=Punctuation->NewMinorEOL;
+ Punctuation->OldOpening=Punctuation->NewOpening;
+ Punctuation->OldClosing=Punctuation->NewClosing;
+ Punctuation->OldCenterDot=Punctuation->NewCenterDot;
+ Punctuation->OldJapanese=Punctuation->NewJapanese;
+ Punctuation->NewMajorEOL=False;
+ Punctuation->NewMinorEOL=False;
+ Punctuation->NewOpening=False;
+ Punctuation->NewClosing=False;
+ Punctuation->NewCenterDot=False;
+ Punctuation->NewJapanese=False;
+ /* Full width .,!? */
+ if ((2<=Bitmap) && (Bitmap<=5)) Punctuation->NewMajorEOL=True;
+ else
+ if ((Bitmap==9) || (Bitmap==10)) Punctuation->NewMajorEOL=True;
+ else
+ /* Half width .,!? */
+ if ((Bitmap==691) || (Bitmap==720)) Punctuation->NewMajorEOL=True;
+ else
+ /* Full width :; */
+ if ((Bitmap==7) || (Bitmap==8)) Punctuation->NewMinorEOL=True;
+ else
+ /* Half width :; */
+ if ((Bitmap==692) || (Bitmap==693)) Punctuation->NewMinorEOL=True;
+ else
+ /* Full width `"([< and other openings */
+ if ((38<=Bitmap) && (Bitmap<=58) && !(Bitmap%2)) Punctuation->NewOpening=True;
+ else
+ /* Half width `"([< and other openings */
+ if ((696<=Bitmap)&& (Bitmap<=716)&& !(Bitmap%2)) Punctuation->NewOpening=True;
+ else
+ /* Full width '")]> and other closings */
+ if ((39<=Bitmap) && (Bitmap<=59) && (Bitmap%2)) Punctuation->NewClosing=True;
+ else
+ /* Half width '")]> and other closings */
+ if ((697<=Bitmap) && (Bitmap<=717)&& (Bitmap%2)) Punctuation->NewClosing=True;
+ else
+ /* Full width Japanese center dot */
+ if (Bitmap==6) Punctuation->NewCenterDot=True;
+ else
+ /* Half width Japanese center dot */
+ if (Bitmap==469) Punctuation->NewCenterDot=True;
+ else
+ /* Full width Hiragana */
+ if ((283<=Bitmap) && (Bitmap<=365)) Punctuation->NewJapanese=True;
+ else
+ /* Full width Katakana */
+ if ((377<=Bitmap) && (Bitmap<=462)) Punctuation->NewJapanese=True;
+ else
+ /* Full width Kanji level 1 */
+ if ((1411<=Bitmap) && (Bitmap<=4375)) Punctuation->NewJapanese=True;
+ else
+ /* Full width Kanji level 2 */
+ if ((4419<=Bitmap) && (Bitmap<=7806)) Punctuation->NewJapanese=True;
+ else
+ /* Script Hiragana */
+ if ((753<=Bitmap) && (Bitmap<=835)) Punctuation->NewJapanese=True;
+ else
+ /* Script Katakana */
+ if ((847<=Bitmap) && (Bitmap<=932)) Punctuation->NewJapanese=True;
+}
+
+void Hyphenate(FILE *OutFile, struct PunctuationType *Punctuation)
+/* Adds hyphenation between consecutive Bitmaps */
+{
+ /* No hyphenation between two odd symbols */
+ if (Punctuation->OldJapanese || Punctuation->NewJapanese)
+ /* No hyphenation before some symbols */
+ if (!Punctuation->NewMajorEOL && !Punctuation->NewMinorEOL &&
+ !Punctuation->NewCenterDot && !Punctuation->NewClosing)
+ /* No hyphenation after some symbols */
+ if (!Punctuation->OldOpening) {
+ fprintf(OutFile,"\\hh");
+ if (ferror(OutFile)) exit(1);
+ }
+}
+
+void Glue(FILE *OutFile, struct PunctuationType *Punctuation, int ExtraSpace)
+/* Adds glue between consecutive Bitmaps */
+{
+ int GlueAdded;
+
+ GlueAdded=False;
+ if (ExtraSpace) {
+ /* Trying to add big glue */
+ if (Punctuation->OldMajorEOL)
+ /* No big glue between identical symbols */
+ if (!Punctuation->NewMajorEOL)
+ /* No big glue before some symbols */
+ if (!Punctuation->NewClosing) {
+ GlueAdded=True;
+ fprintf(OutFile,"\\eeee");
+ if (ferror(OutFile)) exit(1);
+ }
+ if (!GlueAdded)
+ /* Trying to add medium glue based on old symbol */
+ if (Punctuation->OldMinorEOL || Punctuation->OldCenterDot ||
+ Punctuation->OldClosing)
+ /* No medium glue before some symbols */
+ if (!Punctuation->NewMajorEOL && !Punctuation->NewMinorEOL &&
+ !Punctuation->NewClosing) {
+ GlueAdded=True;
+ fprintf(OutFile,"\\eee");
+ if (ferror(OutFile)) exit(1);
+ }
+ if (!GlueAdded)
+ /* Trying to add medium glue based on new symbol */
+ if (Punctuation->NewCenterDot || Punctuation->NewOpening)
+ /* No medium glue after some symbols */
+ if (!Punctuation->OldOpening) {
+ GlueAdded=True;
+ fprintf(OutFile,"\\eee");
+ if (ferror(OutFile)) exit(1);
+ }
+ }
+ /* Always make sure to add some glue */
+ if (!GlueAdded) {
+ /* Adding small glue */
+ fprintf(OutFile,"\\ee");
+ if (ferror(OutFile)) exit(1);
+ }
+}
+
+void Convert(FILE *InFile, FILE *OutFile, struct RunTimeType *RunTime)
+/* Convert .JEM into .TeX by translating Bitmaps & adding hyphenation & glue */
+{
+ /* Japanese punctuation information */
+ struct PunctuationType Punctuation;
+ /* Scanning information */
+ struct ScanningType Scanning;
+ /* Current font number */
+ int FontPtr;
+ char C0,C1,C2;
+
+ /* Not reached EOF yet */
+ Scanning.Done=False;
+ /* Echo in second pass */
+ Scanning.Echo=True;
+ /* Nothing done yet */
+ Scanning.Immediate=False;
+ Scanning.WasLetter=False;
+ /* Tell indirectly to GetBitmap that this is the first time it is called */
+ Scanning.Comment=True;
+ /* Initial japanese punctuation information */
+ Punctuation.NewMajorEOL=False; Punctuation.NewMinorEOL=False;
+ Punctuation.NewOpening=False; Punctuation.NewClosing=False;
+ Punctuation.NewCenterDot=False; Punctuation.NewJapanese=False;
+ do {
+ /* Set up scanning information in case a roman letter follows immediately */
+ Scanning.RomanMajorEOL=Punctuation.NewMajorEOL;
+ Scanning.RomanMinorEOL=(Punctuation.NewMinorEOL ||
+ Punctuation.NewCenterDot ||
+ Punctuation.NewClosing);
+ Scanning.RomanOpening=Punctuation.NewOpening;
+ /* Get the next Bitmap skipping over [La]TeX comments */
+ /* May add glue between the old Bitmap and an hypothetical Roman */
+ GetBitmap(InFile,OutFile,&Scanning,RunTime);
+ if (!Scanning.Done) {
+ /* Find what kind of Bitmap it is */
+ BitmapType(Scanning.Bitmap,&Punctuation);
+ if (Scanning.Immediate) {
+ /* Add hyphenation and glue between consecutive Bitmaps */
+ Hyphenate(OutFile,&Punctuation);
+ Glue(OutFile,&Punctuation,RunTime->ExtraSpace);
+ }
+ else
+ /* Add glue after the old Roman and before this new Bitmap */
+ if (RunTime->ExtraSpace)
+ if (Punctuation.NewCenterDot || Punctuation.NewOpening) {
+ fprintf(OutFile,"\\eee");
+ if (ferror(OutFile)) exit(1);
+ }
+ else
+ if (Scanning.WasLetter)
+ /* No medium glue before some symbols */
+ if (!Punctuation.NewMajorEOL && !Punctuation.NewMinorEOL &&
+ !Punctuation.NewClosing) {
+ fprintf(OutFile,"\\eee");
+ if (ferror(OutFile)) exit(1);
+ }
+ /* Write the Bitmap */
+ C0='a'+(char)(RunTime->Size-1);
+ FontPtr=Scanning.Bitmap / 128;
+ C1='a'+(char)(FontPtr / 8);
+ C2='a'+(char)(FontPtr % 8);
+ fprintf(OutFile,"\\kk{\\k%c%c%c}{%d}",C0,C1,C2,(Scanning.Bitmap % 128));
+ if (ferror(OutFile)) exit(1);
+ /* The next character may be Roman, GetBitmap will handle the glue then */
+ }
+ } while (!Scanning.Done);
+}
+
+/*----------------------------------- Main ----------------------------------*/
+
+main(int argc, char *argv[])
+{
+ /* Input and Output file names */
+ TotalNameType TotalName;
+ FILE *InFile;
+ FILE *OutFile;
+ /* Run time parameters */
+ struct RunTimeType RunTime;
+ /* JemTeX fonts used */
+ FontsType Fonts;
+
+ printf("\n");
+ printf("Japanese to [La]TeX Conversion Program.\n"); /*To make Borland happy*/
+ printf("Version 2.00 Copyright F. Jalbert 1991.\n");
+ printf("\n");
+ if (ferror(stdout)) exit(1);
+
+ GetParameters(&RunTime,argc,argv);
+ printf("\n");
+ printf("Opening Japanese file %s",RunTime.FileName);
+ OpenFile(&InFile,&RunTime);
+ printf(".\n");
+ if (RunTime.LaTeX) printf("Creating LaTeX file %s.tex",RunTime.FileName);
+ else printf("Creating TeX file %s.tex",RunTime.FileName);
+ strcpy(TotalName,RunTime.FileName);
+ strcat(TotalName,".tex");
+ OutFile=fopen(TotalName,"wt");
+ if (OutFile==NULL) exit(1);
+ printf(".\n");
+ printf("\n");
+ if (ferror(stdout)) exit(1);
+
+ printf("Scanning Japanese file for fonts");
+ #ifndef __TURBOC__
+ printf("\n");
+ #endif
+ GetFont(InFile,Fonts,&RunTime);
+ rewind(InFile);
+ /* ferror now cleared */
+ printf(".\n");
+ if (RunTime.LaTeX) printf("Writing LaTeX header");
+ else printf("Writing TeX header");
+ #ifndef __TURBOC__
+ printf("\n");
+ #endif
+ Header(OutFile,Fonts,RunTime.LaTeX);
+ printf(".\n");
+ printf("Converting Japanese file");
+ #ifndef __TURBOC__
+ printf("\n");
+ #endif
+ Convert(InFile,OutFile,&RunTime);
+ printf(".\n");
+ printf("\n");
+ if (ferror(stdout)) exit(1);
+
+ printf("Closing Japanese file %s%s",RunTime.FileName,RunTime.Extension);
+ if (fclose(InFile)==EOF) exit(1);
+ printf(".\n");
+ if (RunTime.LaTeX) printf("Closing LaTeX file %s.tex",RunTime.FileName);
+ else printf("Closing TeX file %s.tex",RunTime.FileName);
+ if (fclose(OutFile)==EOF) exit(1);
+ printf(".\n");
+ printf("\n");
+ if (ferror(stdout)) exit(1);
+
+ printf("Japanese to [La]TeX conversion completed.\n");
+ printf("\n");
+ if (ferror(stdout)) exit(1);
+
+ return(0);
+}
diff --git a/systems/msdos/jemtex2/jem2tex.pas b/systems/msdos/jemtex2/jem2tex.pas
new file mode 100644
index 0000000000..78d84ba295
--- /dev/null
+++ b/systems/msdos/jemtex2/jem2tex.pas
@@ -0,0 +1,1209 @@
+{$A-,B-,D-,E-,F-,I+,L-,N-,O-,R-,S-,V-}
+{Compile with Turbo-Pascal 5.0}
+Program Jem2TeX(Input,Output);
+{
+ This program translates a .JEM file into a .TeX file
+
+ Author: Francois Jalbert
+ '
+ Date: November 1990
+
+ Version: 1.0
+
+ Date: January 1991
+
+ Version: 1.01
+
+ Modifications: - Added \hskip0pt plus0.1em between all Japanese symbols which
+ improved dramatically line breaks and inter-sentence spacing
+ since [La]TeX could only add glue between whole Japanese
+ sentences.
+ - Extra space after punctuation is now an option since it is
+ not desirable with MuTeX when the text is to go under the
+ staff.
+ - Font names now use only small letters to be compatible with
+ the fontlib program supplied with emTeX.
+ - Command line parameters now supported.
+ - Run-time parameters now supported.
+ - Updated and improved run-time messages.
+
+ Date: April 1991
+
+ Version: 2.00
+
+ Modifications: - Added four kanjis.
+ - If desired, only standard JIS '83 characters are allowed.
+ - If desired, a % is added at each Japanese end of line.
+ - Three file name extensions .JEM .JPN .JAP now supported.
+ - Default extension is .JEM and the program has been renamed.
+ - Three run-time parameter flags now supported.
+ - Japanese comments not translated anymore for reference.
+ - Hyphenation and glue handled separately for better control.
+ - More clever algorithm for Japanese hyphenation.
+ - Space after some punctuation now obtained with \eeee.
+ - Small space around some punctuation introduced with \eee.
+ - Tiny space between Japanese characters with \ee.
+ - Space between Japanese and Roman with \eeee and \eee.
+ - Symbols separated only by [La]TeX comments are now
+ recognized as consecutive.
+ - MS-kanji (Shift-JIS) now supported.
+
+ Error Levels: 0 - Normal termination.
+ 1 - Error.
+}
+Const
+ {Highest Bitmap number in JIS24}
+ BitmapMax=7806;
+ {Highest font number}
+ FontMax=60; {Floor of 7806 Div 128}
+ {Highest size number}
+ SizeMax=7; {magsteps are 0, 0.5, 1, 2, 3, 4, 5}
+ {File name extensions in priority order}
+ Extension1:String[4]='.jem';
+ Extension2:String[4]='.jpn';
+ Extension3:String[4]='.jap';
+ {Run-time flag of all the same length}
+ RunFlag1:String[7]='JEM2TEX';
+ RunFlag2:String[7]='JPN2TEX';
+ RunFlag3:String[7]='JAP2TEX';
+ {Parameter flag}
+ Flag1='/'; {DOS style}
+ Flag2='-'; {UNIX style}
+ {Parameter keywords in approximate decreasing length order}
+ Space1:String[10]='EXTRASPACE';
+ Space2:String[5]='EXTRA';
+ Space3:String[5]='SPACE';
+ NoSpace1:String[12]='NOEXTRASPACE';
+ NoSpace2:String[7]='NOEXTRA';
+ NoSpace3:String[7]='NOSPACE';
+ Percent1:String[7]='COMMENT';
+ Percent2:String[7]='PERCENT';
+ Percent3:String[3]='EOL';
+ NoPercent1:String[9]='NOCOMMENT';
+ NoPercent2:String[9]='NOPERCENT';
+ NoPercent3:String[5]='NOEOL';
+ EUC1:String[3]='EUC';
+ NoEUC1:String[7]='MSKANJI';
+ NoEUC2:String[8]='SHIFTJIS';
+ Extended1:String[8]='EXTENDED';
+ Standard1:String[8]='STANDARD';
+ LaTeX1:String[5]='LATEX';
+ TeX1:String[5]='MUTEX';
+ TeX2:String[3]='TEX';
+ One1:String[4]='1000';
+ Two1:String[4]='1095';
+ Three1:String[4]='1200';
+ Four1:String[4]='1440';
+ Five1:String[4]='1728';
+ Six1:String[4]='2074';
+ Seven1:String[4]='2488';
+ One2:String[3]='0.0';
+ Two2:String[3]='0.5';
+ Three2:String[3]='1.0';
+ Four2:String[3]='2.0';
+ Five2:String[3]='3.0';
+ Six2:String[3]='4.0';
+ Seven2:String[3]='5.0';
+ One3:String[1]='0';
+ Three3:String[1]='1';
+ Four3:String[1]='2';
+ Five3:String[1]='3';
+ Six3:String[1]='4';
+ Seven3:String[1]='5';
+
+Type
+ InFileType=File Of Byte;
+ OutFileType=Text;
+ BitmapRange=1..BitmapMax;
+ FontRange=0..FontMax;
+ FontType=Array [FontRange] Of Boolean;
+ SizeRange=1..SizeMax;
+ FontsType=Array [SizeRange] Of FontType;
+ {Run time parameters}
+ RunTimeType=Record
+ FileName,Extension:String;
+ ExtraSpace,Percent,LaTeX,EUC,Extended:Boolean;
+ Size:SizeRange;
+ End;
+ {Japanese punctuation information}
+ PunctuationType=Record
+ {Indicates .,!? present}
+ OldMajorEOL,NewMajorEOL:Boolean;
+ {Indicates :; present}
+ OldMinorEOL,NewMinorEOL:Boolean;
+ {Indicates `"([< and other openings present}
+ OldOpening,NewOpening:Boolean;
+ {Indicates '")]> and other closings present}
+ OldClosing,NewClosing:Boolean;
+ {Indicates Japanese center dot present}
+ OldCenterDot,NewCenterDot:Boolean;
+ {Indicates Hiragana, Katakana, or Kanji present}
+ OldJapanese,NewJapanese:Boolean
+ End;
+ {Scanning Information}
+ ScanningType=Record
+ {Current pass terminated}
+ Done:Boolean;
+ {Indicates the current pass must produce output}
+ Echo:Boolean;
+ {Indicates the current line is a comment}
+ Comment:Boolean;
+ {Indicates current Bitmap immediately followed previous one}
+ Immediate:Boolean;
+ {Indicates the last Roman character was a letter or digit}
+ WasLetter:Boolean;
+ {Used for glue after a bitmap and before a roman}
+ RomanMajorEOL,RomanMinorEOL,RomanOpening:Boolean;
+ {Non-comment Bitmap found}
+ Found:Boolean;
+ {Processing the first character on the line which could be %}
+ First:Boolean;
+ {Comment line which may contain Bitmaps}
+ CommentLine:String;
+ {Current JIS24 Bitmap number}
+ Bitmap:BitmapRange;
+ {Roman or first part of Bitmap read}
+ Data1:Byte
+ End;
+
+Var
+ {Input and Output file names}
+ InFile:InFileType;
+ OutFile:OutFileType;
+ {Run time parameters}
+ RunTime:RunTimeType;
+ {JemTeX fonts used}
+ Fonts:FontsType;
+
+{------------------------------ EchoParameters -------------------------------}
+
+Procedure EchoParameters(Var EchoFile:Text; Var RunTime:RunTimeType);
+{Echoes the current parameters in EchoFile}
+Begin
+With RunTime Do
+ Begin
+ Write(EchoFile,'File='+FileName);
+ If ExtraSpace Then Write(EchoFile,' Space')
+ Else Write(EchoFile,' No Space');
+ If Percent Then Write(EchoFile,' Added %')
+ Else Write(EchoFile,' No Added %');
+ If LaTeX Then Write(EchoFile,' LaTeX')
+ Else Write(EchoFile,' TeX');
+ If EUC Then Write(EchoFile,' EUC')
+ Else Write(EchoFile,' MS-kanji');
+ If Extended Then Write(EchoFile,' Extended')
+ Else Write(EchoFile,' Standard');
+ Write(EchoFile,' Font Size=');
+ Case Size Of
+ 1:Write(EchoFile,'1000');
+ 2:Write(EchoFile,'1095');
+ 3:Write(EchoFile,'1200');
+ 4:Write(EchoFile,'1440');
+ 5:Write(EchoFile,'1728');
+ 6:Write(EchoFile,'2074');
+ 7:Write(EchoFile,'2488')
+ End;
+ Writeln(EchoFile,'.')
+ End
+End;
+
+{------------------------------- GetParameters -------------------------------}
+
+Procedure SimpleQuery(Title,ChoiceA,ChoiceB:String; Var Answer:Boolean);
+Var
+ JChar:Char;
+ Valid:Boolean;
+Begin
+Repeat
+ Valid:=True;
+ Writeln(Title+':');
+ Writeln(' a) '+ChoiceA);
+ Writeln(' b) '+ChoiceB);
+ Write('Your choice? ');
+ Readln(JChar);
+ JChar:=UpCase(JChar);
+ If JChar='A' Then Answer:=True
+ Else
+ If JChar='B' Then Answer:=False
+ Else
+ Begin Valid:=False; Write(Chr(7)) End
+Until Valid;
+Writeln
+End;
+
+Procedure SizeQuery(Var Size:SizeRange);
+Var
+ JChar:Char;
+ Valid:Boolean;
+Begin
+Repeat
+ Valid:=True;
+ Writeln('Japanese Font Size:');
+ Writeln(' a) 1000 magstep(0.0)');
+ Writeln(' b) 1095 magstep(0.5)');
+ Writeln(' c) 1200 magstep(1.0)');
+ Writeln(' d) 1440 magstep(2.0)');
+ Writeln(' e) 1728 magstep(3.0)');
+ Writeln(' f) 2074 magstep(4.5)');
+ Writeln(' g) 2488 magstep(5.0)');
+ Write('Your choice? ');
+ Readln(JChar);
+ JChar:=UpCase(JChar);
+ If ('A'<=JChar) And (JChar<='G') Then
+ Size:=Ord(JChar)-Ord('A')+1
+ Else
+ Begin Valid:=False; Write(Chr(7)) End
+Until Valid;
+Writeln
+End;
+
+Procedure Manual(Var RunTime:RunTimeType);
+{Get parameters from user}
+Begin
+With RunTime Do
+ Begin
+ Write('Japanese file name? ');
+ Readln(FileName);
+ Writeln;
+ SimpleQuery('Space around Japanese punctuation','Space','No space',ExtraSpace);
+ SimpleQuery('Added % at Japanese end of lines','Added %','No added %',Percent);
+ SimpleQuery('LaTeX or TeX (MuTeX) output','LaTeX','TeX',LaTeX);
+ SimpleQuery('EUC or MS-kanji (Shift-JIS) encoding','EUC','MS-kanji',EUC);
+SimpleQuery('Extended JIS ''83 Bitmaps allowed','Extended','Standard',Extended);
+ SizeQuery(Size)
+ End
+End;
+
+Procedure Automate(Var RunTime:RunTimeType);
+{Get parameters from command line}
+Var
+ ParamIndex,Index:Integer;
+ Param:String;
+Begin
+With RunTime Do
+ Begin
+ {Defaults}
+ FileName:='japanese';
+ ExtraSpace:=True;
+ Percent:=True;
+ LaTeX:=True;
+ EUC:=True;
+ Extended:=True;
+ Size:=4;
+ {Scan command line parameters}
+ For ParamIndex:=1 To ParamCount Do
+ Begin
+ Param:=ParamStr(ParamIndex);
+ If (Param[1]=Flag1) Or (Param[1]=Flag2) Then
+ {Not a filename}
+ Begin
+ {Delete 1 char at the 1st position}
+ Delete(Param,1,1);
+ {Convert to upper case}
+ For Index:=1 To Length(Param) Do Param[Index]:=UpCase(Param[Index]);
+ {Scan known keywords}
+ If (Param=Space1) Or (Param=Space2) Or (Param=Space3)Then ExtraSpace:=True
+ Else
+ If (Param=NoSpace1) Or (Param=NoSpace2) Or (Param=NoSpace3) Then
+ ExtraSpace:=False
+ Else
+ If (Param=Percent1) Or (Param=Percent2) Or (Param=Percent3) Then
+ Percent:=True
+ Else
+ If (Param=NoPercent1) Or (Param=NoPercent2) Or (Param=NoPercent3) Then
+ Percent:=False
+ Else
+ If Param=EUC1 Then EUC:=True
+ Else
+ If (Param=NoEUC1) Or (Param=NoEUC2) Then EUC:=False
+ Else
+ If Param=Extended1 Then Extended:=True
+ Else
+ If Param=Standard1 Then Extended:=False
+ Else
+ If Param=LaTeX1 Then LaTeX:=True
+ Else
+ If (Param=TeX1) Or (Param=TeX2) Then LaTeX:=False
+ Else
+ If (Param=One1) Or (Param=One2) Or (Param=One3) Then Size:=1
+ Else
+ If (Param=Two1) Or (Param=Two2) Then Size:=2
+ Else
+ If (Param=Three1) Or (Param=Three2) Or (Param=Three3) Then Size:=3
+ Else
+ If (Param=Four1) Or (Param=Four2) Or (Param=Four3) Then Size:=4
+ Else
+ If (Param=Five1) Or (Param=Five2) Or (Param=Five3) Then Size:=5
+ Else
+ If (Param=Six1) Or (Param=Six2) Or (Param=Six3) Then Size:=6
+ Else
+ If (Param=Seven1) Or (Param=Seven2) Or (Param=Seven3) Then Size:=7
+ Else
+ {Unknown keyword}
+ Begin
+ Writeln(Chr(7)+'Invalid command line parameter: '+Param+'...');
+ Halt(1)
+ End
+ End
+ Else
+ {Must be a filename, we'll try to open it later}
+ FileName:=Param
+ End
+ End
+End;
+
+Procedure GetParameters(Var RunTime:RunTimeType);
+{Get parameters from user or command line}
+{Current parameter status is echoed on the console}
+Begin
+If ParamCount=0 Then Manual(RunTime)
+Else Automate(RunTime);
+EchoParameters(Output,RunTime)
+End;
+
+{-------------------------------- OpenFile -----------------------------------}
+
+Function TryExtension(Var InFile:InFileType; Var RunTime:RunTimeType;
+ TriedExtension:String):Boolean;
+{Tries to open FileName using TriedExtension}
+Begin
+With RunTime Do
+ Begin
+ Extension:=TriedExtension;
+ Assign(InFile,FileName+TriedExtension);
+ {$I-}Reset(InFile);{$I+}
+ {IOResult must be immediately used once only}
+ TryExtension:=(IOResult=0)
+ End
+End;
+
+Procedure OpenFile(Var InFile:InFileType; Var RunTime:RunTimeType);
+{Tries to open FileName using all available extensions}
+Begin
+If TryExtension(InFile,RunTime,Extension1) Then Write(Extension1)
+Else
+ If TryExtension(InFile,RunTime,Extension2) Then Write(Extension2)
+ Else
+ If TryExtension(InFile,RunTime,Extension3) Then Write(Extension3)
+ Else
+ Begin
+ Writeln('.');
+ Writeln(Chr(7)+'File not found'+'...');
+ Halt(1)
+ End
+End;
+
+{-------------------------------- GetBitmap ----------------------------------}
+
+Procedure PerformScan(Var CommentLine:String; Var RunTime:RunTimeType;
+ Echo:Boolean; Var OutFile:OutFileType);
+{Scans the comment line for run-time JEM2TEX parameters}
+{Any Bitmap or unknown parameter stops the scan}
+{Current parameter status is echoed in the .TeX file as a [La]TeX comment}
+Var Index:Integer;
+Begin
+{Delete 1 char at the 1st position which is %}
+Delete(CommentLine,1,1);
+{Convert to upper case}
+For Index:=1 To Length(CommentLine) Do
+ CommentLine[Index]:=UpCase(CommentLine[Index]);
+{Add space at the line end to characterize premature termination}
+{Add sentinel at the line end to stop forthcoming loops}
+CommentLine:=CommentLine+' %';
+{Delete leading blanks}
+If CommentLine[1]=' ' Then
+ Repeat Delete(CommentLine,1,1)
+ Until CommentLine[1]<>' ';
+{Look for run-time flag at the start of line}
+If ( RunFlag1=Copy(CommentLine,1,Length(RunFlag1)) ) Or
+ ( RunFlag2=Copy(CommentLine,1,Length(RunFlag1)) ) Or
+ ( RunFlag3=Copy(CommentLine,1,Length(RunFlag1)) )
+Then
+ Begin
+ {Remove run-time flag}
+ Delete(CommentLine,1,Length(RunFlag1));
+ {Scan until sentinel reached}
+ Repeat
+ {Delete leading blanks}
+ If CommentLine[1]=' ' Then
+ Repeat Delete(CommentLine,1,1)
+ Until CommentLine[1]<>' ';
+ If (CommentLine[1]=Flag1) Or (CommentLine[1]=Flag2) Then
+ {Valid run-time parameter flag}
+ Begin
+ {Delete 1 char at the 1st position which is flag}
+ Delete(CommentLine,1,1);
+ {Scan in decreasing length order}
+ With RunTime Do
+ Begin
+ If Space1=Copy(CommentLine,1,Length(Space1)) Then
+ Begin Delete(CommentLine,1,Length(Space1)); ExtraSpace:=True End
+ Else
+ If Space2=Copy(CommentLine,1,Length(Space2)) Then
+ Begin Delete(CommentLine,1,Length(Space2)); ExtraSpace:=True End
+ Else
+ If Space3=Copy(CommentLine,1,Length(Space3)) Then
+ Begin Delete(CommentLine,1,Length(Space3)); ExtraSpace:=True End
+ Else
+ If NoSpace1=Copy(CommentLine,1,Length(NoSpace1)) Then
+ Begin Delete(CommentLine,1,Length(NoSpace1)); ExtraSpace:=False End
+ Else
+ If NoSpace2=Copy(CommentLine,1,Length(NoSpace2)) Then
+ Begin Delete(CommentLine,1,Length(NoSpace2)); ExtraSpace:=False End
+ Else
+ If NoSpace3=Copy(CommentLine,1,Length(NoSpace3)) Then
+ Begin Delete(CommentLine,1,Length(NoSpace3)); ExtraSpace:=False End
+ Else
+ If Percent1=Copy(CommentLine,1,Length(Percent1)) Then
+ Begin Delete(CommentLine,1,Length(Percent1)); Percent:=True End
+ Else
+ If Percent2=Copy(CommentLine,1,Length(Percent2)) Then
+ Begin Delete(CommentLine,1,Length(Percent2)); Percent:=True End
+ Else
+ If Percent3=Copy(CommentLine,1,Length(Percent3)) Then
+ Begin Delete(CommentLine,1,Length(Percent3)); Percent:=True End
+ Else
+ If NoPercent1=Copy(CommentLine,1,Length(NoPercent1)) Then
+ Begin Delete(CommentLine,1,Length(NoPercent1)); Percent:=False End
+ Else
+ If NoPercent2=Copy(CommentLine,1,Length(NoPercent2)) Then
+ Begin Delete(CommentLine,1,Length(NoPercent2)); Percent:=False End
+ Else
+ If NoPercent3=Copy(CommentLine,1,Length(NoPercent3)) Then
+ Begin Delete(CommentLine,1,Length(NoPercent3)); Percent:=False End
+ Else
+ If EUC1=Copy(CommentLine,1,Length(EUC1)) Then
+ Begin Delete(CommentLine,1,Length(EUC1)); EUC:=True End
+ Else
+ If NoEUC1=Copy(CommentLine,1,Length(NoEUC1)) Then
+ Begin Delete(CommentLine,1,Length(NoEUC1)); EUC:=False End
+ Else
+ If NoEUC2=Copy(CommentLine,1,Length(NoEUC2)) Then
+ Begin Delete(CommentLine,1,Length(NoEUC2)); EUC:=False End
+ Else
+ If Extended1=Copy(CommentLine,1,Length(Extended1)) Then
+ Begin Delete(CommentLine,1,Length(Extended1)); Extended:=True End
+ Else
+ If Standard1=Copy(CommentLine,1,Length(Standard1)) Then
+ Begin Delete(CommentLine,1,Length(Standard1)); Extended:=False End
+ Else
+ If LaTeX1=Copy(CommentLine,1,Length(LaTeX1)) Then
+ Begin Delete(CommentLine,1,Length(LaTeX1)); LaTeX:=True End
+ Else
+ If TeX1=Copy(CommentLine,1,Length(TeX1)) Then
+ Begin Delete(CommentLine,1,Length(TeX1)); LaTeX:=False End
+ Else
+ If TeX2=Copy(CommentLine,1,Length(TeX2)) Then
+ Begin Delete(CommentLine,1,Length(TeX2)); LaTeX:=False End
+ Else
+ If One1=Copy(CommentLine,1,Length(One1)) Then
+ Begin Delete(CommentLine,1,Length(One1)); Size:=1 End
+ Else
+ If Two1=Copy(CommentLine,1,Length(Two1)) Then
+ Begin Delete(CommentLine,1,Length(Two1)); Size:=2 End
+ Else
+ If Three1=Copy(CommentLine,1,Length(Three1)) Then
+ Begin Delete(CommentLine,1,Length(Three1)); Size:=3 End
+ Else
+ If Four1=Copy(CommentLine,1,Length(Four1)) Then
+ Begin Delete(CommentLine,1,Length(Four1)); Size:=4 End
+ Else
+ If Five1=Copy(CommentLine,1,Length(Five1)) Then
+ Begin Delete(CommentLine,1,Length(Five1)); Size:=5 End
+ Else
+ If Six1=Copy(CommentLine,1,Length(Six1)) Then
+ Begin Delete(CommentLine,1,Length(Six1)); Size:=6 End
+ Else
+ If Seven1=Copy(CommentLine,1,Length(Seven1)) Then
+ Begin Delete(CommentLine,1,Length(Seven1)); Size:=7 End
+ Else
+ If One2=Copy(CommentLine,1,Length(One2)) Then
+ Begin Delete(CommentLine,1,Length(One2)); Size:=1 End
+ Else
+ If Two2=Copy(CommentLine,1,Length(Two2)) Then
+ Begin Delete(CommentLine,1,Length(Two2)); Size:=2 End
+ Else
+ If Three2=Copy(CommentLine,1,Length(Three2)) Then
+ Begin Delete(CommentLine,1,Length(Three2)); Size:=3 End
+ Else
+ If Four2=Copy(CommentLine,1,Length(Four2)) Then
+ Begin Delete(CommentLine,1,Length(Four2)); Size:=4 End
+ Else
+ If Five2=Copy(CommentLine,1,Length(Five2)) Then
+ Begin Delete(CommentLine,1,Length(Five2)); Size:=5 End
+ Else
+ If Six2=Copy(CommentLine,1,Length(Six2)) Then
+ Begin Delete(CommentLine,1,Length(Six2)); Size:=6 End
+ Else
+ If Seven2=Copy(CommentLine,1,Length(Seven2)) Then
+ Begin Delete(CommentLine,1,Length(Seven2)); Size:=7 End
+ Else
+ If One3=Copy(CommentLine,1,Length(One3)) Then
+ Begin Delete(CommentLine,1,Length(One3)); Size:=1 End
+ Else
+ If Three3=Copy(CommentLine,1,Length(Three3)) Then
+ Begin Delete(CommentLine,1,Length(Three3)); Size:=3 End
+ Else
+ If Four3=Copy(CommentLine,1,Length(Four3)) Then
+ Begin Delete(CommentLine,1,Length(Four3)); Size:=4 End
+ Else
+ If Five3=Copy(CommentLine,1,Length(Five3)) Then
+ Begin Delete(CommentLine,1,Length(Five3)); Size:=5 End
+ Else
+ If Six3=Copy(CommentLine,1,Length(Six3)) Then
+ Begin Delete(CommentLine,1,Length(Six3)); Size:=6 End
+ Else
+ If Seven3=Copy(CommentLine,1,Length(Seven3)) Then
+ Begin Delete(CommentLine,1,Length(Seven3)); Size:=7 End
+ Else
+ {Unknown run-time parameter}
+ {Terminate prematurely current scan}
+ CommentLine:='%'
+ End;
+ {Echo status if allowed}
+ If Echo And (CommentLine<>'%') Then
+ Begin
+ Write(OutFile,'%');
+ EchoParameters(OutFile,RunTime)
+ End
+ End
+ Else
+ {Unknown run-time parameter flag}
+ {Terminate prematurely current scan}
+ CommentLine:='%'
+ Until Length(CommentLine)=1
+ End
+End;
+
+Procedure LineBreak(Var OutFile:OutFileType; ExtraSpace:Boolean;
+ Var Scanning:ScanningType);
+{The continuous chain of Bitmaps has just been interrupted by a line break}
+{We know the next Roman character is equivalent to a space, i.e. not a letter}
+{A \eeee may be inserted if the previous Bitmap was a .,!?}
+{A \eee may be inserted if the previous Bitmap was a :; center dot )]'"}
+{If glue inserted, make sure to leave a totally blank line as present before}
+Begin
+With Scanning Do
+ Begin
+ Immediate:=False;
+ If Echo And ExtraSpace Then
+ If RomanMajorEOL Then Writeln(OutFile,'\eeee')
+ Else
+ If RomanMinorEOL Then Writeln(OutFile,'\eee')
+ End
+End;
+
+Procedure RomanBreak(Var OutFile:OutFileType; ExtraSpace:Boolean;
+ Var Scanning:ScanningType);
+{The continuous chain of Bitmaps has just been interrupted by a Roman}
+{The next Roman character may be a letter so a \eee is possible}
+{A \eeee may be inserted if the previous Bitmap was a .,!?}
+{A \eee may be inserted if the previous Bitmap was a :; center dot )]'"}
+{Curly brackets are used in \eee and \eeee when the next Roman is a letter}
+Begin
+With Scanning Do
+ Begin
+ Immediate:=False;
+ If Echo And ExtraSpace Then
+ If RomanMajorEOL Then
+ If WasLetter Then Write(OutFile,'\eeee{}')
+ Else Write(OutFile,'\eeee')
+ Else
+ If RomanMinorEOL Then
+ If WasLetter Then Write(OutFile,'\eee{}')
+ Else Write(OutFile,'\eee')
+ Else
+ If WasLetter And Not RomanOpening Then Write(OutFile,'\eee{}')
+ End
+End;
+
+Procedure GotUNIX(Var OutFile:OutFileType; Var Scanning:ScanningType;
+ Var RunTime:RunTimeType);
+{Handles UNIX EOL}
+{May add glue after the previous Bitmap and before this Roman}
+Begin
+With Scanning,RunTime Do
+ Begin
+ If Immediate Then
+ If First Then LineBreak(OutFile,ExtraSpace,Scanning)
+ Else
+ If Not Comment Then
+ If Percent Then
+ If Echo Then Write(OutFile,'%')
+ Else
+ Else
+ LineBreak(OutFile,ExtraSpace,Scanning);
+ If Echo Then Writeln(OutFile);
+ If Comment Then
+ If Not First Then PerformScan(CommentLine,RunTime,Echo,OutFile)
+ Else
+ Else
+ WasLetter:=False;
+ First:=True;
+ Comment:=True;
+ CommentLine:=''
+ End
+End;
+
+Procedure GotDOS(Var OutFile:OutFileType; Var Scanning:ScanningType;
+ Var RunTime:RunTimeType; Var InFile:InFileType);
+{Handles DOS EOL}
+{May add glue after the previous Bitmap and before this Roman}
+{An error only stops the current pass to help the user determine its cause}
+Var Data2:Byte;
+Begin
+With Scanning Do
+ Begin
+ GotUNIX(OutFile,Scanning,RunTime);
+ {Line Feed must follow immediately}
+ If EOF(InFile) Then Done:=True
+ Else
+ Begin
+ Read(InFile,Data2);
+ If Data2<>$0A Then Done:=True
+ End;
+ If Done Then
+ Begin
+ Writeln('.');
+ Write(Chr(7)+'Abnormal DOS end of line..')
+ End
+ End
+End;
+
+Procedure ValidateBitmap(Bitmap:BitmapRange);
+{Prints a warning when an extended or an empty Bitmap is used}
+Var Invalid:Boolean;
+Begin
+Invalid:=False;
+If (109<=Bitmap) And (Bitmap<=119) Then Invalid:=True
+Else
+If (128<=Bitmap) And (Bitmap<=135) Then Invalid:=True
+Else
+If (143<=Bitmap) And (Bitmap<=153) Then Invalid:=True
+Else
+If (169<=Bitmap) And (Bitmap<=175) Then Invalid:=True
+Else
+If (184<=Bitmap) And (Bitmap<=203) Then Invalid:=True
+Else
+If (214<=Bitmap) And (Bitmap<=220) Then Invalid:=True
+Else
+If (247<=Bitmap) And (Bitmap<=252) Then Invalid:=True
+Else
+If (279<=Bitmap) And (Bitmap<=282) Then Invalid:=True
+Else
+If Bitmap=366 Then Invalid:=True
+Else
+If (463<=Bitmap) And (Bitmap<=470) Then Invalid:=True
+Else
+If (495<=Bitmap) And (Bitmap<=502) Then Invalid:=True
+Else
+If (527<=Bitmap) And (Bitmap<=564) Then Invalid:=True
+Else
+If (598<=Bitmap) And (Bitmap<=612) Then Invalid:=True
+Else
+If (646<=Bitmap) And (Bitmap<=658) Then Invalid:=True
+Else
+If (691<=Bitmap) And (Bitmap<=1410) Then Invalid:=True
+Else
+If (4376<=Bitmap) And (Bitmap<=4418) Then Invalid:=True;
+If Invalid Then
+ Begin
+ Writeln('.');
+ Write('Warning! The non-standard JIS ''83 Bitmap ',Bitmap,' encountered')
+ End
+End;
+
+Procedure GotBitmap(Var OutFile:OutFileType; EUC,Extended:Boolean;
+ Var InFile:InFileType; Var Scanning:ScanningType);
+{Handles Bitmap}
+{An error only stops the current pass to help the user determine its cause}
+{If desired, non-standard Bitmaps are pointed out in the first pass}
+Var Data2:Byte;
+Begin
+With Scanning Do
+ Begin
+ If First Then
+ {First character on line}
+ Begin
+ First:=False;
+ Comment:=False
+ End;
+ If EOF(InFile) Then
+ Begin
+ Done:=True;
+ Writeln('.');
+ If EUC Then Write(Chr(7)+'Incomplete EUC character pair..')
+ Else Write(Chr(7)+'Incomplete MS-kanji character pair..')
+ End
+ Else
+ Begin
+ Read(InFile,Data2);
+ If EUC Then
+ If ($A0<Data2) And (Data2<$FF) Then
+ Bitmap:=94*(Data1-$A1)+(Data2-$A1)+1
+ Else
+ Begin
+ Done:=True;
+ Writeln('.');
+ Write(Chr(7)+'Invalid EUC character pair..')
+ End
+ Else
+ If ( ($40<=Data2) And (Data2<=$7E) ) Or
+ ( ($80<=Data2) And (Data2<=$FC) )
+ Then
+ Begin
+ If (Data1>=$E0) Then Bitmap:=1+188*(Data1-$C1)
+ Else Bitmap:=1+188*(Data1-$81);
+ If (Data2>=$80) Then Bitmap:=Bitmap+(Data2-$41)
+ Else Bitmap:=Bitmap+(Data2-$40)
+ End
+ Else
+ Begin
+ Done:=True;
+ Writeln('.');
+ Write(Chr(7)+'Invalid MS-kanji character pair..')
+ End;
+ If Not Done Then
+ {Bitmaps in comment skipped}
+ If Comment Then
+ Begin
+ CommentLine:=CommentLine+Chr(Data1)+Chr(Data2);
+ If Echo Then Write(OutFile,Chr(Data1)+Chr(Data2))
+ End
+ Else
+ If (1<=Bitmap) And (Bitmap<=BitmapMax) Then
+ Begin
+ Found:=True;
+ {Point out non-standard Bitmaps in first pass}
+ If Not Echo And Not Extended Then ValidateBitmap(Bitmap)
+ End
+ Else
+ Begin
+ Done:=True;
+ Writeln('.');
+ Write(Chr(7)+'Bitmap ',Bitmap,' does not exist..')
+ End
+ End
+ End
+End;
+
+Procedure GotRoman(Var OutFile:OutFileType; ExtraSpace:Boolean;
+ Var Scanning:ScanningType);
+{Handles roman}
+{May add glue after the previous Bitmap and before this Roman}
+Begin
+With Scanning Do
+ Begin
+ If First Then
+ {First character on line}
+ Begin
+ First:=False;
+ If Chr(Data1)<>'%' Then Comment:=False
+ End;
+ If Comment Then CommentLine:=CommentLine+Chr(Data1)
+ Else
+ Begin
+ {Determine if this roman is a letter or a number}
+ WasLetter:=( ('A'<=UpCase(Chr(Data1))) And (UpCase(Chr(Data1))<='Z') ) Or
+ ( ('0'<=Chr(Data1)) And (Chr(Data1)<='9') );
+ If Immediate Then RomanBreak(OutFile,ExtraSpace,Scanning)
+ End;
+ If Echo Then Write(OutFile,Chr(Data1))
+ End
+End;
+
+Procedure GetBitmap(Var InFile:InFileType; Var OutFile:OutFileType;
+ Var Scanning:ScanningType; Var RunTime:RunTimeType);
+{Scans input file and stops when a Bitmap is met}
+{An error only stops the current pass to help the user determine its cause}
+{Accepts UNIX LF or DOS CR/LF as end of line indicator in input file}
+{Updates JemTeX parameters with run-time parameters}
+{Comment indicates the line is a comment line and does not break continuity}
+{Immediate indicates the current Bitmap immediately followed previous Bitmap}
+{If the next character encountered is Roman, glue may be inserted}
+{If desired, will add % at Japanese end of lines to preserve continuity}
+Begin
+With Scanning,RunTime Do
+ Begin
+ {No Bitmap found initially}
+ Found:=False;
+ {Assume the next character is a Bitmap}
+ WasLetter:=False;
+ Immediate:=True;
+ {Some non-comment Bitmap was met before or it's the first call to GetBitmap}
+ CommentLine:='';
+ {Comment holds; it's the first call ever to GetBitmap; it's first character}
+ {Comment fails; some non-comment Bitmap was met before; it isnt 1st character}
+ First:=Comment;
+ Repeat
+ {Check if file just finished}
+ If EOF(InFile) Then Done:=True
+ Else
+ {More file coming}
+ Begin
+ Read(InFile,Data1);
+ If Data1=$0A Then GotUNIX(OutFile,Scanning,RunTime)
+ Else
+ If Data1=$0D Then GotDOS(OutFile,Scanning,RunTime,InFile)
+ Else
+ If EUC Then
+ If ($A0<Data1) And (Data1<$FF) Then
+ GotBitmap(OutFile,EUC,Extended,InFile,Scanning)
+ Else
+ GotRoman(OutFile,ExtraSpace,Scanning)
+ Else
+ If ( ($81<=Data1) And (Data1<=$9F) ) Or
+ ( ($E0<=Data1) And (Data1<=$EA) )
+ Then
+ GotBitmap(OutFile,EUC,Extended,InFile,Scanning)
+ Else
+ GotRoman(OutFile,ExtraSpace,Scanning)
+ End
+ Until Done Or Found
+ End
+End;
+
+{---------------------------------- GetFont ----------------------------------}
+
+Procedure GetFont(Var InFile:InFileType; Var Fonts:FontsType;
+ Var InitialRunTime:RunTimeType);
+{Finds the Japanese fonts needed}
+Var
+ {Run time parameters}
+ RunTime:RunTimeType;
+ {Current font number}
+ FontPtr:FontRange;
+ SizePtr:SizeRange;
+ {Scanning information}
+ Scanning:ScanningType;
+ {Dummy since no output in first pass}
+ DummyOutFile:OutFileType;
+Begin
+RunTime:=InitialRunTime;
+{No Japanese font needed so far}
+For SizePtr:=1 To SizeMax Do
+ For FontPtr:=0 To FontMax Do
+ Fonts[SizePtr,FontPtr]:=False;
+With Scanning Do
+ Begin
+ {Not reached EOF yet}
+ Done:=False;
+ {No echo in first pass}
+ Echo:=False;
+ {Dummy since no output in first pass}
+ Immediate:=False;
+ WasLetter:=False;
+ RomanMajorEOL:=False;
+ RomanMinorEOL:=False;
+ RomanOpening:=False;
+ {Tell indirectly to GetBitmap that this is the first time it is called}
+ Comment:=True;
+ Repeat
+ {Get the next Bitmap skipping over [La]TeX comments}
+ GetBitmap(InFile,DummyOutFile,Scanning,RunTime);
+ If Not Done Then Fonts[RunTime.Size,Bitmap Div 128]:=True
+ Until Done
+ End;
+{Last state of LaTeX prevails for the second pass}
+InitialRunTime.LaTeX:=RunTime.LaTeX
+End;
+
+{----------------------------------- Header ----------------------------------}
+
+Procedure Header(Var OutFile:OutFileType; Var Fonts:FontsType; LaTeX:Boolean);
+{Writes [La]TeX header}
+{Fonts declared global for speed, even if never actually modified here}
+Var
+ FontPtr:FontRange;
+ SizePtr:SizeRange;
+ C0,C1,C2:Char;
+ Scale:Integer;
+Begin
+Writeln(OutFile,'\tracingstats=1');
+For SizePtr:=1 To SizeMax Do
+ Begin
+ C0:=Chr( Ord('a')+SizePtr-1 );
+ Case SizePtr Of
+ 1:Scale:=1000;
+ 2:Scale:=1095;
+ 3:Scale:=1200;
+ 4:Scale:=1440;
+ 5:Scale:=1728;
+ 6:Scale:=2074;
+ 7:Scale:=2488
+ End;
+ For FontPtr:=0 To FontMax Do
+ If Fonts[SizePtr,FontPtr] Then
+ Begin
+ C1:=Chr( Ord('a')+(FontPtr Div 8) );
+ C2:=Chr( Ord('a')+(FontPtr Mod 8) );
+ If LaTeX Then
+ Writeln(OutFile,'\newfont{\k'+C0+C1+C2+'}{kanji'+C1+C2+' scaled ',
+ Scale,'}')
+ Else
+ Writeln(OutFile,'\font\k'+C0+C1+C2+'=kanji'+C1+C2+' scaled ',Scale)
+ End
+ End;
+If LaTeX Then
+ Begin
+ Writeln(OutFile,'\newcommand{\kk}[2]{{#1\symbol{#2}}}');
+ Writeln(OutFile,'\newcommand{\hh}{\discretionary{}{}{}}');
+ Writeln(OutFile,'\newcommand{\ee}{\nobreak\hskip0pt plus.1em\relax}');
+ Writeln(OutFile,'\newcommand{\eee}{\nobreak\hskip.3em plus.1em\relax}');
+ Writeln(OutFile,'\newcommand{\eeee}{\nobreak\hskip.9em plus.1em minus.1em}')
+ End
+Else
+ Begin
+ Writeln(OutFile,'\def\kk#1#2{{#1\char#2}}');
+ Writeln(OutFile,'\def\hh{\discretionary{}{}{}}');
+ Writeln(OutFile,'\def\ee{\nobreak\hskip0pt plus.1em\relax}');
+ Writeln(OutFile,'\def\eee{\nobreak\hskip.3em plus.1em\relax}');
+ Writeln(OutFile,'\def\eeee{\nobreak\hskip.9em plus.1em minus.1em}')
+ End;
+Writeln(OutFile)
+End;
+
+{---------------------------------- Convert ----------------------------------}
+
+Procedure BitmapType(Bitmap:BitmapRange; Var Punctuation:PunctuationType);
+{Finds characteristics of current Bitmap}
+Begin
+With Punctuation Do
+ Begin
+ OldMajorEOL:=NewMajorEOL;
+ OldMinorEOL:=NewMinorEOL;
+ OldOpening:=NewOpening;
+ OldClosing:=NewClosing;
+ OldCenterDot:=NewCenterDot;
+ OldJapanese:=NewJapanese;
+ NewMajorEOL:=False;
+ NewMinorEOL:=False;
+ NewOpening:=False;
+ NewClosing:=False;
+ NewCenterDot:=False;
+ NewJapanese:=False;
+ {Full width .,!?}
+ If (2<=Bitmap) And (Bitmap<=5) Then NewMajorEOL:=True
+ Else
+ If (Bitmap=9) Or (Bitmap=10) Then NewMajorEOL:=True
+ Else
+ {Half width .,!?}
+ If (Bitmap=691) Or (Bitmap=720) Then NewMajorEOL:=True
+ Else
+ {Full width :;}
+ If (Bitmap=7) Or (Bitmap=8) Then NewMinorEOL:=True
+ Else
+ {Half width :;}
+ If (Bitmap=692) Or (Bitmap=693) Then NewMinorEOL:=True
+ Else
+ {Full width `"([< and other openings}
+ If (38<=Bitmap) And (Bitmap<=58) And Not Odd(Bitmap) Then NewOpening:=True
+ Else
+ {Half width `"([< and other openings}
+ If (696<=Bitmap)And(Bitmap<=716) And Not Odd(Bitmap) Then NewOpening:=True
+ Else
+ {Full width '")]> and other closings}
+ If (39<=Bitmap) And (Bitmap<=59) And Odd(Bitmap) Then NewClosing:=True
+ Else
+ {Half width '")]> and other closings}
+ If (697<=Bitmap) And (Bitmap<=717) And Odd(Bitmap) Then NewClosing:=True
+ Else
+ {Full width Japanese center dot}
+ If (Bitmap=6) Then NewCenterDot:=True
+ Else
+ {Half width Japanese center dot}
+ If (Bitmap=469) Then NewCenterDot:=True
+ Else
+ {Full width Hiragana}
+ If (283<=Bitmap) And (Bitmap<=365) Then NewJapanese:=True
+ Else
+ {Full width Katakana}
+ If (377<=Bitmap) And (Bitmap<=462) Then NewJapanese:=True
+ Else
+ {Full width Kanji level 1}
+ If (1411<=Bitmap) And (Bitmap<=4375) Then NewJapanese:=True
+ Else
+ {Full width Kanji level 2}
+ If (4419<=Bitmap) And (Bitmap<=7806) Then NewJapanese:=True
+ Else
+ {Script Hiragana}
+ If (753<=Bitmap) And (Bitmap<=835) Then NewJapanese:=True
+ Else
+ {Script Katakana}
+ If (847<=Bitmap) And (Bitmap<=932) Then NewJapanese:=True
+ End
+End;
+
+Procedure Hyphenate(Var OutFile:OutFileType; Var Punctuation:PunctuationType);
+{Adds hyphenation between consecutive Bitmaps}
+Begin
+With Punctuation Do
+ {No hyphenation between two odd symbols}
+ If OldJapanese Or NewJapanese Then
+ {No hyphenation before some symbols}
+ If Not NewMajorEOL And Not NewMinorEOL And Not NewCenterDot And
+ Not NewClosing
+ Then
+ {No hyphenation after some symbols}
+ If Not OldOpening Then Write(OutFile,'\hh')
+End;
+
+Procedure Glue(Var OutFile:OutFileType; Var Punctuation:PunctuationType;
+ ExtraSpace:Boolean);
+{Adds glue between consecutive Bitmaps}
+Var GlueAdded:Boolean;
+Begin
+With Punctuation Do
+ Begin
+ GlueAdded:=False;
+ If ExtraSpace Then
+ Begin
+ {Trying to add big glue}
+ If OldMajorEOL Then
+ {No big glue between identical symbols}
+ If Not NewMajorEOL Then
+ {No big glue before some symbols}
+ If Not NewClosing Then
+ Begin
+ GlueAdded:=True;
+ Write(OutFile,'\eeee')
+ End;
+ If Not GlueAdded Then
+ {Trying to add medium glue based on old symbol}
+ If OldMinorEOL Or OldCenterDot Or OldClosing Then
+ {No medium glue before some symbols}
+ If Not NewMajorEOL And Not NewMinorEOL And Not NewClosing Then
+ Begin
+ GlueAdded:=True;
+ Write(OutFile,'\eee')
+ End;
+ If Not GlueAdded Then
+ {Trying to add medium glue based on new symbol}
+ If NewCenterDot Or NewOpening Then
+ {No medium glue after some symbols}
+ If Not OldOpening Then
+ Begin
+ GlueAdded:=True;
+ Write(OutFile,'\eee')
+ End
+ End;
+ {Always make sure to add some glue}
+ If Not GlueAdded Then Write(OutFile,'\ee')
+ End
+End;
+
+Procedure Convert(Var InFile:InFileType; Var OutFile:OutFileType;
+ Var RunTime:RunTimeType);
+{Convert .JEM into .TeX by translating Bitmaps and adding hyphenation and glue}
+Var
+ {Japanese punctuation information}
+ Punctuation:PunctuationType;
+ {Scanning information}
+ Scanning:ScanningType;
+ {Current font number}
+ FontPtr:FontRange;
+ C0,C1,C2:Char;
+Begin
+With Punctuation,Scanning,RunTime Do
+ Begin
+ {Not reached EOF yet}
+ Done:=False;
+ {Echo in second pass}
+ Echo:=True;
+ {Nothing done yet}
+ Immediate:=False;
+ WasLetter:=False;
+ {Tell indirectly to GetBitmap that this is the first time it is called}
+ Comment:=True;
+ {Initial japanese punctuation information}
+ NewMajorEOL:=False; NewMinorEOL:=False;
+ NewOpening:=False; NewClosing:=False;
+ NewCenterDot:=False; NewJapanese:=False;
+ Repeat
+ {Set up scanning information in case a roman letter follows immediately}
+ RomanMajorEOL:=NewMajorEOL;
+ RomanMinorEOL:=NewMinorEOL Or NewCenterDot Or NewClosing;
+ RomanOpening:=NewOpening;
+ {Get the next Bitmap skipping over [La]TeX comments}
+ {May add glue between the old Bitmap and an hypothetical Roman}
+ GetBitmap(InFile,OutFile,Scanning,RunTime);
+ If Not Done Then
+ Begin
+ {Find what kind of Bitmap it is}
+ BitmapType(Bitmap,Punctuation);
+ If Immediate Then
+ {Add hyphenation and glue between consecutive Bitmaps}
+ Begin
+ Hyphenate(OutFile,Punctuation);
+ Glue(OutFile,Punctuation,ExtraSpace)
+ End
+ Else
+ {Add glue after the old Roman and before this new Bitmap}
+ If ExtraSpace Then
+ If NewCenterDot Or NewOpening Then Write(OutFile,'\eee')
+ Else
+ If WasLetter Then
+ {No medium glue before some symbols}
+ If Not NewMajorEOL And Not NewMinorEOL And Not NewClosing Then
+ Write(OutFile,'\eee');
+ {Write the Bitmap}
+ C0:=Chr( Ord('a')+Size-1 );
+ FontPtr:=Bitmap Div 128;
+ C1:=Chr( Ord('a')+(FontPtr Div 8) );
+ C2:=Chr( Ord('a')+(FontPtr Mod 8) );
+ Write(OutFile,'\kk{\k'+C0+C1+C2+'}{',Bitmap Mod 128,'}')
+ {The next character may be Roman, GetBitmap will handle the glue then}
+ End
+ Until Done
+ End
+End;
+
+{------------------------------------ Main -----------------------------------}
+
+Begin
+Writeln;
+Writeln('Japanese to [La]TeX Conversion Program.'); {To make Borland happy}
+Writeln('Version 2.00 Copyright F. Jalbert 1991.');
+Writeln;
+
+
+GetParameters(RunTime);
+Writeln;
+Write('Opening Japanese file '+RunTime.FileName);
+OpenFile(InFile,RunTime);
+Writeln('.');
+If RunTime.LaTeX Then Write('Creating LaTeX file '+RunTime.FileName+'.tex')
+Else Write('Creating TeX file '+RunTime.FileName+'.tex');
+Assign(OutFile,RunTime.FileName+'.tex');
+Rewrite(OutFile);
+Writeln('.');
+Writeln;
+
+
+Write('Scanning Japanese file for fonts');
+GetFont(InFile,Fonts,RunTime);
+Reset(InFile);
+Writeln('.');
+If RunTime.LaTeX Then Write('Writing LaTeX header')
+Else Write('Writing TeX header');
+Header(OutFile,Fonts,RunTime.LaTeX);
+Writeln('.');
+Write('Converting Japanese file');
+Convert(InFile,OutFile,RunTime);
+Writeln('.');
+Writeln;
+
+
+Write('Closing Japanese file '+RunTime.FileName+RunTime.Extension);
+Close(InFile);
+Writeln('.');
+If RunTime.LaTeX Then Write('Closing LaTeX file '+RunTime.FileName+'.tex')
+Else Write('Closing TeX file '+RunTime.FileName+'.tex');
+Close(OutFile);
+Writeln('.');
+Writeln;
+
+
+Writeln('Japanese to [La]TeX conversion completed.');
+Writeln
+End.
diff --git a/systems/msdos/jemtex2/jguide.tex b/systems/msdos/jemtex2/jguide.tex
new file mode 100644
index 0000000000..7a8b848213
--- /dev/null
+++ b/systems/msdos/jemtex2/jguide.tex
@@ -0,0 +1,3660 @@
+%
+% Process this file twice with big LaTeX. Does not rely on any japanese font.
+%
+\typeout{}
+\typeout{Japanese [La]TeX for DOS User's Guide Version 2.00 <14 April 1991>}
+\typeout{Note: Run big LaTeX two times to resolve cross-references.}
+\typeout{Warning: This guide requires approximately 120Kb of memory to process.}
+\typeout{}
+
+\hyphenation{jap-a-nese}
+
+\def\LLaTeX{{\rm \raise.2ex\hbox{[}\kern-.05em L\kern-.38em\raise.35ex%
+\hbox{\lowercase{a}}\kern-.05em\raise.2ex\hbox{]}\kern-.1em T%
+\kern-.1667em\lower.7ex\hbox{E}\kern-.125em X}}
+\def\MuTeX{{\rm M\kern-.15em\raise.2ex\hbox{\lowercase{u}}\kern-.32em T%
+\kern-.1667em\lower.5ex\hbox{E}\kern-.125em X}}
+\def\emTeX{{\rm {\it{em}}\kern-.15em T%
+\kern-.1667em\lower.5ex\hbox{E}\kern-.125em X}}
+\def\JemTeX{{\rm J\kern-.2em {\it{em}}\kern-.15em T%
+\kern-.1667em\lower.5ex\hbox{E}\kern-.125em X}}
+\def\MFT{{\small\rm METAFONT}}
+
+\documentstyle[12pt]{article}
+\pagestyle{plain}
+\begin{document}
+
+\title{Japanese \LLaTeX\ for DOS \\
+ - User's Guide - \\
+ {\small (Version 2.00)}}
+\author{Fran\c cois Jalbert}
+\date{14 April 1991}
+\maketitle
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\section{Introduction}
+\typeout{1 Introduction}
+\label{introduction}
+
+Welcome to \JemTeX\ Version~2.00, a simple system to typeset japanese using any
+standard version of \TeX\ running under DOS. All you need to create your own
+japanese fonts using \MFT\ is included. A preprocessor is also supplied which
+will turn the output of your favorite japanese text editor into a standard
+\TeX\ document ready for processing.
+
+This guide is divided into four main sections:
+\begin{description}
+ \item[Introduction:] Preliminary remarks (page~\pageref{introduction}).
+ \item[Japanese Fonts:] The \JemTeX\ fonts (page~\pageref{japanesefonts}).
+ \item[The \LLaTeX\ Interface:] The \JemTeX\ preprocessor
+ (page~\pageref{thelatexinterface}).
+ \item[JemTeX Quick Reference:] Items often referred to
+ (page~\pageref{jemtexquickreference}).
+\end{description}
+
+\subsection{Why \JemTeX}
+\label{whyjemtex}
+
+Shortly after adopting japanese as my new hobby, I felt the need to compile my
+own small dictionaries and to keep a computer record of all the letters I sent
+to my friends in Japan. These japanese documents would, of course, be produced
+on my DOS computer. I was also typesetting japanese music with \MuTeX, and I
+really wanted to write the lyrics using japanese characters rather than the
+roman ones I was currently constrained to use.
+
+Luckily I had \mbox{USENET} access, and in early 1990 I came across Mr.\ Mark
+Edward's MOKE~(1.1+) japanese text editor. It supported the most popular
+graphics displays, it had all the japanese characters a novice like me would
+ever need, it had extensive indexes to find the correct kanjis for any given
+word, and it even supported my \mbox{EPSON} printer. I FTP'ed a copy for
+myself and arranged to have it made available in T\=oky\=o at utsun
+(133.11.11.11) for FTP as well.
+
+Unfortunately, MOKE's quality of output left much to be desired on my
+\mbox{9-pin} printer, and MOKE did not have the fancy capabilities of \LaTeX. I
+decided to look into public domain japanese versions of \LaTeX\ for DOS
+computers. A query on \mbox{USENET} news triggered a long series of
+\mbox{e-mail} exchanges. In a nutshell, the news was bad.
+
+First, I could not locate any \MFT\ code to generate the 240~DPI by 216~DPI
+fonts needed by my previewing and printing devices. It was out of the question
+for me to even think about writing my own \MFT\ code for the thousands of
+characters involved in japanese. I did find some 300~DPI public domain fonts,
+but they were useless to me. I was told many japanese printers have built-in
+fonts, which could explain the lack of public domain external ones.
+
+There was also a serious possibility that loading many fonts might cause any
+small implementation of \TeX\ to run out of memory. This was a problem
+especially for DOS machines limited for historical reasons to 640~Kb of main
+memory. I needed a \TeX\ with some sort of memory paging system for my big
+RAM~disk. This problem was solved with Mr.\ Eberhard Mattes' \emTeX\ for DOS.
+Its capacity seemed limited solely by \TeX's internal design.
+
+I could not find any macros to enter japanese using standard \LaTeX. I did
+come across J\TeX\ and \mbox{ASCII-j\TeX}. However, both required that I build
+my own \TeX\ source in C, using exotic tools like WEB and \mbox{TANGLE}. Even
+if I ever managed eventually to get some usable C~code, it would not compile
+into something very useful because of the 640~Kb main memory limitation of DOS.
+It would be necessary to modify the C~code by adding the paging system to it. I
+knew nothing of \TeX's internal working. How could I decide correctly which
+information should be paged and which should remain in memory at all time? I
+decided that adapting J\TeX\ or \mbox{ASCII-j\TeX}\ to DOS appeared too
+uncertain and time-consuming.
+
+My situation could be summarized as follows. I had a simple japanese text
+editor I could use to enter both english and japanese, and I had a big
+implementation of \TeX\ which would not crash if I remained reasonable. But I
+lacked japanese fonts and macros to put it all together. The remainder of this
+brief guide explains how I solved these two problems.
+
+I call my japanese system \JemTeX. Anybody with a japanese text editor and
+\emTeX, or any equivalent implementation of \TeX\ and \MFT, can now produce
+simple, but acceptable japanese documents with his DOS computer. Following the
+release of the first two versions, people from all over the world expressed
+their satisfaction. There is no doubt in my mind that there was a real need for
+\JemTeX.
+
+\begin{quote}
+ \begin{em}
+ \JemTeX\ is free for all to use and modify. Please feel free to distribute
+ unmodified copies of it. If you should use parts of\/ \JemTeX, or some of my
+ ideas in your work, a reference to \JemTeX\ would be appreciated.
+ \end{em}
+\end{quote}
+
+\subsection{\JemTeX\ Files}
+\label{jemtexfiles}
+
+\JemTeX\ is distributed compressed with Version~1.1 of the \verb"PKZIP"
+utility of PKWARE Inc. You should have received the following file:
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+JEMTEX2 ZIP 440435 4-14-91 12:00p
+\end{verbatim}
+\end{quote}
+
+Unpacking should yield the following files:
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+JIS24 562032 4-14-91 12:00p
+JIS2MF C 37598 4-14-91 12:00p
+JIS2MF PAS 33242 4-14-91 12:00p
+JIS2MF EXE 12181 4-14-91 12:00p
+JEM2TEX C 47627 4-14-91 12:00p
+JEM2TEX PAS 40635 4-14-91 12:00p
+JEM2TEX EXE 14203 4-14-91 12:00p
+FONTABLE C 5814 4-14-91 12:00p
+FONTABLE PAS 4475 4-14-91 12:00p
+FONTABLE EXE 4905 4-14-91 12:00p
+JGUIDE TEX 175442 4-14-91 12:00p
+\end{verbatim}
+\end{quote}
+All these files will be covered in time in this brief guide.
+
+I supply you with the fastest utilities possible at the moment, which are
+sometime C versions, sometime Pascal versions. The programs compile fine with
+recent DOS turbo compilers and UNIX gcc. Note that the executables are also
+compressed with the \verb"LZEXE" utility of Mr.\ Fabrice Bellard. The
+decompression automatically occurs at runtime.
+
+\subsection{Author's Address}
+\label{authorsaddress}
+
+There is still a lot I do not understand about \LLaTeX\ and, especially,
+japanese. I apologize in advance for my errors. If you have any comments, or
+simply wish to be put on my mailing list, do not hesitate to contact the
+author:
+
+\begin{quote}
+Fran\c cois Jalbert \\
+220 Forest \\
+Ch\^ateauguay, QC \\
+CANADA \\
+J6J 1R1 \\
+\verb"jalbert@CS.UBC.CA" \\
+\verb"jalbert@IRO.UMontreal.CA"
+\end{quote}
+
+\subsection{Acknowledgments}
+\label{acknowledgments}
+
+I would like to take this opportunity to thank all the people who helped me in
+this quest for knowledge, especially Mr.\ Takafumi Sakurai who is very familiar
+with J\TeX. Finally, I must also thank all the users who helped to improve this
+package with their comments. Keep them coming! In fact, Version~2.00 would not
+have been possible without Mr.\ Masatoshi Watanabe, the author of JaWa\TeX. I
+am greatly grateful to him for his contribution to my \verb"JIS2MF" program.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\section{Japanese Fonts}
+\typeout{2 Japanese Fonts}
+\label{japanesefonts}
+
+In this section, I describe how I solved the font problem. I first introduce
+the JIS~24 dot font which is the key behind the \JemTeX\ fonts. A discussion of
+horizontal and vertical writing styles then becomes essential since writing
+style influences the ideal characteristics of a font. I conclude the first part
+of this section by explaining how to run my \verb"JIS2MF" \MFT\ code generation
+program and \MFT\ itself.
+
+I include a few more technical details in the second part of this section.
+Strictly speaking, this information is not mandatory and the reader in a hurry
+will do well to simply skip it. But the inquiring one will have a chance to
+take a closer look at the \MFT\ code generated and at the underlying algorithm.
+
+\subsection{The JIS~24 Dot Font}
+\label{thejis24dotfont}
+
+The font problem is solved using the JIS~24 dot font of Mr.\ Yasuki Saito. It
+is a series of 24~by~24 bitmaps organized sequentially. There is room for
+7806~bitmaps in the file \verb"JIS24", but several bitmaps are simply left
+empty in the current version.
+
+\label{standard}
+
+The JIS~'83 standard states which characters are defined in the JIS~24 dot font
+and what position they occupy. However, several computer manufacturers have
+taken the liberty of defining their own additional 24~by~24 bitmaps which they
+place here and there at locations currently left empty by JIS~'83. The
+resulting {\em extended\/} JIS~24 dot fonts exist in many different
+incompatible versions.
+
+\label{extended}
+
+\JemTeX\ uses such an extended JIS~24 dot font. I do not know who is
+responsible for its extension, but I certainly welcome the extra characters.
+Besides a wealth of miscellaneous characters, a complete half-width roman and
+japanese character set is available. You may choose to use them, or to restrict
+yourself to standard JIS~'83 characters only.
+
+No doubt one can mechanize the creation of fonts from such bitmaps. There seems
+to be two ways of handling the problem. First, one could generate fonts
+directly from the bitmaps without using \MFT\ at all. Indeed, I know that
+several fonts in J\TeX\ were created just that way. However, I suspect that it
+might be difficult to scale fonts using non-integer factors. To further
+complicate the scaling problem, my devices do not have the same horizontal and
+vertical resolution. Besides, I feel that \MFT\ can deal with such scaling
+issues better than I probably can in a mere few days of work.
+
+Consequently, I prefer to create \MFT\ code out of the bitmaps. A good example
+of such an approach is the \verb"ega2mf" program of Mr.\ Thomas B.\ Ridgeway.
+This program reads bitmaps and creates \MFT\ code where each character is a
+small matrix of dots. The purpose of such fonts is to mimic the looks of
+CRT~screens on paper. This is does so well that in fact, I find that the
+japanese characters look too much like bitmaps! I want these dots to disappear
+and a continuous outline to replace them. Nevertheless, \verb"ega2mf" clearly
+demonstrates that the goal can be reached.
+
+I started from scratch, using a \MFT\ book and came up with my own \MFT\ code
+generation program \verb"JIS2MF". It reads bitmaps from \verb"JIS24", and it
+then constructs continuous characters, using squares, triangles, and quarter
+circles. My program has been substantially improved by Mr.\ Masatoshi Watanabe.
+A complete description is found in Subsections~\ref{themetafontcode}
+and~\ref{algorithm}.
+
+\subsection{Writing Styles}
+\label{writingstyles}
+
+It is clear from the lack of a vertical baseline in \MFT\ that \TeX\ was solely
+designed for horizontal use. Indeed, \TeX\ can typeset japanese horizontally as
+well as it does for english. This does not imply that vertical use of \TeX\ is
+impossible, but it merely suggests that extra care will be required. In this
+subsection, I would like to discuss and compare both writing styles. The
+appropriate font properties can then be determined.
+
+\label{widthheight}
+
+The first features of interest in this subsection are character width,
+character height, and distance from the baseline. Consider first a few roman
+characters and their horizontal baseline:
+\begin{center}
+ \setlength{\unitlength}{0.4pt}
+ \begin{picture}(80,30)
+ \thinlines
+ \put(0,5){\line(1,0){80}}
+ \put(0,0){\makebox(80,30){dip}}
+ \end{picture}
+\end{center}
+
+The width of each character is minimized and this is important in english
+writing. However, the height of each character is unimportant. It is the
+vertical relationship between the character and its horizontal baseline which
+matters.
+
+Consider now a few japanese characters and their horizontal baseline:
+\begin{center}
+ \setlength{\unitlength}{0.4pt}
+ \newsavebox{\watashi}
+ \sbox{\watashi}{%
+ \begin{picture}(28,26)(-2,-2)%Bitmap 2512
+ \put(0.5,4.5){\circle*{1}}\put(0.5,15.5){\circle*{1}}
+ \put(0.5,19.5){\circle*{1}}\put(1.5,5.5){\circle*{1}}
+ \put(1.5,15.5){\circle*{1}}\put(1.5,19.5){\circle*{1}}
+ \put(2.5,6.5){\circle*{1}}\put(2.5,7.5){\circle*{1}}
+ \put(2.5,15.5){\circle*{1}}\put(2.5,19.5){\circle*{1}}
+ \put(3.5,7.5){\circle*{1}}\put(3.5,8.5){\circle*{1}}
+ \put(3.5,9.5){\circle*{1}}\put(3.5,15.5){\circle*{1}}
+ \put(3.5,20.5){\circle*{1}}\put(4.5,9.5){\circle*{1}}
+ \put(4.5,10.5){\circle*{1}}\put(4.5,11.5){\circle*{1}}
+ \put(4.5,12.5){\circle*{1}}\put(4.5,15.5){\circle*{1}}
+ \put(4.5,20.5){\circle*{1}}\put(5.5,0.5){\circle*{1}}
+ \put(5.5,1.5){\circle*{1}}\put(5.5,2.5){\circle*{1}}
+ \put(5.5,3.5){\circle*{1}}\put(5.5,4.5){\circle*{1}}
+ \put(5.5,5.5){\circle*{1}}\put(5.5,6.5){\circle*{1}}
+ \put(5.5,7.5){\circle*{1}}\put(5.5,8.5){\circle*{1}}
+ \put(5.5,9.5){\circle*{1}}\put(5.5,10.5){\circle*{1}}
+ \put(5.5,11.5){\circle*{1}}\put(5.5,12.5){\circle*{1}}
+ \put(5.5,13.5){\circle*{1}}\put(5.5,14.5){\circle*{1}}
+ \put(5.5,15.5){\circle*{1}}\put(5.5,16.5){\circle*{1}}
+ \put(5.5,17.5){\circle*{1}}\put(5.5,18.5){\circle*{1}}
+ \put(5.5,19.5){\circle*{1}}\put(5.5,20.5){\circle*{1}}
+ \put(6.5,0.5){\circle*{1}}\put(6.5,1.5){\circle*{1}}
+ \put(6.5,2.5){\circle*{1}}\put(6.5,3.5){\circle*{1}}
+ \put(6.5,4.5){\circle*{1}}\put(6.5,5.5){\circle*{1}}
+ \put(6.5,6.5){\circle*{1}}\put(6.5,7.5){\circle*{1}}
+ \put(6.5,8.5){\circle*{1}}\put(6.5,9.5){\circle*{1}}
+ \put(6.5,10.5){\circle*{1}}\put(6.5,11.5){\circle*{1}}
+ \put(6.5,12.5){\circle*{1}}\put(6.5,13.5){\circle*{1}}
+ \put(6.5,14.5){\circle*{1}}\put(6.5,15.5){\circle*{1}}
+ \put(6.5,16.5){\circle*{1}}\put(6.5,17.5){\circle*{1}}
+ \put(6.5,18.5){\circle*{1}}\put(6.5,19.5){\circle*{1}}
+ \put(6.5,20.5){\circle*{1}}\put(6.5,21.5){\circle*{1}}
+ \put(7.5,11.5){\circle*{1}}\put(7.5,15.5){\circle*{1}}
+ \put(7.5,21.5){\circle*{1}}\put(8.5,11.5){\circle*{1}}
+ \put(8.5,15.5){\circle*{1}}\put(8.5,21.5){\circle*{1}}
+ \put(8.5,22.5){\circle*{1}}\put(9.5,2.5){\circle*{1}}
+ \put(9.5,10.5){\circle*{1}}\put(9.5,15.5){\circle*{1}}
+ \put(9.5,16.5){\circle*{1}}\put(9.5,22.5){\circle*{1}}
+ \put(9.5,23.5){\circle*{1}}\put(10.5,0.5){\circle*{1}}
+ \put(10.5,1.5){\circle*{1}}\put(10.5,2.5){\circle*{1}}
+ \put(10.5,8.5){\circle*{1}}\put(10.5,9.5){\circle*{1}}
+ \put(10.5,10.5){\circle*{1}}\put(10.5,15.5){\circle*{1}}
+ \put(10.5,16.5){\circle*{1}}\put(10.5,22.5){\circle*{1}}
+ \put(10.5,23.5){\circle*{1}}\put(11.5,1.5){\circle*{1}}
+ \put(11.5,2.5){\circle*{1}}\put(11.5,8.5){\circle*{1}}
+ \put(11.5,9.5){\circle*{1}}\put(11.5,15.5){\circle*{1}}
+ \put(11.5,22.5){\circle*{1}}\put(12.5,1.5){\circle*{1}}
+ \put(12.5,2.5){\circle*{1}}\put(13.5,1.5){\circle*{1}}
+ \put(13.5,2.5){\circle*{1}}\put(13.5,3.5){\circle*{1}}
+ \put(13.5,4.5){\circle*{1}}\put(14.5,2.5){\circle*{1}}
+ \put(14.5,5.5){\circle*{1}}\put(14.5,6.5){\circle*{1}}
+ \put(14.5,7.5){\circle*{1}}\put(14.5,8.5){\circle*{1}}
+ \put(15.5,2.5){\circle*{1}}\put(15.5,7.5){\circle*{1}}
+ \put(15.5,8.5){\circle*{1}}\put(15.5,9.5){\circle*{1}}
+ \put(15.5,10.5){\circle*{1}}\put(15.5,11.5){\circle*{1}}
+ \put(15.5,12.5){\circle*{1}}\put(15.5,13.5){\circle*{1}}
+ \put(15.5,14.5){\circle*{1}}\put(15.5,15.5){\circle*{1}}
+ \put(16.5,2.5){\circle*{1}}\put(16.5,11.5){\circle*{1}}
+ \put(16.5,12.5){\circle*{1}}\put(16.5,13.5){\circle*{1}}
+ \put(16.5,14.5){\circle*{1}}\put(16.5,15.5){\circle*{1}}
+ \put(16.5,16.5){\circle*{1}}\put(16.5,17.5){\circle*{1}}
+ \put(16.5,18.5){\circle*{1}}\put(16.5,19.5){\circle*{1}}
+ \put(16.5,20.5){\circle*{1}}\put(16.5,21.5){\circle*{1}}
+ \put(16.5,22.5){\circle*{1}}\put(16.5,23.5){\circle*{1}}
+ \put(17.5,2.5){\circle*{1}}\put(17.5,16.5){\circle*{1}}
+ \put(17.5,17.5){\circle*{1}}\put(17.5,18.5){\circle*{1}}
+ \put(17.5,19.5){\circle*{1}}\put(17.5,20.5){\circle*{1}}
+ \put(17.5,21.5){\circle*{1}}\put(17.5,22.5){\circle*{1}}
+ \put(18.5,3.5){\circle*{1}}\put(18.5,22.5){\circle*{1}}
+ \put(19.5,3.5){\circle*{1}}\put(19.5,7.5){\circle*{1}}
+ \put(20.5,3.5){\circle*{1}}\put(20.5,5.5){\circle*{1}}
+ \put(20.5,6.5){\circle*{1}}\put(21.5,3.5){\circle*{1}}
+ \put(21.5,4.5){\circle*{1}}\put(21.5,5.5){\circle*{1}}
+ \put(22.5,0.5){\circle*{1}}\put(22.5,1.5){\circle*{1}}
+ \put(22.5,2.5){\circle*{1}}\put(22.5,3.5){\circle*{1}}
+ \put(22.5,4.5){\circle*{1}}\put(23.5,0.5){\circle*{1}}
+ \put(23.5,1.5){\circle*{1}}\put(23.5,2.5){\circle*{1}}
+ \end{picture}}
+ \begin{picture}(250,28)
+ \thinlines
+ \put(0,0){\line(1,0){250}}
+ \put(20,0){%
+ \begin{picture}(28,26)(-2,-2)%Bitmap 288
+ \put(5.5,15.5){\circle*{1}}\put(6.5,13.5){\circle*{1}}
+ \put(6.5,14.5){\circle*{1}}\put(7.5,13.5){\circle*{1}}
+ \put(7.5,14.5){\circle*{1}}\put(8.5,1.5){\circle*{1}}
+ \put(8.5,14.5){\circle*{1}}\put(9.5,1.5){\circle*{1}}
+ \put(9.5,14.5){\circle*{1}}\put(9.5,15.5){\circle*{1}}
+ \put(9.5,23.5){\circle*{1}}\put(10.5,1.5){\circle*{1}}
+ \put(10.5,15.5){\circle*{1}}\put(10.5,23.5){\circle*{1}}
+ \put(11.5,2.5){\circle*{1}}\put(11.5,15.5){\circle*{1}}
+ \put(11.5,16.5){\circle*{1}}\put(11.5,22.5){\circle*{1}}
+ \put(12.5,2.5){\circle*{1}}\put(12.5,16.5){\circle*{1}}
+ \put(12.5,22.5){\circle*{1}}\put(13.5,3.5){\circle*{1}}
+ \put(13.5,16.5){\circle*{1}}\put(13.5,21.5){\circle*{1}}
+ \put(13.5,22.5){\circle*{1}}\put(14.5,3.5){\circle*{1}}
+ \put(14.5,4.5){\circle*{1}}\put(14.5,16.5){\circle*{1}}
+ \put(14.5,20.5){\circle*{1}}\put(14.5,21.5){\circle*{1}}
+ \put(15.5,4.5){\circle*{1}}\put(15.5,5.5){\circle*{1}}
+ \put(15.5,6.5){\circle*{1}}\put(15.5,15.5){\circle*{1}}
+ \put(15.5,20.5){\circle*{1}}\put(15.5,21.5){\circle*{1}}
+ \put(16.5,5.5){\circle*{1}}\put(16.5,6.5){\circle*{1}}
+ \put(16.5,7.5){\circle*{1}}\put(16.5,8.5){\circle*{1}}
+ \put(16.5,9.5){\circle*{1}}\put(16.5,10.5){\circle*{1}}
+ \put(16.5,11.5){\circle*{1}}\put(16.5,12.5){\circle*{1}}
+ \put(16.5,13.5){\circle*{1}}\put(16.5,14.5){\circle*{1}}
+ \put(17.5,7.5){\circle*{1}}\put(17.5,8.5){\circle*{1}}
+ \put(17.5,9.5){\circle*{1}}\put(17.5,10.5){\circle*{1}}
+ \put(17.5,11.5){\circle*{1}}\put(17.5,12.5){\circle*{1}}
+ \put(17.5,13.5){\circle*{1}}
+ \end{picture}}
+ \put(50,0){\usebox{\watashi}}
+ \put(80,0){%
+ \begin{picture}(28,26)(-2,-2)%Bitmap 356
+ \put(6.5,10.5){\circle*{1}}\put(6.5,11.5){\circle*{1}}
+ \put(6.5,12.5){\circle*{1}}\put(6.5,13.5){\circle*{1}}
+ \put(6.5,14.5){\circle*{1}}\put(6.5,15.5){\circle*{1}}
+ \put(6.5,16.5){\circle*{1}}\put(6.5,17.5){\circle*{1}}
+ \put(6.5,22.5){\circle*{1}}\put(6.5,23.5){\circle*{1}}
+ \put(7.5,9.5){\circle*{1}}\put(7.5,10.5){\circle*{1}}
+ \put(7.5,11.5){\circle*{1}}\put(7.5,12.5){\circle*{1}}
+ \put(7.5,13.5){\circle*{1}}\put(7.5,14.5){\circle*{1}}
+ \put(7.5,15.5){\circle*{1}}\put(7.5,16.5){\circle*{1}}
+ \put(7.5,17.5){\circle*{1}}\put(7.5,18.5){\circle*{1}}
+ \put(7.5,19.5){\circle*{1}}\put(7.5,20.5){\circle*{1}}
+ \put(7.5,21.5){\circle*{1}}\put(7.5,22.5){\circle*{1}}
+ \put(8.5,14.5){\circle*{1}}\put(8.5,15.5){\circle*{1}}
+ \put(9.5,16.5){\circle*{1}}\put(9.5,17.5){\circle*{1}}
+ \put(10.5,0.5){\circle*{1}}\put(10.5,18.5){\circle*{1}}
+ \put(10.5,19.5){\circle*{1}}\put(11.5,0.5){\circle*{1}}
+ \put(11.5,20.5){\circle*{1}}\put(12.5,1.5){\circle*{1}}
+ \put(12.5,21.5){\circle*{1}}\put(13.5,1.5){\circle*{1}}
+ \put(13.5,2.5){\circle*{1}}\put(13.5,21.5){\circle*{1}}
+ \put(14.5,2.5){\circle*{1}}\put(14.5,3.5){\circle*{1}}
+ \put(14.5,21.5){\circle*{1}}\put(15.5,3.5){\circle*{1}}
+ \put(15.5,4.5){\circle*{1}}\put(15.5,5.5){\circle*{1}}
+ \put(15.5,20.5){\circle*{1}}\put(15.5,21.5){\circle*{1}}
+ \put(16.5,4.5){\circle*{1}}\put(16.5,5.5){\circle*{1}}
+ \put(16.5,6.5){\circle*{1}}\put(16.5,7.5){\circle*{1}}
+ \put(16.5,8.5){\circle*{1}}\put(16.5,18.5){\circle*{1}}
+ \put(16.5,19.5){\circle*{1}}\put(16.5,20.5){\circle*{1}}
+ \put(17.5,6.5){\circle*{1}}\put(17.5,7.5){\circle*{1}}
+ \put(17.5,8.5){\circle*{1}}\put(17.5,9.5){\circle*{1}}
+ \put(17.5,10.5){\circle*{1}}\put(17.5,11.5){\circle*{1}}
+ \put(17.5,12.5){\circle*{1}}\put(17.5,13.5){\circle*{1}}
+ \put(17.5,14.5){\circle*{1}}\put(17.5,15.5){\circle*{1}}
+ \put(17.5,16.5){\circle*{1}}\put(17.5,17.5){\circle*{1}}
+ \put(17.5,18.5){\circle*{1}}\put(17.5,19.5){\circle*{1}}
+ \put(18.5,9.5){\circle*{1}}\put(18.5,10.5){\circle*{1}}
+ \put(18.5,11.5){\circle*{1}}\put(18.5,12.5){\circle*{1}}
+ \put(18.5,13.5){\circle*{1}}\put(18.5,14.5){\circle*{1}}
+ \put(18.5,15.5){\circle*{1}}\put(18.5,16.5){\circle*{1}}
+ \put(18.5,17.5){\circle*{1}}
+ \end{picture}}
+ \put(110,0){\usebox{\watashi}}
+ \put(140,0){%
+ \begin{picture}(28,26)(-2,-2)%Bitmap 2146
+ \put(1.5,0.5){\circle*{1}}\put(2.5,0.5){\circle*{1}}
+ \put(3.5,1.5){\circle*{1}}\put(4.5,2.5){\circle*{1}}
+ \put(4.5,3.5){\circle*{1}}\put(5.5,3.5){\circle*{1}}
+ \put(5.5,4.5){\circle*{1}}\put(5.5,5.5){\circle*{1}}
+ \put(5.5,6.5){\circle*{1}}\put(6.5,5.5){\circle*{1}}
+ \put(6.5,6.5){\circle*{1}}\put(6.5,7.5){\circle*{1}}
+ \put(6.5,8.5){\circle*{1}}\put(6.5,9.5){\circle*{1}}
+ \put(6.5,10.5){\circle*{1}}\put(6.5,11.5){\circle*{1}}
+ \put(6.5,12.5){\circle*{1}}\put(6.5,13.5){\circle*{1}}
+ \put(6.5,14.5){\circle*{1}}\put(6.5,15.5){\circle*{1}}
+ \put(6.5,16.5){\circle*{1}}\put(6.5,17.5){\circle*{1}}
+ \put(6.5,18.5){\circle*{1}}\put(6.5,19.5){\circle*{1}}
+ \put(6.5,20.5){\circle*{1}}\put(6.5,21.5){\circle*{1}}
+ \put(6.5,22.5){\circle*{1}}\put(6.5,23.5){\circle*{1}}
+ \put(7.5,7.5){\circle*{1}}\put(7.5,8.5){\circle*{1}}
+ \put(7.5,9.5){\circle*{1}}\put(7.5,10.5){\circle*{1}}
+ \put(7.5,11.5){\circle*{1}}\put(7.5,12.5){\circle*{1}}
+ \put(7.5,13.5){\circle*{1}}\put(7.5,14.5){\circle*{1}}
+ \put(7.5,15.5){\circle*{1}}\put(7.5,16.5){\circle*{1}}
+ \put(7.5,17.5){\circle*{1}}\put(7.5,18.5){\circle*{1}}
+ \put(7.5,19.5){\circle*{1}}\put(7.5,20.5){\circle*{1}}
+ \put(7.5,21.5){\circle*{1}}\put(7.5,22.5){\circle*{1}}
+ \put(8.5,10.5){\circle*{1}}\put(8.5,16.5){\circle*{1}}
+ \put(8.5,22.5){\circle*{1}}\put(9.5,10.5){\circle*{1}}
+ \put(9.5,16.5){\circle*{1}}\put(9.5,22.5){\circle*{1}}
+ \put(10.5,10.5){\circle*{1}}\put(10.5,16.5){\circle*{1}}
+ \put(10.5,22.5){\circle*{1}}\put(11.5,10.5){\circle*{1}}
+ \put(11.5,16.5){\circle*{1}}\put(11.5,22.5){\circle*{1}}
+ \put(12.5,10.5){\circle*{1}}\put(12.5,16.5){\circle*{1}}
+ \put(12.5,22.5){\circle*{1}}\put(13.5,10.5){\circle*{1}}
+ \put(13.5,16.5){\circle*{1}}\put(13.5,22.5){\circle*{1}}
+ \put(14.5,1.5){\circle*{1}}\put(14.5,10.5){\circle*{1}}
+ \put(14.5,16.5){\circle*{1}}\put(14.5,22.5){\circle*{1}}
+ \put(15.5,1.5){\circle*{1}}\put(15.5,10.5){\circle*{1}}
+ \put(15.5,16.5){\circle*{1}}\put(15.5,22.5){\circle*{1}}
+ \put(16.5,0.5){\circle*{1}}\put(16.5,1.5){\circle*{1}}
+ \put(16.5,10.5){\circle*{1}}\put(16.5,16.5){\circle*{1}}
+ \put(16.5,22.5){\circle*{1}}\put(17.5,0.5){\circle*{1}}
+ \put(17.5,1.5){\circle*{1}}\put(17.5,2.5){\circle*{1}}
+ \put(17.5,3.5){\circle*{1}}\put(17.5,4.5){\circle*{1}}
+ \put(17.5,5.5){\circle*{1}}\put(17.5,6.5){\circle*{1}}
+ \put(17.5,7.5){\circle*{1}}\put(17.5,8.5){\circle*{1}}
+ \put(17.5,9.5){\circle*{1}}\put(17.5,10.5){\circle*{1}}
+ \put(17.5,11.5){\circle*{1}}\put(17.5,12.5){\circle*{1}}
+ \put(17.5,13.5){\circle*{1}}\put(17.5,14.5){\circle*{1}}
+ \put(17.5,15.5){\circle*{1}}\put(17.5,16.5){\circle*{1}}
+ \put(17.5,17.5){\circle*{1}}\put(17.5,18.5){\circle*{1}}
+ \put(17.5,19.5){\circle*{1}}\put(17.5,20.5){\circle*{1}}
+ \put(17.5,21.5){\circle*{1}}\put(17.5,22.5){\circle*{1}}
+ \put(17.5,23.5){\circle*{1}}\put(18.5,1.5){\circle*{1}}
+ \put(18.5,2.5){\circle*{1}}\put(18.5,3.5){\circle*{1}}
+ \put(18.5,4.5){\circle*{1}}\put(18.5,5.5){\circle*{1}}
+ \put(18.5,6.5){\circle*{1}}\put(18.5,7.5){\circle*{1}}
+ \put(18.5,8.5){\circle*{1}}\put(18.5,9.5){\circle*{1}}
+ \put(18.5,10.5){\circle*{1}}\put(18.5,11.5){\circle*{1}}
+ \put(18.5,12.5){\circle*{1}}\put(18.5,13.5){\circle*{1}}
+ \put(18.5,14.5){\circle*{1}}\put(18.5,15.5){\circle*{1}}
+ \put(18.5,16.5){\circle*{1}}\put(18.5,17.5){\circle*{1}}
+ \put(18.5,18.5){\circle*{1}}\put(18.5,19.5){\circle*{1}}
+ \put(18.5,20.5){\circle*{1}}\put(18.5,21.5){\circle*{1}}
+ \put(18.5,22.5){\circle*{1}}\put(18.5,23.5){\circle*{1}}
+ \put(19.5,22.5){\circle*{1}}
+ \end{picture}}
+ \put(170,0){\usebox{\watashi}}
+ \put(200,0){%
+ \begin{picture}(28,26)(-2,-2)%Bitmap 2549
+ \put(4.5,0.5){\circle*{1}}\put(4.5,1.5){\circle*{1}}
+ \put(4.5,2.5){\circle*{1}}\put(4.5,3.5){\circle*{1}}
+ \put(4.5,4.5){\circle*{1}}\put(4.5,5.5){\circle*{1}}
+ \put(4.5,6.5){\circle*{1}}\put(4.5,7.5){\circle*{1}}
+ \put(4.5,8.5){\circle*{1}}\put(4.5,9.5){\circle*{1}}
+ \put(4.5,10.5){\circle*{1}}\put(4.5,11.5){\circle*{1}}
+ \put(4.5,12.5){\circle*{1}}\put(4.5,13.5){\circle*{1}}
+ \put(4.5,14.5){\circle*{1}}\put(4.5,15.5){\circle*{1}}
+ \put(4.5,16.5){\circle*{1}}\put(4.5,17.5){\circle*{1}}
+ \put(4.5,18.5){\circle*{1}}\put(4.5,19.5){\circle*{1}}
+ \put(4.5,20.5){\circle*{1}}\put(5.5,0.5){\circle*{1}}
+ \put(5.5,1.5){\circle*{1}}\put(5.5,2.5){\circle*{1}}
+ \put(5.5,3.5){\circle*{1}}\put(5.5,4.5){\circle*{1}}
+ \put(5.5,5.5){\circle*{1}}\put(5.5,6.5){\circle*{1}}
+ \put(5.5,7.5){\circle*{1}}\put(5.5,8.5){\circle*{1}}
+ \put(5.5,9.5){\circle*{1}}\put(5.5,10.5){\circle*{1}}
+ \put(5.5,11.5){\circle*{1}}\put(5.5,12.5){\circle*{1}}
+ \put(5.5,13.5){\circle*{1}}\put(5.5,14.5){\circle*{1}}
+ \put(5.5,15.5){\circle*{1}}\put(5.5,16.5){\circle*{1}}
+ \put(5.5,17.5){\circle*{1}}\put(5.5,18.5){\circle*{1}}
+ \put(5.5,19.5){\circle*{1}}\put(6.5,1.5){\circle*{1}}
+ \put(6.5,7.5){\circle*{1}}\put(6.5,13.5){\circle*{1}}
+ \put(6.5,19.5){\circle*{1}}\put(7.5,1.5){\circle*{1}}
+ \put(7.5,7.5){\circle*{1}}\put(7.5,13.5){\circle*{1}}
+ \put(7.5,19.5){\circle*{1}}\put(8.5,1.5){\circle*{1}}
+ \put(8.5,7.5){\circle*{1}}\put(8.5,13.5){\circle*{1}}
+ \put(8.5,19.5){\circle*{1}}\put(9.5,1.5){\circle*{1}}
+ \put(9.5,7.5){\circle*{1}}\put(9.5,13.5){\circle*{1}}
+ \put(9.5,19.5){\circle*{1}}\put(10.5,1.5){\circle*{1}}
+ \put(10.5,7.5){\circle*{1}}\put(10.5,13.5){\circle*{1}}
+ \put(10.5,19.5){\circle*{1}}\put(10.5,20.5){\circle*{1}}
+ \put(10.5,21.5){\circle*{1}}\put(10.5,22.5){\circle*{1}}
+ \put(10.5,23.5){\circle*{1}}\put(11.5,1.5){\circle*{1}}
+ \put(11.5,7.5){\circle*{1}}\put(11.5,13.5){\circle*{1}}
+ \put(11.5,19.5){\circle*{1}}\put(11.5,21.5){\circle*{1}}
+ \put(11.5,22.5){\circle*{1}}\put(12.5,1.5){\circle*{1}}
+ \put(12.5,7.5){\circle*{1}}\put(12.5,13.5){\circle*{1}}
+ \put(12.5,19.5){\circle*{1}}\put(12.5,22.5){\circle*{1}}
+ \put(13.5,1.5){\circle*{1}}\put(13.5,7.5){\circle*{1}}
+ \put(13.5,13.5){\circle*{1}}\put(13.5,19.5){\circle*{1}}
+ \put(14.5,1.5){\circle*{1}}\put(14.5,7.5){\circle*{1}}
+ \put(14.5,13.5){\circle*{1}}\put(14.5,19.5){\circle*{1}}
+ \put(15.5,1.5){\circle*{1}}\put(15.5,7.5){\circle*{1}}
+ \put(15.5,13.5){\circle*{1}}\put(15.5,19.5){\circle*{1}}
+ \put(16.5,1.5){\circle*{1}}\put(16.5,7.5){\circle*{1}}
+ \put(16.5,13.5){\circle*{1}}\put(16.5,19.5){\circle*{1}}
+ \put(17.5,1.5){\circle*{1}}\put(17.5,7.5){\circle*{1}}
+ \put(17.5,13.5){\circle*{1}}\put(17.5,19.5){\circle*{1}}
+ \put(18.5,0.5){\circle*{1}}\put(18.5,1.5){\circle*{1}}
+ \put(18.5,2.5){\circle*{1}}\put(18.5,3.5){\circle*{1}}
+ \put(18.5,4.5){\circle*{1}}\put(18.5,5.5){\circle*{1}}
+ \put(18.5,6.5){\circle*{1}}\put(18.5,7.5){\circle*{1}}
+ \put(18.5,8.5){\circle*{1}}\put(18.5,9.5){\circle*{1}}
+ \put(18.5,10.5){\circle*{1}}\put(18.5,11.5){\circle*{1}}
+ \put(18.5,12.5){\circle*{1}}\put(18.5,13.5){\circle*{1}}
+ \put(18.5,14.5){\circle*{1}}\put(18.5,15.5){\circle*{1}}
+ \put(18.5,16.5){\circle*{1}}\put(18.5,17.5){\circle*{1}}
+ \put(18.5,18.5){\circle*{1}}\put(18.5,19.5){\circle*{1}}
+ \put(18.5,20.5){\circle*{1}}\put(19.5,0.5){\circle*{1}}
+ \put(19.5,1.5){\circle*{1}}\put(19.5,2.5){\circle*{1}}
+ \put(19.5,3.5){\circle*{1}}\put(19.5,4.5){\circle*{1}}
+ \put(19.5,5.5){\circle*{1}}\put(19.5,6.5){\circle*{1}}
+ \put(19.5,7.5){\circle*{1}}\put(19.5,8.5){\circle*{1}}
+ \put(19.5,9.5){\circle*{1}}\put(19.5,10.5){\circle*{1}}
+ \put(19.5,11.5){\circle*{1}}\put(19.5,12.5){\circle*{1}}
+ \put(19.5,13.5){\circle*{1}}\put(19.5,14.5){\circle*{1}}
+ \put(19.5,15.5){\circle*{1}}\put(19.5,16.5){\circle*{1}}
+ \put(19.5,17.5){\circle*{1}}\put(19.5,18.5){\circle*{1}}
+ \put(19.5,19.5){\circle*{1}}\put(19.5,20.5){\circle*{1}}
+ \put(20.5,19.5){\circle*{1}}
+ \end{picture}}
+ \end{picture}
+ \hspace{1cm}
+ \begin{picture}(250,28)
+ \thinlines
+ \put(0,0){\line(1,0){250}}
+ \put(38,0){%
+ \begin{picture}(22,26)(-2,-2)%Bitmap 2988
+ \put(0.5,0.5){\circle*{1}}\put(0.5,1.5){\circle*{1}}
+ \put(0.5,2.5){\circle*{1}}\put(0.5,3.5){\circle*{1}}
+ \put(0.5,4.5){\circle*{1}}\put(0.5,5.5){\circle*{1}}
+ \put(0.5,6.5){\circle*{1}}\put(0.5,7.5){\circle*{1}}
+ \put(0.5,8.5){\circle*{1}}\put(0.5,9.5){\circle*{1}}
+ \put(0.5,10.5){\circle*{1}}\put(0.5,11.5){\circle*{1}}
+ \put(1.5,0.5){\circle*{1}}\put(1.5,1.5){\circle*{1}}
+ \put(1.5,2.5){\circle*{1}}\put(1.5,3.5){\circle*{1}}
+ \put(1.5,4.5){\circle*{1}}\put(1.5,5.5){\circle*{1}}
+ \put(1.5,6.5){\circle*{1}}\put(1.5,7.5){\circle*{1}}
+ \put(1.5,8.5){\circle*{1}}\put(1.5,9.5){\circle*{1}}
+ \put(1.5,10.5){\circle*{1}}\put(2.5,2.5){\circle*{1}}
+ \put(2.5,10.5){\circle*{1}}\put(3.5,2.5){\circle*{1}}
+ \put(3.5,10.5){\circle*{1}}\put(4.5,2.5){\circle*{1}}
+ \put(4.5,10.5){\circle*{1}}\put(5.5,2.5){\circle*{1}}
+ \put(5.5,10.5){\circle*{1}}\put(6.5,2.5){\circle*{1}}
+ \put(6.5,10.5){\circle*{1}}\put(7.5,2.5){\circle*{1}}
+ \put(7.5,10.5){\circle*{1}}\put(7.5,11.5){\circle*{1}}
+ \put(7.5,12.5){\circle*{1}}\put(7.5,13.5){\circle*{1}}
+ \put(7.5,14.5){\circle*{1}}\put(7.5,15.5){\circle*{1}}
+ \put(7.5,16.5){\circle*{1}}\put(7.5,17.5){\circle*{1}}
+ \put(7.5,18.5){\circle*{1}}\put(7.5,19.5){\circle*{1}}
+ \put(7.5,20.5){\circle*{1}}\put(7.5,21.5){\circle*{1}}
+ \put(7.5,22.5){\circle*{1}}\put(7.5,23.5){\circle*{1}}
+ \put(8.5,2.5){\circle*{1}}\put(8.5,10.5){\circle*{1}}
+ \put(8.5,11.5){\circle*{1}}\put(8.5,12.5){\circle*{1}}
+ \put(8.5,13.5){\circle*{1}}\put(8.5,14.5){\circle*{1}}
+ \put(8.5,15.5){\circle*{1}}\put(8.5,16.5){\circle*{1}}
+ \put(8.5,17.5){\circle*{1}}\put(8.5,18.5){\circle*{1}}
+ \put(8.5,19.5){\circle*{1}}\put(8.5,20.5){\circle*{1}}
+ \put(8.5,21.5){\circle*{1}}\put(8.5,22.5){\circle*{1}}
+ \put(8.5,23.5){\circle*{1}}\put(9.5,2.5){\circle*{1}}
+ \put(9.5,10.5){\circle*{1}}\put(9.5,17.5){\circle*{1}}
+ \put(9.5,23.5){\circle*{1}}\put(10.5,2.5){\circle*{1}}
+ \put(10.5,10.5){\circle*{1}}\put(10.5,17.5){\circle*{1}}
+ \put(11.5,2.5){\circle*{1}}\put(11.5,10.5){\circle*{1}}
+ \put(11.5,17.5){\circle*{1}}\put(12.5,2.5){\circle*{1}}
+ \put(12.5,10.5){\circle*{1}}\put(12.5,17.5){\circle*{1}}
+ \put(13.5,2.5){\circle*{1}}\put(13.5,10.5){\circle*{1}}
+ \put(13.5,17.5){\circle*{1}}\put(14.5,0.5){\circle*{1}}
+ \put(14.5,1.5){\circle*{1}}\put(14.5,2.5){\circle*{1}}
+ \put(14.5,3.5){\circle*{1}}\put(14.5,4.5){\circle*{1}}
+ \put(14.5,5.5){\circle*{1}}\put(14.5,6.5){\circle*{1}}
+ \put(14.5,7.5){\circle*{1}}\put(14.5,8.5){\circle*{1}}
+ \put(14.5,9.5){\circle*{1}}\put(14.5,10.5){\circle*{1}}
+ \put(14.5,11.5){\circle*{1}}\put(14.5,17.5){\circle*{1}}
+ \put(15.5,0.5){\circle*{1}}\put(15.5,1.5){\circle*{1}}
+ \put(15.5,2.5){\circle*{1}}\put(15.5,3.5){\circle*{1}}
+ \put(15.5,4.5){\circle*{1}}\put(15.5,5.5){\circle*{1}}
+ \put(15.5,6.5){\circle*{1}}\put(15.5,7.5){\circle*{1}}
+ \put(15.5,8.5){\circle*{1}}\put(15.5,9.5){\circle*{1}}
+ \put(15.5,10.5){\circle*{1}}\put(15.5,11.5){\circle*{1}}
+ \put(15.5,17.5){\circle*{1}}\put(15.5,18.5){\circle*{1}}
+ \put(16.5,10.5){\circle*{1}}\put(16.5,17.5){\circle*{1}}
+ \put(16.5,18.5){\circle*{1}}\put(17.5,17.5){\circle*{1}}
+ \end{picture}}
+ \put(62,0){\usebox{\watashi}}
+ \put(92,0){%
+ \begin{picture}(21,26)(-2,-2)%Bitmap 3570
+ \put(0.5,0.5){\circle*{1}}\put(0.5,1.5){\circle*{1}}
+ \put(0.5,2.5){\circle*{1}}\put(0.5,3.5){\circle*{1}}
+ \put(0.5,4.5){\circle*{1}}\put(0.5,5.5){\circle*{1}}
+ \put(0.5,6.5){\circle*{1}}\put(0.5,7.5){\circle*{1}}
+ \put(0.5,8.5){\circle*{1}}\put(0.5,9.5){\circle*{1}}
+ \put(0.5,10.5){\circle*{1}}\put(0.5,11.5){\circle*{1}}
+ \put(0.5,12.5){\circle*{1}}\put(0.5,13.5){\circle*{1}}
+ \put(0.5,14.5){\circle*{1}}\put(0.5,15.5){\circle*{1}}
+ \put(0.5,16.5){\circle*{1}}\put(0.5,17.5){\circle*{1}}
+ \put(0.5,18.5){\circle*{1}}\put(0.5,19.5){\circle*{1}}
+ \put(0.5,20.5){\circle*{1}}\put(0.5,21.5){\circle*{1}}
+ \put(0.5,22.5){\circle*{1}}\put(1.5,0.5){\circle*{1}}
+ \put(1.5,1.5){\circle*{1}}\put(1.5,2.5){\circle*{1}}
+ \put(1.5,3.5){\circle*{1}}\put(1.5,4.5){\circle*{1}}
+ \put(1.5,5.5){\circle*{1}}\put(1.5,6.5){\circle*{1}}
+ \put(1.5,7.5){\circle*{1}}\put(1.5,8.5){\circle*{1}}
+ \put(1.5,9.5){\circle*{1}}\put(1.5,10.5){\circle*{1}}
+ \put(1.5,11.5){\circle*{1}}\put(1.5,12.5){\circle*{1}}
+ \put(1.5,13.5){\circle*{1}}\put(1.5,14.5){\circle*{1}}
+ \put(1.5,15.5){\circle*{1}}\put(1.5,16.5){\circle*{1}}
+ \put(1.5,17.5){\circle*{1}}\put(1.5,18.5){\circle*{1}}
+ \put(1.5,19.5){\circle*{1}}\put(1.5,20.5){\circle*{1}}
+ \put(1.5,21.5){\circle*{1}}\put(2.5,2.5){\circle*{1}}
+ \put(2.5,12.5){\circle*{1}}\put(2.5,21.5){\circle*{1}}
+ \put(3.5,2.5){\circle*{1}}\put(3.5,12.5){\circle*{1}}
+ \put(3.5,21.5){\circle*{1}}\put(4.5,2.5){\circle*{1}}
+ \put(4.5,12.5){\circle*{1}}\put(4.5,21.5){\circle*{1}}
+ \put(5.5,2.5){\circle*{1}}\put(5.5,12.5){\circle*{1}}
+ \put(5.5,21.5){\circle*{1}}\put(6.5,2.5){\circle*{1}}
+ \put(6.5,12.5){\circle*{1}}\put(6.5,21.5){\circle*{1}}
+ \put(7.5,2.5){\circle*{1}}\put(7.5,12.5){\circle*{1}}
+ \put(7.5,21.5){\circle*{1}}\put(8.5,2.5){\circle*{1}}
+ \put(8.5,12.5){\circle*{1}}\put(8.5,21.5){\circle*{1}}
+ \put(9.5,2.5){\circle*{1}}\put(9.5,12.5){\circle*{1}}
+ \put(9.5,21.5){\circle*{1}}\put(10.5,2.5){\circle*{1}}
+ \put(10.5,12.5){\circle*{1}}\put(10.5,21.5){\circle*{1}}
+ \put(11.5,2.5){\circle*{1}}\put(11.5,12.5){\circle*{1}}
+ \put(11.5,21.5){\circle*{1}}\put(12.5,2.5){\circle*{1}}
+ \put(12.5,12.5){\circle*{1}}\put(12.5,21.5){\circle*{1}}
+ \put(13.5,2.5){\circle*{1}}\put(13.5,12.5){\circle*{1}}
+ \put(13.5,21.5){\circle*{1}}\put(14.5,0.5){\circle*{1}}
+ \put(14.5,1.5){\circle*{1}}\put(14.5,2.5){\circle*{1}}
+ \put(14.5,3.5){\circle*{1}}\put(14.5,4.5){\circle*{1}}
+ \put(14.5,5.5){\circle*{1}}\put(14.5,6.5){\circle*{1}}
+ \put(14.5,7.5){\circle*{1}}\put(14.5,8.5){\circle*{1}}
+ \put(14.5,9.5){\circle*{1}}\put(14.5,10.5){\circle*{1}}
+ \put(14.5,11.5){\circle*{1}}\put(14.5,12.5){\circle*{1}}
+ \put(14.5,13.5){\circle*{1}}\put(14.5,14.5){\circle*{1}}
+ \put(14.5,15.5){\circle*{1}}\put(14.5,16.5){\circle*{1}}
+ \put(14.5,17.5){\circle*{1}}\put(14.5,18.5){\circle*{1}}
+ \put(14.5,19.5){\circle*{1}}\put(14.5,20.5){\circle*{1}}
+ \put(14.5,21.5){\circle*{1}}\put(14.5,22.5){\circle*{1}}
+ \put(15.5,0.5){\circle*{1}}\put(15.5,1.5){\circle*{1}}
+ \put(15.5,2.5){\circle*{1}}\put(15.5,3.5){\circle*{1}}
+ \put(15.5,4.5){\circle*{1}}\put(15.5,5.5){\circle*{1}}
+ \put(15.5,6.5){\circle*{1}}\put(15.5,7.5){\circle*{1}}
+ \put(15.5,8.5){\circle*{1}}\put(15.5,9.5){\circle*{1}}
+ \put(15.5,10.5){\circle*{1}}\put(15.5,11.5){\circle*{1}}
+ \put(15.5,12.5){\circle*{1}}\put(15.5,13.5){\circle*{1}}
+ \put(15.5,14.5){\circle*{1}}\put(15.5,15.5){\circle*{1}}
+ \put(15.5,16.5){\circle*{1}}\put(15.5,17.5){\circle*{1}}
+ \put(15.5,18.5){\circle*{1}}\put(15.5,19.5){\circle*{1}}
+ \put(15.5,20.5){\circle*{1}}\put(15.5,21.5){\circle*{1}}
+ \put(15.5,22.5){\circle*{1}}\put(16.5,21.5){\circle*{1}}
+ \end{picture}}
+ \put(115,0){\usebox{\watashi}}
+ \put(145,0){%
+ \begin{picture}(16,26)(-2,-2)%Bitmap 3994
+ \put(0.5,0.5){\circle*{1}}\put(0.5,1.5){\circle*{1}}
+ \put(0.5,2.5){\circle*{1}}\put(0.5,3.5){\circle*{1}}
+ \put(0.5,4.5){\circle*{1}}\put(0.5,5.5){\circle*{1}}
+ \put(0.5,6.5){\circle*{1}}\put(0.5,7.5){\circle*{1}}
+ \put(0.5,8.5){\circle*{1}}\put(0.5,9.5){\circle*{1}}
+ \put(0.5,10.5){\circle*{1}}\put(0.5,11.5){\circle*{1}}
+ \put(0.5,12.5){\circle*{1}}\put(0.5,13.5){\circle*{1}}
+ \put(0.5,14.5){\circle*{1}}\put(0.5,15.5){\circle*{1}}
+ \put(0.5,16.5){\circle*{1}}\put(0.5,17.5){\circle*{1}}
+ \put(0.5,18.5){\circle*{1}}\put(0.5,19.5){\circle*{1}}
+ \put(0.5,20.5){\circle*{1}}\put(0.5,21.5){\circle*{1}}
+ \put(0.5,22.5){\circle*{1}}\put(0.5,23.5){\circle*{1}}
+ \put(1.5,0.5){\circle*{1}}\put(1.5,1.5){\circle*{1}}
+ \put(1.5,2.5){\circle*{1}}\put(1.5,3.5){\circle*{1}}
+ \put(1.5,4.5){\circle*{1}}\put(1.5,5.5){\circle*{1}}
+ \put(1.5,6.5){\circle*{1}}\put(1.5,7.5){\circle*{1}}
+ \put(1.5,8.5){\circle*{1}}\put(1.5,9.5){\circle*{1}}
+ \put(1.5,10.5){\circle*{1}}\put(1.5,11.5){\circle*{1}}
+ \put(1.5,12.5){\circle*{1}}\put(1.5,13.5){\circle*{1}}
+ \put(1.5,14.5){\circle*{1}}\put(1.5,15.5){\circle*{1}}
+ \put(1.5,16.5){\circle*{1}}\put(1.5,17.5){\circle*{1}}
+ \put(1.5,18.5){\circle*{1}}\put(1.5,19.5){\circle*{1}}
+ \put(1.5,20.5){\circle*{1}}\put(1.5,21.5){\circle*{1}}
+ \put(1.5,22.5){\circle*{1}}\put(1.5,23.5){\circle*{1}}
+ \put(2.5,15.5){\circle*{1}}\put(2.5,23.5){\circle*{1}}
+ \put(3.5,15.5){\circle*{1}}\put(4.5,14.5){\circle*{1}}
+ \put(5.5,14.5){\circle*{1}}\put(6.5,13.5){\circle*{1}}
+ \put(7.5,12.5){\circle*{1}}\put(7.5,13.5){\circle*{1}}
+ \put(8.5,11.5){\circle*{1}}\put(8.5,12.5){\circle*{1}}
+ \put(9.5,10.5){\circle*{1}}\put(9.5,11.5){\circle*{1}}
+ \put(9.5,12.5){\circle*{1}}\put(10.5,9.5){\circle*{1}}
+ \put(10.5,10.5){\circle*{1}}\put(10.5,11.5){\circle*{1}}
+ \put(11.5,9.5){\circle*{1}}\put(11.5,10.5){\circle*{1}}
+ \end{picture}}
+ \put(163,0){\usebox{\watashi}}
+ \put(193,0){%
+ \begin{picture}(17,26)(-2,-2)%Bitmap 4645
+ \put(0.5,0.5){\circle*{1}}\put(0.5,1.5){\circle*{1}}
+ \put(0.5,2.5){\circle*{1}}\put(0.5,3.5){\circle*{1}}
+ \put(0.5,4.5){\circle*{1}}\put(0.5,5.5){\circle*{1}}
+ \put(0.5,6.5){\circle*{1}}\put(0.5,7.5){\circle*{1}}
+ \put(0.5,8.5){\circle*{1}}\put(0.5,9.5){\circle*{1}}
+ \put(0.5,10.5){\circle*{1}}\put(0.5,11.5){\circle*{1}}
+ \put(0.5,12.5){\circle*{1}}\put(0.5,13.5){\circle*{1}}
+ \put(0.5,14.5){\circle*{1}}\put(0.5,15.5){\circle*{1}}
+ \put(0.5,16.5){\circle*{1}}\put(0.5,17.5){\circle*{1}}
+ \put(0.5,18.5){\circle*{1}}\put(0.5,19.5){\circle*{1}}
+ \put(0.5,20.5){\circle*{1}}\put(0.5,21.5){\circle*{1}}
+ \put(0.5,22.5){\circle*{1}}\put(1.5,0.5){\circle*{1}}
+ \put(1.5,1.5){\circle*{1}}\put(1.5,2.5){\circle*{1}}
+ \put(1.5,3.5){\circle*{1}}\put(1.5,4.5){\circle*{1}}
+ \put(1.5,5.5){\circle*{1}}\put(1.5,6.5){\circle*{1}}
+ \put(1.5,7.5){\circle*{1}}\put(1.5,8.5){\circle*{1}}
+ \put(1.5,9.5){\circle*{1}}\put(1.5,10.5){\circle*{1}}
+ \put(1.5,11.5){\circle*{1}}\put(1.5,12.5){\circle*{1}}
+ \put(1.5,13.5){\circle*{1}}\put(1.5,14.5){\circle*{1}}
+ \put(1.5,15.5){\circle*{1}}\put(1.5,16.5){\circle*{1}}
+ \put(1.5,17.5){\circle*{1}}\put(1.5,18.5){\circle*{1}}
+ \put(1.5,19.5){\circle*{1}}\put(1.5,20.5){\circle*{1}}
+ \put(1.5,21.5){\circle*{1}}\put(2.5,21.5){\circle*{1}}
+ \put(3.5,21.5){\circle*{1}}\put(4.5,21.5){\circle*{1}}
+ \put(5.5,21.5){\circle*{1}}\put(6.5,7.5){\circle*{1}}
+ \put(6.5,21.5){\circle*{1}}\put(7.5,7.5){\circle*{1}}
+ \put(7.5,21.5){\circle*{1}}\put(8.5,6.5){\circle*{1}}
+ \put(8.5,7.5){\circle*{1}}\put(8.5,21.5){\circle*{1}}
+ \put(9.5,6.5){\circle*{1}}\put(9.5,7.5){\circle*{1}}
+ \put(9.5,21.5){\circle*{1}}\put(10.5,6.5){\circle*{1}}
+ \put(10.5,7.5){\circle*{1}}\put(10.5,8.5){\circle*{1}}
+ \put(10.5,9.5){\circle*{1}}\put(10.5,10.5){\circle*{1}}
+ \put(10.5,11.5){\circle*{1}}\put(10.5,12.5){\circle*{1}}
+ \put(10.5,13.5){\circle*{1}}\put(10.5,14.5){\circle*{1}}
+ \put(10.5,15.5){\circle*{1}}\put(10.5,16.5){\circle*{1}}
+ \put(10.5,17.5){\circle*{1}}\put(10.5,18.5){\circle*{1}}
+ \put(10.5,19.5){\circle*{1}}\put(10.5,20.5){\circle*{1}}
+ \put(10.5,21.5){\circle*{1}}\put(10.5,22.5){\circle*{1}}
+ \put(11.5,7.5){\circle*{1}}\put(11.5,8.5){\circle*{1}}
+ \put(11.5,9.5){\circle*{1}}\put(11.5,10.5){\circle*{1}}
+ \put(11.5,11.5){\circle*{1}}\put(11.5,12.5){\circle*{1}}
+ \put(11.5,13.5){\circle*{1}}\put(11.5,14.5){\circle*{1}}
+ \put(11.5,15.5){\circle*{1}}\put(11.5,16.5){\circle*{1}}
+ \put(11.5,17.5){\circle*{1}}\put(11.5,18.5){\circle*{1}}
+ \put(11.5,19.5){\circle*{1}}\put(11.5,20.5){\circle*{1}}
+ \put(11.5,21.5){\circle*{1}}\put(11.5,22.5){\circle*{1}}
+ \put(12.5,21.5){\circle*{1}}
+ \end{picture}}
+ \end{picture}
+ \sbox{\watashi}{}
+\end{center}
+
+The japanese characters on the left have a fixed width. The characters on the
+right have a minimized width, just like ordinary english characters.
+Personally, I find that minimized width is desirable when writing japanese
+horizontally. Also note that although this is not visible in these two
+examples, the japanese characters are as short as possible while respecting the
+vertical relationship with their horizontal baseline.
+
+Let us now consider vertical roman writing. If one was to simply reverse the
+previous argument regarding roman characters and their horizontal baseline, one
+would conclude that it is important to minimize the height of each roman
+character. However, the width of each character would be unimportant. It is the
+horizontal relationship between the roman character and the vertical baseline
+that would appear crucial.
+
+That reasoning could be correct if there was such a thing as vertical roman
+writing, but it fails in the japanese case for two good reasons. First of all,
+there is no vertical baseline available in \MFT. That implies that the concept
+of an horizontal relationship between a japanese character and its vertical
+baseline is undefined. The next best thing available to us is to use fixed
+width japanese characters. In such a case, the sought horizontal relationship
+is implied in the bitmap itself.
+
+Secondly, some japanese characters can be constructed by piling up other
+characters on top of one another. For example, consider the characters two,
+one, and three:
+\begin{center}
+ \setlength{\unitlength}{0.4pt}
+ \begin{picture}(30,94)(0,-10)
+ \thinlines
+ \put(0,-10){\line(0,1){104}}
+ \put(0,56){%
+ \begin{picture}(28,26)(-2,-2)%Bitmap 3561 ni
+ \put(0.5,2.5){\circle*{1}}\put(1.5,2.5){\circle*{1}}
+ \put(2.5,2.5){\circle*{1}}\put(3.5,2.5){\circle*{1}}
+ \put(3.5,20.5){\circle*{1}}\put(4.5,2.5){\circle*{1}}
+ \put(4.5,20.5){\circle*{1}}\put(5.5,2.5){\circle*{1}}
+ \put(5.5,20.5){\circle*{1}}\put(6.5,2.5){\circle*{1}}
+ \put(6.5,20.5){\circle*{1}}\put(7.5,2.5){\circle*{1}}
+ \put(7.5,20.5){\circle*{1}}\put(8.5,2.5){\circle*{1}}
+ \put(8.5,20.5){\circle*{1}}\put(9.5,2.5){\circle*{1}}
+ \put(9.5,20.5){\circle*{1}}\put(10.5,2.5){\circle*{1}}
+ \put(10.5,20.5){\circle*{1}}\put(11.5,2.5){\circle*{1}}
+ \put(11.5,20.5){\circle*{1}}\put(12.5,2.5){\circle*{1}}
+ \put(12.5,20.5){\circle*{1}}\put(13.5,2.5){\circle*{1}}
+ \put(13.5,20.5){\circle*{1}}\put(14.5,2.5){\circle*{1}}
+ \put(14.5,20.5){\circle*{1}}\put(15.5,2.5){\circle*{1}}
+ \put(15.5,20.5){\circle*{1}}\put(16.5,2.5){\circle*{1}}
+ \put(16.5,20.5){\circle*{1}}\put(17.5,2.5){\circle*{1}}
+ \put(17.5,20.5){\circle*{1}}\put(18.5,2.5){\circle*{1}}
+ \put(18.5,20.5){\circle*{1}}\put(18.5,21.5){\circle*{1}}
+ \put(19.5,2.5){\circle*{1}}\put(19.5,20.5){\circle*{1}}
+ \put(19.5,21.5){\circle*{1}}\put(20.5,2.5){\circle*{1}}
+ \put(20.5,20.5){\circle*{1}}\put(21.5,2.5){\circle*{1}}
+ \put(21.5,3.5){\circle*{1}}\put(22.5,2.5){\circle*{1}}
+ \put(22.5,3.5){\circle*{1}}\put(23.5,2.5){\circle*{1}}
+ \end{picture}}
+ \put(0,28){%
+ \begin{picture}(28,26)(-2,-2)%Bitmap 1486 ichi
+ \put(0.5,12.5){\circle*{1}}\put(1.5,12.5){\circle*{1}}
+ \put(2.5,12.5){\circle*{1}}\put(3.5,12.5){\circle*{1}}
+ \put(4.5,12.5){\circle*{1}}\put(5.5,12.5){\circle*{1}}
+ \put(6.5,12.5){\circle*{1}}\put(7.5,12.5){\circle*{1}}
+ \put(8.5,12.5){\circle*{1}}\put(9.5,12.5){\circle*{1}}
+ \put(10.5,12.5){\circle*{1}}\put(11.5,12.5){\circle*{1}}
+ \put(12.5,12.5){\circle*{1}}\put(13.5,12.5){\circle*{1}}
+ \put(14.5,12.5){\circle*{1}}\put(15.5,12.5){\circle*{1}}
+ \put(16.5,12.5){\circle*{1}}\put(17.5,12.5){\circle*{1}}
+ \put(18.5,12.5){\circle*{1}}\put(19.5,12.5){\circle*{1}}
+ \put(20.5,12.5){\circle*{1}}\put(20.5,13.5){\circle*{1}}
+ \put(21.5,12.5){\circle*{1}}\put(21.5,13.5){\circle*{1}}
+ \put(21.5,14.5){\circle*{1}}\put(22.5,12.5){\circle*{1}}
+ \put(22.5,13.5){\circle*{1}}\put(23.5,12.5){\circle*{1}}
+ \end{picture}}
+ \put(0,0){%
+ \begin{picture}(28,26)(-2,-2)%Bitmap 2460 san
+ \put(0.5,2.5){\circle*{1}}\put(1.5,2.5){\circle*{1}}
+ \put(2.5,2.5){\circle*{1}}\put(2.5,21.5){\circle*{1}}
+ \put(3.5,2.5){\circle*{1}}\put(3.5,21.5){\circle*{1}}
+ \put(4.5,2.5){\circle*{1}}\put(4.5,12.5){\circle*{1}}
+ \put(4.5,21.5){\circle*{1}}\put(5.5,2.5){\circle*{1}}
+ \put(5.5,12.5){\circle*{1}}\put(5.5,21.5){\circle*{1}}
+ \put(6.5,2.5){\circle*{1}}\put(6.5,12.5){\circle*{1}}
+ \put(6.5,21.5){\circle*{1}}\put(7.5,2.5){\circle*{1}}
+ \put(7.5,12.5){\circle*{1}}\put(7.5,21.5){\circle*{1}}
+ \put(8.5,2.5){\circle*{1}}\put(8.5,12.5){\circle*{1}}
+ \put(8.5,21.5){\circle*{1}}\put(9.5,2.5){\circle*{1}}
+ \put(9.5,12.5){\circle*{1}}\put(9.5,21.5){\circle*{1}}
+ \put(10.5,2.5){\circle*{1}}\put(10.5,12.5){\circle*{1}}
+ \put(10.5,21.5){\circle*{1}}\put(11.5,2.5){\circle*{1}}
+ \put(11.5,12.5){\circle*{1}}\put(11.5,21.5){\circle*{1}}
+ \put(12.5,2.5){\circle*{1}}\put(12.5,12.5){\circle*{1}}
+ \put(12.5,21.5){\circle*{1}}\put(13.5,2.5){\circle*{1}}
+ \put(13.5,12.5){\circle*{1}}\put(13.5,21.5){\circle*{1}}
+ \put(14.5,2.5){\circle*{1}}\put(14.5,12.5){\circle*{1}}
+ \put(14.5,21.5){\circle*{1}}\put(15.5,2.5){\circle*{1}}
+ \put(15.5,12.5){\circle*{1}}\put(15.5,21.5){\circle*{1}}
+ \put(16.5,2.5){\circle*{1}}\put(16.5,12.5){\circle*{1}}
+ \put(16.5,21.5){\circle*{1}}\put(17.5,2.5){\circle*{1}}
+ \put(17.5,12.5){\circle*{1}}\put(17.5,13.5){\circle*{1}}
+ \put(17.5,21.5){\circle*{1}}\put(18.5,2.5){\circle*{1}}
+ \put(18.5,12.5){\circle*{1}}\put(18.5,13.5){\circle*{1}}
+ \put(18.5,21.5){\circle*{1}}\put(19.5,2.5){\circle*{1}}
+ \put(19.5,12.5){\circle*{1}}\put(19.5,21.5){\circle*{1}}
+ \put(19.5,22.5){\circle*{1}}\put(20.5,2.5){\circle*{1}}
+ \put(20.5,21.5){\circle*{1}}\put(20.5,22.5){\circle*{1}}
+ \put(21.5,2.5){\circle*{1}}\put(21.5,3.5){\circle*{1}}
+ \put(21.5,21.5){\circle*{1}}\put(22.5,2.5){\circle*{1}}
+ \put(22.5,3.5){\circle*{1}}\put(23.5,2.5){\circle*{1}}
+ \end{picture}}
+ \end{picture}
+ \hspace{1cm}
+ \begin{picture}(30,94)(0,-10)
+ \thinlines
+ \put(0,-10){\line(0,1){104}}
+ \put(0,45.5){%
+ \begin{picture}(28,23)(-2,0)%Bitmap 3561 ni
+ \put(0.5,2.5){\circle*{1}}\put(1.5,2.5){\circle*{1}}
+ \put(2.5,2.5){\circle*{1}}\put(3.5,2.5){\circle*{1}}
+ \put(3.5,20.5){\circle*{1}}\put(4.5,2.5){\circle*{1}}
+ \put(4.5,20.5){\circle*{1}}\put(5.5,2.5){\circle*{1}}
+ \put(5.5,20.5){\circle*{1}}\put(6.5,2.5){\circle*{1}}
+ \put(6.5,20.5){\circle*{1}}\put(7.5,2.5){\circle*{1}}
+ \put(7.5,20.5){\circle*{1}}\put(8.5,2.5){\circle*{1}}
+ \put(8.5,20.5){\circle*{1}}\put(9.5,2.5){\circle*{1}}
+ \put(9.5,20.5){\circle*{1}}\put(10.5,2.5){\circle*{1}}
+ \put(10.5,20.5){\circle*{1}}\put(11.5,2.5){\circle*{1}}
+ \put(11.5,20.5){\circle*{1}}\put(12.5,2.5){\circle*{1}}
+ \put(12.5,20.5){\circle*{1}}\put(13.5,2.5){\circle*{1}}
+ \put(13.5,20.5){\circle*{1}}\put(14.5,2.5){\circle*{1}}
+ \put(14.5,20.5){\circle*{1}}\put(15.5,2.5){\circle*{1}}
+ \put(15.5,20.5){\circle*{1}}\put(16.5,2.5){\circle*{1}}
+ \put(16.5,20.5){\circle*{1}}\put(17.5,2.5){\circle*{1}}
+ \put(17.5,20.5){\circle*{1}}\put(18.5,2.5){\circle*{1}}
+ \put(18.5,20.5){\circle*{1}}\put(18.5,21.5){\circle*{1}}
+ \put(19.5,2.5){\circle*{1}}\put(19.5,20.5){\circle*{1}}
+ \put(19.5,21.5){\circle*{1}}\put(20.5,2.5){\circle*{1}}
+ \put(20.5,20.5){\circle*{1}}\put(21.5,2.5){\circle*{1}}
+ \put(21.5,3.5){\circle*{1}}\put(22.5,2.5){\circle*{1}}
+ \put(22.5,3.5){\circle*{1}}\put(23.5,2.5){\circle*{1}}
+ \end{picture}}
+ \put(0,39.5){%
+ \begin{picture}(28,16)(-2,10)%Bitmap 1486 ichi
+ \put(0.5,12.5){\circle*{1}}\put(1.5,12.5){\circle*{1}}
+ \put(2.5,12.5){\circle*{1}}\put(3.5,12.5){\circle*{1}}
+ \put(4.5,12.5){\circle*{1}}\put(5.5,12.5){\circle*{1}}
+ \put(6.5,12.5){\circle*{1}}\put(7.5,12.5){\circle*{1}}
+ \put(8.5,12.5){\circle*{1}}\put(9.5,12.5){\circle*{1}}
+ \put(10.5,12.5){\circle*{1}}\put(11.5,12.5){\circle*{1}}
+ \put(12.5,12.5){\circle*{1}}\put(13.5,12.5){\circle*{1}}
+ \put(14.5,12.5){\circle*{1}}\put(15.5,12.5){\circle*{1}}
+ \put(16.5,12.5){\circle*{1}}\put(17.5,12.5){\circle*{1}}
+ \put(18.5,12.5){\circle*{1}}\put(19.5,12.5){\circle*{1}}
+ \put(20.5,12.5){\circle*{1}}\put(20.5,13.5){\circle*{1}}
+ \put(21.5,12.5){\circle*{1}}\put(21.5,13.5){\circle*{1}}
+ \put(21.5,14.5){\circle*{1}}\put(22.5,12.5){\circle*{1}}
+ \put(22.5,13.5){\circle*{1}}\put(23.5,12.5){\circle*{1}}
+ \end{picture}}
+ \put(0,15.5){%
+ \begin{picture}(28,24)(-2,0)%Bitmap 2460 san
+ \put(0.5,2.5){\circle*{1}}\put(1.5,2.5){\circle*{1}}
+ \put(2.5,2.5){\circle*{1}}\put(2.5,21.5){\circle*{1}}
+ \put(3.5,2.5){\circle*{1}}\put(3.5,21.5){\circle*{1}}
+ \put(4.5,2.5){\circle*{1}}\put(4.5,12.5){\circle*{1}}
+ \put(4.5,21.5){\circle*{1}}\put(5.5,2.5){\circle*{1}}
+ \put(5.5,12.5){\circle*{1}}\put(5.5,21.5){\circle*{1}}
+ \put(6.5,2.5){\circle*{1}}\put(6.5,12.5){\circle*{1}}
+ \put(6.5,21.5){\circle*{1}}\put(7.5,2.5){\circle*{1}}
+ \put(7.5,12.5){\circle*{1}}\put(7.5,21.5){\circle*{1}}
+ \put(8.5,2.5){\circle*{1}}\put(8.5,12.5){\circle*{1}}
+ \put(8.5,21.5){\circle*{1}}\put(9.5,2.5){\circle*{1}}
+ \put(9.5,12.5){\circle*{1}}\put(9.5,21.5){\circle*{1}}
+ \put(10.5,2.5){\circle*{1}}\put(10.5,12.5){\circle*{1}}
+ \put(10.5,21.5){\circle*{1}}\put(11.5,2.5){\circle*{1}}
+ \put(11.5,12.5){\circle*{1}}\put(11.5,21.5){\circle*{1}}
+ \put(12.5,2.5){\circle*{1}}\put(12.5,12.5){\circle*{1}}
+ \put(12.5,21.5){\circle*{1}}\put(13.5,2.5){\circle*{1}}
+ \put(13.5,12.5){\circle*{1}}\put(13.5,21.5){\circle*{1}}
+ \put(14.5,2.5){\circle*{1}}\put(14.5,12.5){\circle*{1}}
+ \put(14.5,21.5){\circle*{1}}\put(15.5,2.5){\circle*{1}}
+ \put(15.5,12.5){\circle*{1}}\put(15.5,21.5){\circle*{1}}
+ \put(16.5,2.5){\circle*{1}}\put(16.5,12.5){\circle*{1}}
+ \put(16.5,21.5){\circle*{1}}\put(17.5,2.5){\circle*{1}}
+ \put(17.5,12.5){\circle*{1}}\put(17.5,13.5){\circle*{1}}
+ \put(17.5,21.5){\circle*{1}}\put(18.5,2.5){\circle*{1}}
+ \put(18.5,12.5){\circle*{1}}\put(18.5,13.5){\circle*{1}}
+ \put(18.5,21.5){\circle*{1}}\put(19.5,2.5){\circle*{1}}
+ \put(19.5,12.5){\circle*{1}}\put(19.5,21.5){\circle*{1}}
+ \put(19.5,22.5){\circle*{1}}\put(20.5,2.5){\circle*{1}}
+ \put(20.5,21.5){\circle*{1}}\put(20.5,22.5){\circle*{1}}
+ \put(21.5,2.5){\circle*{1}}\put(21.5,3.5){\circle*{1}}
+ \put(21.5,21.5){\circle*{1}}\put(22.5,2.5){\circle*{1}}
+ \put(22.5,3.5){\circle*{1}}\put(23.5,2.5){\circle*{1}}
+ \end{picture}}
+ \end{picture}
+\end{center}
+
+The japanese characters on the right are harder to read than the ones on the
+left. This problem is partly alleviated if one uses vertically, characters with
+minimized height that have been created for horizontal use. As discussed
+before, the vertical distance between such characters and their horizontal
+baseline is respected. This space could occasionally act as breathing space if
+such horizontal characters were to be used vertically. But this is nevertheless
+not satisfactory since an incomplete and unnatural solution. The only way to
+avoid this problem altogether is to use fixed height characters when writing
+japanese vertically, just as was done in the left column.
+
+The conclusion seems clear. If you intend to use your \JemTeX\ fonts vertically
+with some vertical writing style unknown to me, you should definitely create
+fixed width and fixed height fonts. This is the only natural choice available.
+If you will use your fonts only horizontally, then you probably want minimized
+width fonts. Personally, I also minimized their height since the resulting
+fonts are slightly smaller in size.
+
+\label{positioning}
+
+The second topic I would like to discuss here is relevant primarily for
+horizontal writing. Given intermixed roman and japanese characters, how should
+they relate to one another. More precisely, how tall should japanese characters
+be with respect to capital roman ones, and what vertical relationship should
+they have with their horizontal baseline.
+
+It is a fact that most japanese characters are far more complex than any given
+roman one. Therefore, japanese character should be relatively big. On the other
+hand, tall centered japanese characters will lie lower on the horizontal
+baseline than capital roman characters do, and will extend vertically more than
+capital roman ones do. Consequently, the reader's eyes might have to go up and
+down as they look over the text horizontally. A compromise is clearly called
+for.
+
+The first writing style considered here will be referred to as a {\em
+dictionary\/} style since usually used in japanese dictionaries. In this style,
+japanese characters are substantially taller than capital roman ones. This
+makes it possible to use small japanese characters along with even smaller
+roman ones to save space while maintaining readability. The japanese characters
+also lie quite low on the horizontal baseline and extend vertically exactly the
+same as capital roman characters do. Take a close look at your favorite
+japanese dictionary.
+
+I will refer to a more conventional japanese font as a {\em standard\/} style.
+In this one, the japanese characters are still taller than capital roman ones,
+but by a smaller amount than before. The japanese characters lie a little bit
+lower on the horizontal baseline than capital roman characters do, and also
+extend a little bit more vertically than capital roman ones do. They are
+vertically centered as well as possible with respect to capital roman letter.
+Many users of \JemTeX\ requested such a font style.
+
+Here again, you will have to decide which style you prefer. In the first two
+releases of \JemTeX, I used my japanese dictionaries to derive ideal font
+characteristics. Since then, numerous people taught me that dictionary fonts
+are quite specialized. Chances are you will want to use the standard style.
+Personally, I am now permanently switching to it.
+
+\subsection{The {\tt JIS2MF} Code Generator}
+\label{thejis2mfcodegenerator}
+
+Given a bitmap, my program \verb"JIS2MF" can construct an equivalent continuous
+character and generate \MFT\ code for it. The \MFT\ program can then use this
+code to generate a standard \TeX\ font. You have been supplied with the source
+and the compressed compiled version of this Pascal program. Note that the file
+\verb"JIS24" should be available in the current directory to run \verb"JIS2MF".
+This fairly big file contains all the bitmaps making up the JIS~24 dot font.
+
+The first practical problem is to decide on font names and their content. Not
+everybody is running newer versions of \TeX\ and its drivers, allowing for
+256~characters in a font. This includes me! Therefore, I put only
+128~characters in my fonts. Unfortunately, this implies that I cannot use the
+same scheme as J\TeX\ since the latter uses 256~characters per font. However, I
+keep my new standard simple by organizing characters sequentially. I also leave
+character~0 of the first font empty so that character~$x$ of the first font
+corresponds to bitmap~$x$ of the JIS~24 dot font.
+
+\TeX\ does not allow numbers in font names. Therefore, the names \verb"kanji00"
+all the way to \verb"kanji60" are not possible. Table~\ref{thejemtexfonts}
+lists the names I am using.
+
+\begin{table}[htb]
+ \begin{center}
+ \begin{footnotesize}
+ \begin{tabular}{cccccccc}
+ \verb"kanjiaa" & \verb"kanjiab" & \verb"kanjiac" & \verb"kanjiad" &
+ \verb"kanjiae" & \verb"kanjiaf" & \verb"kanjiag" & \verb"kanjiah" \\
+ $\vdots$ & $\vdots$ & $\vdots$ & $\vdots$ &
+ $\vdots$ & $\vdots$ & $\vdots$ & $\vdots$ \\
+ \verb"kanjiga" & \verb"kanjigb" & \verb"kanjigc" & \verb"kanjigd" &
+ \verb"kanjige" & \verb"kanjigf" & \verb"kanjigg" & \verb"kanjigh" \\
+ \verb"kanjiha" & \verb"kanjihb" & \verb"kanjihc" & \verb"kanjihd" &
+ \verb"kanjihe"
+ \end{tabular}
+ \end{footnotesize}
+ \end{center}
+ \caption{The \JemTeX\ Fonts.}
+ \label{thejemtexfonts}
+\end{table}
+
+\begin{table}[htb]
+ \begin{center}
+ \begin{minipage}{\textwidth}
+ \begin{small}
+ \begin{tabbing}
+ \verb"kanjiaa": Beginning of common english and japanese characters. \\
+ \verb"kanjiae": Most foreign characters. \\
+ \verb"kanjiaf": Beginning of most extended characters. \\
+ \verb"kanjiba": First of three empty fonts. \\
+ \verb"kanjibd": Beginning of level~1 kanjis. \\
+ \verb"kanjiec": Transition between level~1 and level~2 kanjis. \\
+ \verb"kanjihe": End of level~2 kanjis.
+ \end{tabbing}
+ \end{small}
+ \end{minipage}
+ \end{center}
+ \caption{Description of the \JemTeX\ Fonts.}
+ \label{descriptionofthejemtexfonts}
+\end{table}
+
+Several users complained about the time necessary to generate these fonts,
+especially on the original 4.77~MHz IBM-PC. To help them decide which \JemTeX\
+fonts they are likely to need, Table~\ref{descriptionofthejemtexfonts} contains
+a brief description of all of them. I found through daily use that I almost
+never use level~2 fonts. However, a typical 4~page document uses every level~1
+font.
+
+The last remaining preliminary detail is the question of bitmap numbering. The
+bitmaps in \verb"JIS24" are numbered consecutively from~1 to~7806. The first
+bitmap is empty, since it is the japanese space character. Many other
+characters in the \JemTeX\ extended JIS~24 dot font are also left empty.
+\verb"JIS2MF" ignores such characters altogether and will leave an undefined
+character when it encounters one. This can be quite handy for somebody wishing
+to create fonts using some other standard, like J\TeX. Suppose you wish to
+leave some characters undefined in the font you are currently building. By
+specifying bitmap~1 at the right places, the corresponding characters will be
+left undefined.
+
+My utility \verb"JIS2MF" requires the following information to operate:
+\begin{description}
+ \item[Font Name:] The name of the font you are creating. \verb"JIS2MF" will
+ add for you the extension \verb".mf", so do not specify it.
+ The program also acts differently depending on whether or
+ not the font name you supply is a \JemTeX\ font name, like
+ \verb"kanjidf".
+ \item[Writing Style:] The characteristics of your font, essentially fixed
+ versus proportional dimensions and dictionary versus
+ standard positioning of the japanese characters.
+ \item[Bitmap Numbers:] The number of all the bitmaps making up the current
+ font. Specifying bitmap~0 terminates the process.
+\end{description}
+
+\begin{table}[htb]
+ \begin{center}
+ \begin{tabular}{l|cccc}
+ {\tt JIS2MF} & Command Line & Font & Writing & Bitmap \\
+ Mode & Parameters & Name & Style & Numbers \\
+ \hline
+ Manual & $\times$ & $\surd$ & $\surd$ & $\surd$ \\
+ Semi-Automatic & $\surd$ & (other) & Optional & $\surd$ \\
+ Automatic & $\surd$ & (\JemTeX) & Optional & $\times$ \\
+ Batch & $\surd$ & $\times$ & Optional & $\times$
+ \end{tabular}
+ \end{center}
+ \caption{The {\tt JIS2MF} Modes.}
+ \label{thejis2mfmodes}
+\end{table}
+
+How much and what information you must supply depends on which mode
+\verb"JIS2MF" is in when you run it. Table~\ref{thejis2mfmodes} shows all the
+modes currently available.
+
+If you simply start \verb"JIS2MF" without any command line information, it will
+run in manual mode where you must answer questions interactively throughout the
+operation. In Table~\ref{thejis2mfmodes}, a $\surd$ indicates information that
+will be required of you interactively. A $\times$ indicates information
+irrelevant, or that you will not be asked for interactively.
+
+The other three more advanced modes can only be accessed by specifying some
+additional command line information. First, you can specify on the command line
+the name of the font to be built. For example, here is how I would generate the
+first \JemTeX\ font:
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+JIS2MF kanjiaa
+\end{verbatim}
+\end{quote}
+You can also add to such a command some \verb"JIS2MF" parameters. These always
+begin with a \verb"/" or a \verb"-", and any combination or small and capital
+letters is acceptable.
+
+For the last three modes listed in Table~\ref{thejis2mfmodes}, proportional
+width, proportional height, and standard positioning are assumed as default
+writing styles. However, you may override or confirm any of these default
+values with the appropriate command line parameter. The recognized ones are
+listed in Tables~\ref{widthparameters}, \ref{heightparameters},
+and~\ref{positioningparameters}.
+
+\vspace*{\fill}
+
+\begin{table}[htb]
+ \begin{center}
+ \begin{tabular}{ll}
+ \mbox{$\left.\parbox{4.6cm}{%
+ \verb"/FixedWidth" \\
+ \verb"/FixedX" \\
+ \verb"/NoProportionalWidth" \\
+ \verb"/NoProportionalX"}\right\}$} & Fixed width. \\[8mm]
+ \mbox{$\left.\parbox{4.6cm}{%
+ \verb"/NoFixedWidth" \\
+ \verb"/NoFixedX" \\
+ \verb"/ProportionalWidth" \\
+ \verb"/ProportionalX"}\right\}$} & Minimized width.
+ \end{tabular}
+ \end{center}
+ \caption{Width Parameters.}
+ \label{widthparameters}
+\end{table}
+
+\vspace*{\fill}
+
+\newpage %improve a bad page break
+
+\begin{table}[htb]
+ \begin{center}
+ \begin{tabular}{ll}
+ \mbox{$\left.\parbox{4.6cm}{%
+ \verb"/FixedHeight" \\
+ \verb"/FixedY" \\
+ \verb"/NoProportionalHeight" \\
+ \verb"/NoProportionalY"}\right\}$} & Fixed height. \\[8mm]
+ \mbox{$\left.\parbox{4.6cm}{%
+ \verb"/NoFixedHeight" \\
+ \verb"/NoFixedY" \\
+ \verb"/ProportionalHeight" \\
+ \verb"/ProportionalY"}\right\}$} & Minimized height.
+ \end{tabular}
+ \end{center}
+ \caption{Height Parameters.}
+ \label{heightparameters}
+ \begin{center}
+ \begin{tabular}{ll}
+ \verb"/Standard" & Standard positioning. \\
+ \verb"/Dictionary" & Dictionary positioning.
+ \end{tabular}
+ \end{center}
+ \caption{Positioning Parameters.}
+ \label{positioningparameters}
+\end{table}
+
+Here is how I would generate a \JemTeX\ font to be used vertically:
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+JIS2MF kanjiaa /FixedWidth /FixedHeight
+\end{verbatim}
+\end{quote}
+In the last two examples, since the font names specified are \JemTeX\ font
+names, \verb"JIS2MF" supplies all the bitmap numbers for you; that's the
+automatic mode. If the font name is not a \JemTeX\ one, then you are asked
+interactively for the bitmap numbers; that's the semi-automatic mode. If you
+plan on using a lot \verb"JIS2MF" semi-automatically, you may find piping
+advantageous.
+
+\label{batch}
+
+The remaining mode is the batch mode. As its name implies, it is designed for
+people using batch files. To trigger this mode, use the \verb"/batch" command
+line parameter. In this mode, \verb"JIS2MF" looks in the current directory to
+determine the latest \JemTeX\ font generated. It then generates the next one,
+if possible.
+
+There are two ways of using this feature. The simplest one is to generate the
+\MFT\ code for all the \JemTeX\ fonts. To do so, create and execute the
+following \verb"SIMPLE.BAT" batch file:
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+JIS2MF /NoFixedWidth /NoFixedHeight /Standard /Batch
+IF NOT ERRORLEVEL 1 SIMPLE
+\end{verbatim}
+\end{quote}
+
+In this example, the code for the font \verb"kanjiaa" is first created. If all
+went well, \verb"SIMPLE" executes again. It finds the file \verb"kanjiaa.mf"
+in the current directory and therefore generates \verb"kanjiab.mf". Eventually,
+the code for the font \verb"kanjihe" will be produced. When called once more,
+\verb"JIS2MF" realizes that there is no such thing as a \JemTeX\ font
+\verb"kanjihf" and stops with an error. The current batch file \verb"SIMPLE"
+then terminates.
+
+Although this procedure is correct, it also requires 36~Mb of disk space! To
+avoid this, I use a more involved procedure. Here is the batch file
+\verb"COMPLEX.BAT":
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+JIS2MF /NoFixedWidth /NoFixedHeight /Standard /Batch
+IF ERRORLEVEL 1 GOTO TERMINATE
+FOR %%1 IN (kanji??.mf) DO CALL METAFONT %%1
+ERASE kanji??.mf
+COMPLEX
+:TERMINATE
+\end{verbatim}
+\end{quote}
+
+As in the previous example, \verb"JIS2MF" first creates the file
+\verb"kanjiaa.mf". The batch file \verb"METAFONT.BAT" is then called with the
+parameter \verb"kanjiaa.mf". \MFT\ is to be discussed in
+Subsection~\ref{runningmetafont}, but suffice to say that the files
+\verb"kanjiaa.tfm" and \verb"kanjiaa.pk" are created by the subroutine
+\verb"METAFONT". To save disk space, the file \verb"kanjiaa.mf" is then
+deleted. Finally, this cycle starts all over again. This procedure works fine
+because \verb"JIS2MF" looks for \verb"*.mf" {\em and\/} \verb"*.tfm" files when
+trying to decide which font should be handled next.
+
+\subsection{Running METAFONT}
+\label{runningmetafont}
+
+The \MFT\ program comes in two versions; a small one with a 64~Kb work space,
+and a big one with a 256~Kb work space. Although the big version is more
+capable, the small one is preferred whenever possible since it runs faster.
+Here is a list of the \emTeX\ files necessary for the small 80286 version:
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+MF EXE 197840 8-04-90 10:29p
+MF POO 23028 8-04-90 9:42p
+CM BAS 107412 9-19-90 11:13a
+\end{verbatim}
+\end{quote}
+
+\newpage %improve a bad page break
+
+The files for the big 80286 version are:
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+MF EXE 238996 8-04-90 11:15p
+MF POO 23028 8-04-90 10:32p
+CM BAS 215128 9-19-90 11:13a
+\end{verbatim}
+\end{quote}
+
+The program to compress the forthcoming fonts is:
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+GFTOPK EXE 52825 9-15-90 1:13a
+\end{verbatim}
+\end{quote}
+
+Finally, you also need a small file, describing the characteristics of the
+device for which the fonts are intended. I use the file \verb"epsonfx.mf",
+which is given below. Several such files are included in the file
+\verb"local.mf" supplied with \emTeX, and there are small libraries of them in
+\TeX\ circles.
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+mode_def epsonfx = % Epson FX-80 (240x216)
+ proofing:=0; % no, we're not making proofs
+ fontmaking:=1; % yes, we are making a font
+ tracingtitles:=0; % no, don't show titles in the log
+ pixels_per_inch:=240; % 240 dots/inch horizontally
+ blacker:=0; % don't make the pens any blacker
+ fillin:=0; % and don't compensate for fillin
+ o_correction:=.2; % but suppress most overshoots
+ aspect_ratio:=9/10; % 216 dots/inch vertically
+ enddef;
+\end{verbatim}
+\end{quote}
+
+Font sizes are measured in magsteps. Typical magsteps are~$0.0$, $0.5$, $1.0$,
+$2.0$, $3.0$, $4.0$, and~$5.0$. I find that most kanjis look acceptable on my
+\mbox{9-pin} printer starting at magstep~$2.0$, and all kanjis are acceptable
+starting at magstep~$3.0$. Hiraganas and katakanas are fairly simple
+characters, and they look good at any magsteps. Table~\ref{12ptfontsizes} on
+page~\pageref{12ptfontsizes} lists common font sizes.
+
+\label{mftproof}
+
+You can run big \MFT\ in proof mode where each character is displayed
+graphically, but no font useful for us is created. The command I use is:
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+MF &cm kanjiaa >NUL:
+\end{verbatim}
+\end{quote}
+
+\newpage %improve a bad page break
+
+\label{mftstandard}
+
+You can run small \MFT\ in standard mode, which will generate usable fonts.
+Here are the commands to create \verb"kanjiaa.tfm" and \verb"kanjiaa.pk":
+\begin{quote}
+\begin{small}%Don't put spaces after the next line!
+\begin{verbatim}
+MF &cm \mode:=epsonfx; \mag:=magstep(0.0); \input kanjiaa.mf
+GFTOPK kanjiaa.240
+\end{verbatim}
+\end{small}
+\end{quote}
+
+The file name extension \verb".240" refers to the resolution of my printer,
+resolution specified in the file \verb"epsonfx.mf". It may be different in your
+case. Finally, note that this extension also changes with the magstep used. For
+magstep~$5.0$, it becomes in my case $240 \times 1.2^{5.0} \approx 597$.
+
+Here is my batch file \verb"METAFONT.BAT":
+\begin{quote}
+\begin{small}%Don't put spaces after the next line!
+\begin{verbatim}
+MF &cm \mode:=epsonfx; \mag:=magstep(5.0); \input %1
+FOR %%1 IN (kanji??.597) DO GFTOPK %%1
+ERASE kanji??.597
+ERASE kanji??.log
+\end{verbatim}
+\end{small}
+\end{quote}
+
+\subsection{The METAFONT Code}
+\label{themetafontcode}
+
+In this subsection, I will briefly go over the \MFT\ code produced by my
+program for a typical standard style font. This code can be crudely divided
+into four parts:
+\begin{itemize}
+ \item Initial Header.
+ \item Macro Definitions.
+ \item Character Definitions.
+ \item Final Header.
+\end{itemize}
+
+The header begins with the following command requesting memory usage statistics
+in the \verb".log" file produced along with each font by \MFT:
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+tracingstats:=1;
+\end{verbatim}
+\end{quote}
+
+In proof mode, \MFT\ displays the characters in graphics mode provided it knows
+the resolution of your device. I use the following, which you may decide to
+change according to your hardware:
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+screen_cols:=640; %VGA
+screen_rows:=480; %VGA
+\end{verbatim}
+\end{quote}
+
+The font design size, a fundamental unit of measurement, and character
+positioning are then supplied. I use the following for standard \JemTeX\ fonts:
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+font_size 10pt#;
+u#:=12.7/36pt#;
+body_height#:=23.25u#;
+desc_depth#:=4.75u#;
+\end{verbatim}
+\end{quote}
+
+Each underlying bitmap is $24u$~by~$24u$, and an empty border of $2u$ is left
+around every japanese characters. In a standard style, each character can
+extend vertically potentially by as much as $23.25u$ above its horizontal
+baseline, and $4.75u$ below it, for a total of $28u$. Note that these are the
+biggest values that can occur. In practice, the actual values are supplied for
+each character when they are defined. For a fixed height font, the actual
+values are always equal to these extreme values. Finally, the width is handled
+differently by \MFT\ since only the actual width needs to be specified for each
+character.
+
+At this point, a whole series of parameters is necessary for the Computer
+Modern base. The minimum set of them is set to~\verb"0pt" whenever possible. I
+solve the few occurring overflows by setting the right parameters
+to~\verb"1pt". None of these parameters appears useful since my japanese
+characters use only very primitive \MFT\ operators. But \MFT\ insists on all
+its parameters to be set anyway.
+
+\MFT\ is then initialized with:
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+mode_setup;
+font_setup;
+\end{verbatim}
+\end{quote}
+
+The macros to be used in drawing the characters follow. Each dot making up the
+current bitmap lies in a square which I refer to by its lower left $z=(x,y)$
+coordinates. I declare that variable $z$ with:
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+pair z;
+\end{verbatim}
+\end{quote}
+
+A number of macros to draw squares, triangles, reverse triangles, and quarter
+circles are then included. All these have only one parameter; $z$. They are
+illustrated in Figures~\ref{shortpatches} and~\ref{longpatches}.
+
+\newpage %improve a bad page break
+
+\begin{figure}[htb]
+ \begin{center}
+ \setlength{\unitlength}{0.38pt}
+ \begin{picture}(900,900)
+ \put(0,720){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(0,90){\framebox(90,90){}}
+ \put(0,90){\makebox(90,90){sul}}
+ \end{picture}}
+ \put(240,720){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(90,90){\framebox(90,90){}}
+ \put(90,90){\makebox(90,90){sur}}
+ \end{picture}}
+ \put(480,720){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(90,0){\framebox(90,90){}}
+ \put(90,0){\makebox(90,90){sbr}}
+ \end{picture}}
+ \put(720,720){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(0,0){\framebox(90,90){}}
+ \put(0,0){\makebox(90,90){sbl}}
+ \end{picture}}
+ \put(0,480){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(90,90){\line(-1,0){90}}
+ \put(90,90){\line(0,1){90}}
+ \put(90.0,180.0){\circle*{1}}\put(88.7,180.0){\circle*{1}}
+ \put(87.5,180.0){\circle*{1}}\put(86.2,179.9){\circle*{1}}
+ \put(84.9,179.9){\circle*{1}}\put(83.6,179.8){\circle*{1}}
+ \put(82.4,179.7){\circle*{1}}\put(81.1,179.6){\circle*{1}}
+ \put(79.8,179.4){\circle*{1}}\put(78.5,179.3){\circle*{1}}
+ \put(77.3,179.1){\circle*{1}}\put(76.0,178.9){\circle*{1}}
+ \put(74.7,178.7){\circle*{1}}\put(73.5,178.5){\circle*{1}}
+ \put(72.2,178.2){\circle*{1}}\put(70.9,178.0){\circle*{1}}
+ \put(69.6,177.7){\circle*{1}}\put(68.4,177.4){\circle*{1}}
+ \put(67.1,177.0){\circle*{1}}\put(65.8,176.7){\circle*{1}}
+ \put(64.5,176.3){\circle*{1}}\put(63.3,175.9){\circle*{1}}
+ \put(62.0,175.5){\circle*{1}}\put(60.7,175.1){\circle*{1}}
+ \put(59.5,174.7){\circle*{1}}\put(58.2,174.2){\circle*{1}}
+ \put(56.9,173.7){\circle*{1}}\put(55.6,173.2){\circle*{1}}
+ \put(54.4,172.6){\circle*{1}}\put(53.1,172.1){\circle*{1}}
+ \put(51.8,171.5){\circle*{1}}\put(50.5,170.9){\circle*{1}}
+ \put(49.3,170.3){\circle*{1}}\put(48.0,169.6){\circle*{1}}
+ \put(46.7,168.9){\circle*{1}}\put(45.5,168.2){\circle*{1}}
+ \put(44.2,167.5){\circle*{1}}\put(42.9,166.7){\circle*{1}}
+ \put(41.6,165.9){\circle*{1}}\put(40.4,165.1){\circle*{1}}
+ \put(39.1,164.2){\circle*{1}}\put(37.8,163.3){\circle*{1}}
+ \put(36.5,162.4){\circle*{1}}\put(35.3,161.4){\circle*{1}}
+ \put(34.0,160.5){\circle*{1}}\put(32.7,159.4){\circle*{1}}
+ \put(31.5,158.4){\circle*{1}}\put(30.2,157.2){\circle*{1}}
+ \put(28.9,156.1){\circle*{1}}\put(27.6,154.9){\circle*{1}}
+ \put(26.4,153.6){\circle*{1}}\put(0.0,90.0){\circle*{1}}
+ \put(0.0,91.3){\circle*{1}}\put(0.0,92.5){\circle*{1}}
+ \put(0.1,93.8){\circle*{1}}\put(0.1,95.1){\circle*{1}}
+ \put(0.2,96.4){\circle*{1}}\put(0.3,97.6){\circle*{1}}
+ \put(0.4,98.9){\circle*{1}}\put(0.6,100.2){\circle*{1}}
+ \put(0.7,101.5){\circle*{1}}\put(0.9,102.7){\circle*{1}}
+ \put(1.1,104.0){\circle*{1}}\put(1.3,105.3){\circle*{1}}
+ \put(1.5,106.5){\circle*{1}}\put(1.8,107.8){\circle*{1}}
+ \put(2.0,109.1){\circle*{1}}\put(2.3,110.4){\circle*{1}}
+ \put(2.6,111.6){\circle*{1}}\put(3.0,112.9){\circle*{1}}
+ \put(3.3,114.2){\circle*{1}}\put(3.7,115.5){\circle*{1}}
+ \put(4.1,116.7){\circle*{1}}\put(4.5,118.0){\circle*{1}}
+ \put(4.9,119.3){\circle*{1}}\put(5.3,120.5){\circle*{1}}
+ \put(5.8,121.8){\circle*{1}}\put(6.3,123.1){\circle*{1}}
+ \put(6.8,124.4){\circle*{1}}\put(7.4,125.6){\circle*{1}}
+ \put(7.9,126.9){\circle*{1}}\put(8.5,128.2){\circle*{1}}
+ \put(9.1,129.5){\circle*{1}}\put(9.7,130.7){\circle*{1}}
+ \put(10.4,132.0){\circle*{1}}\put(11.1,133.3){\circle*{1}}
+ \put(11.8,134.5){\circle*{1}}\put(12.5,135.8){\circle*{1}}
+ \put(13.3,137.1){\circle*{1}}\put(14.1,138.4){\circle*{1}}
+ \put(14.9,139.6){\circle*{1}}\put(15.8,140.9){\circle*{1}}
+ \put(16.7,142.2){\circle*{1}}\put(17.6,143.5){\circle*{1}}
+ \put(18.6,144.7){\circle*{1}}\put(19.5,146.0){\circle*{1}}
+ \put(20.6,147.3){\circle*{1}}\put(21.6,148.5){\circle*{1}}
+ \put(22.8,149.8){\circle*{1}}\put(23.9,151.1){\circle*{1}}
+ \put(25.1,152.4){\circle*{1}}
+ \put(30,90){\makebox(60,60){cul}}
+ \end{picture}}
+ \put(240,480){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(90,90){\line(1,0){90}}
+ \put(90,90){\line(0,1){90}}
+ \put(90.0,180.0){\circle*{1}}\put(91.3,180.0){\circle*{1}}
+ \put(92.5,180.0){\circle*{1}}\put(93.8,179.9){\circle*{1}}
+ \put(95.1,179.9){\circle*{1}}\put(96.4,179.8){\circle*{1}}
+ \put(97.6,179.7){\circle*{1}}\put(98.9,179.6){\circle*{1}}
+ \put(100.2,179.4){\circle*{1}}\put(101.5,179.3){\circle*{1}}
+ \put(102.7,179.1){\circle*{1}}\put(104.0,178.9){\circle*{1}}
+ \put(105.3,178.7){\circle*{1}}\put(106.5,178.5){\circle*{1}}
+ \put(107.8,178.2){\circle*{1}}\put(109.1,178.0){\circle*{1}}
+ \put(110.4,177.7){\circle*{1}}\put(111.6,177.4){\circle*{1}}
+ \put(112.9,177.0){\circle*{1}}\put(114.2,176.7){\circle*{1}}
+ \put(115.5,176.3){\circle*{1}}\put(116.7,175.9){\circle*{1}}
+ \put(118.0,175.5){\circle*{1}}\put(119.3,175.1){\circle*{1}}
+ \put(120.5,174.7){\circle*{1}}\put(121.8,174.2){\circle*{1}}
+ \put(123.1,173.7){\circle*{1}}\put(124.4,173.2){\circle*{1}}
+ \put(125.6,172.6){\circle*{1}}\put(126.9,172.1){\circle*{1}}
+ \put(128.2,171.5){\circle*{1}}\put(129.5,170.9){\circle*{1}}
+ \put(130.7,170.3){\circle*{1}}\put(132.0,169.6){\circle*{1}}
+ \put(133.3,168.9){\circle*{1}}\put(134.5,168.2){\circle*{1}}
+ \put(135.8,167.5){\circle*{1}}\put(137.1,166.7){\circle*{1}}
+ \put(138.4,165.9){\circle*{1}}\put(139.6,165.1){\circle*{1}}
+ \put(140.9,164.2){\circle*{1}}\put(142.2,163.3){\circle*{1}}
+ \put(143.5,162.4){\circle*{1}}\put(144.7,161.4){\circle*{1}}
+ \put(146.0,160.5){\circle*{1}}\put(147.3,159.4){\circle*{1}}
+ \put(148.5,158.4){\circle*{1}}\put(149.8,157.2){\circle*{1}}
+ \put(151.1,156.1){\circle*{1}}\put(152.4,154.9){\circle*{1}}
+ \put(153.6,153.6){\circle*{1}}\put(180.0,90.0){\circle*{1}}
+ \put(180.0,91.3){\circle*{1}}\put(180.0,92.5){\circle*{1}}
+ \put(179.9,93.8){\circle*{1}}\put(179.9,95.1){\circle*{1}}
+ \put(179.8,96.4){\circle*{1}}\put(179.7,97.6){\circle*{1}}
+ \put(179.6,98.9){\circle*{1}}\put(179.4,100.2){\circle*{1}}
+ \put(179.3,101.5){\circle*{1}}\put(179.1,102.7){\circle*{1}}
+ \put(178.9,104.0){\circle*{1}}\put(178.7,105.3){\circle*{1}}
+ \put(178.5,106.5){\circle*{1}}\put(178.2,107.8){\circle*{1}}
+ \put(178.0,109.1){\circle*{1}}\put(177.7,110.4){\circle*{1}}
+ \put(177.4,111.6){\circle*{1}}\put(177.0,112.9){\circle*{1}}
+ \put(176.7,114.2){\circle*{1}}\put(176.3,115.5){\circle*{1}}
+ \put(175.9,116.7){\circle*{1}}\put(175.5,118.0){\circle*{1}}
+ \put(175.1,119.3){\circle*{1}}\put(174.7,120.5){\circle*{1}}
+ \put(174.2,121.8){\circle*{1}}\put(173.7,123.1){\circle*{1}}
+ \put(173.2,124.4){\circle*{1}}\put(172.6,125.6){\circle*{1}}
+ \put(172.1,126.9){\circle*{1}}\put(171.5,128.2){\circle*{1}}
+ \put(170.9,129.5){\circle*{1}}\put(170.3,130.7){\circle*{1}}
+ \put(169.6,132.0){\circle*{1}}\put(168.9,133.3){\circle*{1}}
+ \put(168.2,134.5){\circle*{1}}\put(167.5,135.8){\circle*{1}}
+ \put(166.7,137.1){\circle*{1}}\put(165.9,138.4){\circle*{1}}
+ \put(165.1,139.6){\circle*{1}}\put(164.2,140.9){\circle*{1}}
+ \put(163.3,142.2){\circle*{1}}\put(162.4,143.5){\circle*{1}}
+ \put(161.4,144.7){\circle*{1}}\put(160.5,146.0){\circle*{1}}
+ \put(159.4,147.3){\circle*{1}}\put(158.4,148.5){\circle*{1}}
+ \put(157.2,149.8){\circle*{1}}\put(156.1,151.1){\circle*{1}}
+ \put(154.9,152.4){\circle*{1}}
+ \put(90,90){\makebox(60,60){cur}}
+ \end{picture}}
+ \put(480,480){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(90,90){\line(1,0){90}}
+ \put(90,90){\line(0,-1){90}}
+ \put(90.0,0.0){\circle*{1}}\put(91.3,0.0){\circle*{1}}
+ \put(92.5,0.0){\circle*{1}}\put(93.8,0.1){\circle*{1}}
+ \put(95.1,0.1){\circle*{1}}\put(96.4,0.2){\circle*{1}}
+ \put(97.6,0.3){\circle*{1}}\put(98.9,0.4){\circle*{1}}
+ \put(100.2,0.6){\circle*{1}}\put(101.5,0.7){\circle*{1}}
+ \put(102.7,0.9){\circle*{1}}\put(104.0,1.1){\circle*{1}}
+ \put(105.3,1.3){\circle*{1}}\put(106.5,1.5){\circle*{1}}
+ \put(107.8,1.8){\circle*{1}}\put(109.1,2.0){\circle*{1}}
+ \put(110.4,2.3){\circle*{1}}\put(111.6,2.6){\circle*{1}}
+ \put(112.9,3.0){\circle*{1}}\put(114.2,3.3){\circle*{1}}
+ \put(115.5,3.7){\circle*{1}}\put(116.7,4.1){\circle*{1}}
+ \put(118.0,4.5){\circle*{1}}\put(119.3,4.9){\circle*{1}}
+ \put(120.5,5.3){\circle*{1}}\put(121.8,5.8){\circle*{1}}
+ \put(123.1,6.3){\circle*{1}}\put(124.4,6.8){\circle*{1}}
+ \put(125.6,7.4){\circle*{1}}\put(126.9,7.9){\circle*{1}}
+ \put(128.2,8.5){\circle*{1}}\put(129.5,9.1){\circle*{1}}
+ \put(130.7,9.7){\circle*{1}}\put(132.0,10.4){\circle*{1}}
+ \put(133.3,11.1){\circle*{1}}\put(134.5,11.8){\circle*{1}}
+ \put(135.8,12.5){\circle*{1}}\put(137.1,13.3){\circle*{1}}
+ \put(138.4,14.1){\circle*{1}}\put(139.6,14.9){\circle*{1}}
+ \put(140.9,15.8){\circle*{1}}\put(142.2,16.7){\circle*{1}}
+ \put(143.5,17.6){\circle*{1}}\put(144.7,18.6){\circle*{1}}
+ \put(146.0,19.5){\circle*{1}}\put(147.3,20.6){\circle*{1}}
+ \put(148.5,21.6){\circle*{1}}\put(149.8,22.8){\circle*{1}}
+ \put(151.1,23.9){\circle*{1}}\put(152.4,25.1){\circle*{1}}
+ \put(153.6,26.4){\circle*{1}}\put(180.0,90.0){\circle*{1}}
+ \put(180.0,88.7){\circle*{1}}\put(180.0,87.5){\circle*{1}}
+ \put(179.9,86.2){\circle*{1}}\put(179.9,84.9){\circle*{1}}
+ \put(179.8,83.6){\circle*{1}}\put(179.7,82.4){\circle*{1}}
+ \put(179.6,81.1){\circle*{1}}\put(179.4,79.8){\circle*{1}}
+ \put(179.3,78.5){\circle*{1}}\put(179.1,77.3){\circle*{1}}
+ \put(178.9,76.0){\circle*{1}}\put(178.7,74.7){\circle*{1}}
+ \put(178.5,73.5){\circle*{1}}\put(178.2,72.2){\circle*{1}}
+ \put(178.0,70.9){\circle*{1}}\put(177.7,69.6){\circle*{1}}
+ \put(177.4,68.4){\circle*{1}}\put(177.0,67.1){\circle*{1}}
+ \put(176.7,65.8){\circle*{1}}\put(176.3,64.5){\circle*{1}}
+ \put(175.9,63.3){\circle*{1}}\put(175.5,62.0){\circle*{1}}
+ \put(175.1,60.7){\circle*{1}}\put(174.7,59.5){\circle*{1}}
+ \put(174.2,58.2){\circle*{1}}\put(173.7,56.9){\circle*{1}}
+ \put(173.2,55.6){\circle*{1}}\put(172.6,54.4){\circle*{1}}
+ \put(172.1,53.1){\circle*{1}}\put(171.5,51.8){\circle*{1}}
+ \put(170.9,50.5){\circle*{1}}\put(170.3,49.3){\circle*{1}}
+ \put(169.6,48.0){\circle*{1}}\put(168.9,46.7){\circle*{1}}
+ \put(168.2,45.5){\circle*{1}}\put(167.5,44.2){\circle*{1}}
+ \put(166.7,42.9){\circle*{1}}\put(165.9,41.6){\circle*{1}}
+ \put(165.1,40.4){\circle*{1}}\put(164.2,39.1){\circle*{1}}
+ \put(163.3,37.8){\circle*{1}}\put(162.4,36.5){\circle*{1}}
+ \put(161.4,35.3){\circle*{1}}\put(160.5,34.0){\circle*{1}}
+ \put(159.4,32.7){\circle*{1}}\put(158.4,31.5){\circle*{1}}
+ \put(157.2,30.2){\circle*{1}}\put(156.1,28.9){\circle*{1}}
+ \put(154.9,27.6){\circle*{1}}
+ \put(90,30){\makebox(60,60){cbr}}
+ \end{picture}}
+ \put(720,480){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(90,90){\line(-1,0){90}}
+ \put(90,90){\line(0,-1){90}}
+ \put(90.0,0.0){\circle*{1}}\put(88.7,0.0){\circle*{1}}
+ \put(87.5,0.0){\circle*{1}}\put(86.2,0.1){\circle*{1}}
+ \put(84.9,0.1){\circle*{1}}\put(83.6,0.2){\circle*{1}}
+ \put(82.4,0.3){\circle*{1}}\put(81.1,0.4){\circle*{1}}
+ \put(79.8,0.6){\circle*{1}}\put(78.5,0.7){\circle*{1}}
+ \put(77.3,0.9){\circle*{1}}\put(76.0,1.1){\circle*{1}}
+ \put(74.7,1.3){\circle*{1}}\put(73.5,1.5){\circle*{1}}
+ \put(72.2,1.8){\circle*{1}}\put(70.9,2.0){\circle*{1}}
+ \put(69.6,2.3){\circle*{1}}\put(68.4,2.6){\circle*{1}}
+ \put(67.1,3.0){\circle*{1}}\put(65.8,3.3){\circle*{1}}
+ \put(64.5,3.7){\circle*{1}}\put(63.3,4.1){\circle*{1}}
+ \put(62.0,4.5){\circle*{1}}\put(60.7,4.9){\circle*{1}}
+ \put(59.5,5.3){\circle*{1}}\put(58.2,5.8){\circle*{1}}
+ \put(56.9,6.3){\circle*{1}}\put(55.6,6.8){\circle*{1}}
+ \put(54.4,7.4){\circle*{1}}\put(53.1,7.9){\circle*{1}}
+ \put(51.8,8.5){\circle*{1}}\put(50.5,9.1){\circle*{1}}
+ \put(49.3,9.7){\circle*{1}}\put(48.0,10.4){\circle*{1}}
+ \put(46.7,11.1){\circle*{1}}\put(45.5,11.8){\circle*{1}}
+ \put(44.2,12.5){\circle*{1}}\put(42.9,13.3){\circle*{1}}
+ \put(41.6,14.1){\circle*{1}}\put(40.4,14.9){\circle*{1}}
+ \put(39.1,15.8){\circle*{1}}\put(37.8,16.7){\circle*{1}}
+ \put(36.5,17.6){\circle*{1}}\put(35.3,18.6){\circle*{1}}
+ \put(34.0,19.5){\circle*{1}}\put(32.7,20.6){\circle*{1}}
+ \put(31.5,21.6){\circle*{1}}\put(30.2,22.8){\circle*{1}}
+ \put(28.9,23.9){\circle*{1}}\put(27.6,25.1){\circle*{1}}
+ \put(26.4,26.4){\circle*{1}}\put(0.0,90.0){\circle*{1}}
+ \put(0.0,88.7){\circle*{1}}\put(0.0,87.5){\circle*{1}}
+ \put(0.1,86.2){\circle*{1}}\put(0.1,84.9){\circle*{1}}
+ \put(0.2,83.6){\circle*{1}}\put(0.3,82.4){\circle*{1}}
+ \put(0.4,81.1){\circle*{1}}\put(0.6,79.8){\circle*{1}}
+ \put(0.7,78.5){\circle*{1}}\put(0.9,77.3){\circle*{1}}
+ \put(1.1,76.0){\circle*{1}}\put(1.3,74.7){\circle*{1}}
+ \put(1.5,73.5){\circle*{1}}\put(1.8,72.2){\circle*{1}}
+ \put(2.0,70.9){\circle*{1}}\put(2.3,69.6){\circle*{1}}
+ \put(2.6,68.4){\circle*{1}}\put(3.0,67.1){\circle*{1}}
+ \put(3.3,65.8){\circle*{1}}\put(3.7,64.5){\circle*{1}}
+ \put(4.1,63.3){\circle*{1}}\put(4.5,62.0){\circle*{1}}
+ \put(4.9,60.7){\circle*{1}}\put(5.3,59.5){\circle*{1}}
+ \put(5.8,58.2){\circle*{1}}\put(6.3,56.9){\circle*{1}}
+ \put(6.8,55.6){\circle*{1}}\put(7.4,54.4){\circle*{1}}
+ \put(7.9,53.1){\circle*{1}}\put(8.5,51.8){\circle*{1}}
+ \put(9.1,50.5){\circle*{1}}\put(9.7,49.3){\circle*{1}}
+ \put(10.4,48.0){\circle*{1}}\put(11.1,46.7){\circle*{1}}
+ \put(11.8,45.5){\circle*{1}}\put(12.5,44.2){\circle*{1}}
+ \put(13.3,42.9){\circle*{1}}\put(14.1,41.6){\circle*{1}}
+ \put(14.9,40.4){\circle*{1}}\put(15.8,39.1){\circle*{1}}
+ \put(16.7,37.8){\circle*{1}}\put(17.6,36.5){\circle*{1}}
+ \put(18.6,35.3){\circle*{1}}\put(19.5,34.0){\circle*{1}}
+ \put(20.6,32.7){\circle*{1}}\put(21.6,31.5){\circle*{1}}
+ \put(22.8,30.2){\circle*{1}}\put(23.9,28.9){\circle*{1}}
+ \put(25.1,27.6){\circle*{1}}
+ \put(30,30){\makebox(60,60){cbl}}
+ \end{picture}}
+ \put(0,240){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(90,90){\line(-1,0){90}}
+ \put(90,90){\line(0,1){90}}
+ \put(0,90){\line(1,1){90}}
+ \put(45,90){\makebox(45,45){tul}}
+ \end{picture}}
+ \put(240,240){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(90,90){\line(1,0){90}}
+ \put(90,90){\line(0,1){90}}
+ \put(90,180){\line(1,-1){90}}
+ \put(90,90){\makebox(45,45){tur}}
+ \end{picture}}
+ \put(480,240){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(90,90){\line(1,0){90}}
+ \put(90,90){\line(0,-1){90}}
+ \put(90,0){\line(1,1){90}}
+ \put(90,45){\makebox(45,45){tbr}}
+ \end{picture}}
+ \put(720,240){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(90,90){\line(-1,0){90}}
+ \put(90,90){\line(0,-1){90}}
+ \put(0,90){\line(1,-1){90}}
+ \put(45,45){\makebox(45,45){tbl}}
+ \end{picture}}
+ \put(0,0){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(0,180){\line(1,0){90}}
+ \put(0,90){\line(0,1){90}}
+ \put(0,90){\line(1,1){90}}
+ \put(0,135){\makebox(45,45){rul}}
+ \end{picture}}
+ \put(240,0){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(90,180){\line(1,0){90}}
+ \put(180,90){\line(0,1){90}}
+ \put(90,180){\line(1,-1){90}}
+ \put(135,135){\makebox(45,45){rur}}
+ \end{picture}}
+ \put(480,0){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(90,0){\line(1,0){90}}
+ \put(180,0){\line(0,1){90}}
+ \put(90,0){\line(1,1){90}}
+ \put(135,0){\makebox(45,45){rbr}}
+ \end{picture}}
+ \put(720,0){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(0,0){\line(1,0){90}}
+ \put(0,0){\line(0,1){90}}
+ \put(0,90){\line(1,-1){90}}
+ \put(0,0){\makebox(45,45){rbl}}
+ \end{picture}}
+ \end{picture}
+ \end{center}
+ \caption{Short Patches.}
+ \label{shortpatches}
+\end{figure}
+
+The definitions of each japanese character follow sequentially. The template
+for such a definition is:
+\begin{quote}
+\tt beginchar(0,\em width \tt\#,\em body\_height \tt\#,\em desc\_depth \tt\#);\\
+\verb"normal_adjust_fit(2u#,2u#);"\\
+$\vdots$\\
+\verb"endchar;"
+\end{quote}
+
+\newpage %improve a bad page break
+
+\begin{figure}[htb]
+ \begin{center}
+ \setlength{\unitlength}{0.38pt}
+ \begin{picture}(900,900)
+ \put(0,720){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(0,90){\line(1,0){180}}
+ \put(180,90){\line(0,1){90}}
+ \put(0,90){\line(2,1){180}}
+ \put(90,90){\makebox(90,45){tuul}}
+ \end{picture}}
+ \put(240,720){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(90,0){\line(0,1){180}}
+ \put(0,0){\line(1,0){90}}
+ \put(0,0){\line(1,2){90}}
+ \put(30,0){\makebox(60,60){tull}}
+ \end{picture}}
+ \put(480,720){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(0,90){\line(1,0){180}}
+ \put(0,90){\line(0,1){90}}
+ \put(0,180){\line(2,-1){180}}
+ \put(0,90){\makebox(90,45){tuur}}
+ \end{picture}}
+ \put(720,720){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(90,0){\line(0,1){180}}
+ \put(90,0){\line(1,0){90}}
+ \put(90,180){\line(1,-2){90}}
+ \put(90,0){\makebox(60,60){turr}}
+ \end{picture}}
+ \put(0,480){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(0,90){\line(1,0){180}}
+ \put(0,0){\line(0,1){90}}
+ \put(0,0){\line(2,1){180}}
+ \put(0,45){\makebox(90,45){tbbr}}
+ \end{picture}}
+ \put(240,480){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(90,0){\line(0,1){180}}
+ \put(90,180){\line(1,0){90}}
+ \put(90,0){\line(1,2){90}}
+ \put(90,120){\makebox(60,60){tbrr}}
+ \end{picture}}
+ \put(480,480){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(0,90){\line(1,0){180}}
+ \put(180,0){\line(0,1){90}}
+ \put(0,90){\line(2,-1){180}}
+ \put(90,45){\makebox(90,45){tbbl}}
+ \end{picture}}
+ \put(720,480){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(90,0){\line(0,1){180}}
+ \put(0,180){\line(1,0){90}}
+ \put(0,180){\line(1,-2){90}}
+ \put(30,120){\makebox(60,60){tbll}}
+ \end{picture}}
+ \put(0,240){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(0,0){\line(0,1){180}}
+ \put(0,180){\line(1,0){90}}
+ \put(0,0){\line(1,2){90}}
+ \put(0,120){\makebox(60,60){ruul}}
+ \end{picture}}
+ \put(240,240){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(0,180){\line(1,0){180}}
+ \put(0,90){\line(0,1){90}}
+ \put(0,90){\line(2,1){180}}
+ \put(0,135){\makebox(90,45){rull}}
+ \end{picture}}
+ \put(480,240){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(180,0){\line(0,1){180}}
+ \put(90,180){\line(1,0){90}}
+ \put(90,180){\line(1,-2){90}}
+ \put(120,120){\makebox(60,60){ruur}}
+ \end{picture}}
+ \put(720,240){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(0,180){\line(1,0){180}}
+ \put(180,90){\line(0,1){90}}
+ \put(0,180){\line(2,-1){180}}
+ \put(90,135){\makebox(90,45){rurr}}
+ \end{picture}}
+ \put(0,0){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(180,0){\line(0,1){180}}
+ \put(90,0){\line(1,0){90}}
+ \put(90,0){\line(1,2){90}}
+ \put(120,0){\makebox(60,60){rbbr}}
+ \end{picture}}
+ \put(240,0){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(0,0){\line(1,0){180}}
+ \put(180,0){\line(0,1){90}}
+ \put(0,0){\line(2,1){180}}
+ \put(90,0){\makebox(90,45){rbrr}}
+ \end{picture}}
+ \put(480,0){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(0,0){\line(0,1){180}}
+ \put(0,0){\line(1,0){90}}
+ \put(0,180){\line(1,-2){90}}
+ \put(0,0){\makebox(60,60){rbbl}}
+ \end{picture}}
+ \put(720,0){%
+ \begin{picture}(180,180)
+ \put(0,0){\dashbox{5}(180,180){}}
+ \put(0,0){\line(1,0){180}}
+ \put(0,0){\line(0,1){90}}
+ \put(0,90){\line(2,-1){180}}
+ \put(0,0){\makebox(90,45){rbll}}
+ \end{picture}}
+ \end{picture}
+ \end{center}
+ \caption{Long Patches.}
+ \label{longpatches}
+\end{figure}
+
+All sizes are given in terms of the fundamental unit of measurement $u$. The
+quantities {\em body\_height\/} and {\em desc\_depth\/} must include the border
+which is $2u$ thick. However, {\em width\/} does not need to include this
+border because the statement \verb"normal_adjust_fit" is equivalent to it
+horizontally. \MFT\ is somewhat more flexible in the horizontal direction by
+design and intent. The body of a character definition is simply a series of
+macro calls. Each line contains the macros for a given pixel in the bitmap.
+Consequently, each line is reasonably short.
+
+\newpage %improve a bad page break
+
+The \MFT\ code ends with a final header containing a few pieces of information
+for the \TeX\ Font Metric (\verb".tfm") files. The following are the most
+interesting items:
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+font_normal_space 8u#;
+font_normal_stretch 4u#;
+font_normal_shrink 3u#;
+font_x_height 24u#; %ex
+font_quad 24u#; %em
+\end{verbatim}
+\end{quote}
+
+I set the normal inter-word spacing to a third of the maximum width of a
+character. This seems comparable to the scheme used in several Computer Modern
+fonts. Stretching and shrinking are set to values also comparable to what is
+used elsewhere. I set the typical character height and width to the maximum
+size of a bitmap.
+
+\subsection{Algorithm}
+\label{algorithm}
+
+Given a bitmap, it is straightforward to determine its width and height, either
+fixed or minimized, while making sure that the vertical relationship with the
+horizontal baseline is respected. The bulk of the problem lies in determining
+the proper combination of squares, triangles, and quarter circles to be used.
+This subsection describes an algorithm developed jointly by Mr. Masatoshi
+Watanabe and me. I find that it produces good enough results for my need. But
+perhaps somebody will not share my opinion, and in that case, the following
+will no doubt prove helpful.
+
+The current bitmap is read into a 24~by~24 array of boolean variables. In what
+follows, I will say that a cell is {\em active\/} if the bitmap dictates that a
+dot should lie in it, otherwise it is {\em inactive}. Each cell is subdivided
+in four, and each subcell is examined with respect to the neighboring cells.
+The current algorithm is very local in that only neighboring cells in direct
+contact with the current cell are examined. A more global algorithm should
+perform better and that is certainly an area worth investigating for future
+releases.
+
+From now on, I will concentrate on the upper left subcell. The other three
+subcells are handled in a similar fashion. In the following diagrams, a
+$\bullet$ indicates an active cell and a $\times$ indicates an inactive cell.
+Unlabeled neighboring cells are simply irrelevant.
+
+The simplest case occurs when the current cell is inactive. Although the center
+of that cell should remain empty, it is possible to use its border to smooth a
+nearby painted area. The algorithm always tries to use long shapes first,
+before falling back to shorter shapes.
+
+First, the following cases clearly require that the upper left subcell not
+be painted:
+\begin{center}
+ \setlength{\unitlength}{0.4pt}
+ \begin{picture}(660,180)
+ \put(0,0){%
+ \begin{picture}(180,180)
+ \multiput(0,0)(60,0){4}{\dashbox{5}(0,180){}}
+ \multiput(0,0)(0,60){4}{\dashbox{5}(180,0){}}
+ \put(0,0){\makebox(60,60){\Huge$\bullet$}}
+ \put(0,60){\makebox(60,60){\Huge$\bullet$}}
+ \put(0,120){\makebox(60,60){\Huge$\bullet$}}
+ \put(60,0){\makebox(60,60){\Huge$\times$}}
+ \put(60,120){\makebox(60,60){\Huge$\times$}}
+ \put(60,90){\makebox(30,30){\large$\times$}}
+ \end{picture}}
+ \put(240,0){%
+ \begin{picture}(180,180)
+ \multiput(0,0)(60,0){4}{\dashbox{5}(0,180){}}
+ \multiput(0,0)(0,60){4}{\dashbox{5}(180,0){}}
+ \put(0,0){\makebox(60,60){\Huge$\times$}}
+ \put(0,60){\makebox(60,60){\Huge$\times$}}
+ \put(0,120){\makebox(60,60){\Huge$\times$}}
+ \put(60,120){\makebox(60,60){\Huge$\times$}}
+ \put(120,120){\makebox(60,60){\Huge$\times$}}
+ \put(60,90){\makebox(30,30){\large$\times$}}
+ \end{picture}}
+ \put(480,0){%
+ \begin{picture}(180,180)
+ \multiput(0,0)(60,0){4}{\dashbox{5}(0,180){}}
+ \multiput(0,0)(0,60){4}{\dashbox{5}(180,0){}}
+ \put(0,120){\makebox(60,60){\Huge$\bullet$}}
+ \put(60,120){\makebox(60,60){\Huge$\bullet$}}
+ \put(120,120){\makebox(60,60){\Huge$\bullet$}}
+ \put(0,60){\makebox(60,60){\Huge$\times$}}
+ \put(120,60){\makebox(60,60){\Huge$\times$}}
+ \put(60,90){\makebox(30,30){\large$\times$}}
+ \end{picture}}
+ \end{picture}
+\end{center}
+
+These three cases require reverse triangles involving the upper left subcell:
+\begin{center}
+ \setlength{\unitlength}{0.4pt}
+ \begin{picture}(660,180)
+ \put(0,0){%
+ \begin{picture}(180,180)
+ \multiput(0,0)(60,0){4}{\dashbox{5}(0,180){}}
+ \multiput(0,0)(0,60){4}{\dashbox{5}(180,0){}}
+ \put(0,0){\makebox(60,60){\Huge$\bullet$}}
+ \put(0,60){\makebox(60,60){\Huge$\bullet$}}
+ \put(60,120){\makebox(60,60){\Huge$\bullet$}}
+ \put(120,120){\makebox(60,60){\Huge$\times$}}
+ \put(60,60){\line(0,1){60}}
+ \put(60,120){\line(1,0){30}}
+ \put(60,60){\line(1,2){30}}
+ \end{picture}}
+ \put(240,0){%
+ \begin{picture}(180,180)
+ \multiput(0,0)(60,0){4}{\dashbox{5}(0,180){}}
+ \multiput(0,0)(0,60){4}{\dashbox{5}(180,0){}}
+ \put(120,120){\makebox(60,60){\Huge$\bullet$}}
+ \put(0,60){\makebox(60,60){\Huge$\bullet$}}
+ \put(60,120){\makebox(60,60){\Huge$\bullet$}}
+ \put(0,0){\makebox(60,60){\Huge$\times$}}
+ \put(60,120){\line(1,0){60}}
+ \put(60,90){\line(0,1){30}}
+ \put(60,90){\line(2,1){60}}
+ \end{picture}}
+ \put(480,0){%
+ \begin{picture}(180,180)
+ \multiput(0,0)(60,0){4}{\dashbox{5}(0,180){}}
+ \multiput(0,0)(0,60){4}{\dashbox{5}(180,0){}}
+ \put(0,60){\makebox(60,60){\Huge$\bullet$}}
+ \put(60,120){\makebox(60,60){\Huge$\bullet$}}
+ \put(120,120){\makebox(60,60){\Huge$\times$}}
+ \put(0,0){\makebox(60,60){\Huge$\times$}}
+ \put(60,120){\line(1,0){30}}
+ \put(60,90){\line(0,1){30}}
+ \put(60,90){\line(1,1){30}}
+ \end{picture}}
+ \end{picture}
+\end{center}
+
+There are two possible ways of handling the remaining case:
+\begin{center}
+ \setlength{\unitlength}{0.4pt}
+ \begin{picture}(420,180)
+ \put(0,0){%
+ \begin{picture}(180,180)
+ \multiput(0,0)(60,0){4}{\dashbox{5}(0,180){}}
+ \multiput(0,0)(0,60){4}{\dashbox{5}(180,0){}}
+ \put(0,0){\makebox(60,60){\Huge$\bullet$}}
+ \put(0,60){\makebox(60,60){\Huge$\bullet$}}
+ \put(60,120){\makebox(60,60){\Huge$\bullet$}}
+ \put(120,120){\makebox(60,60){\Huge$\bullet$}}
+ \put(60,90){\makebox(30,30){\large$\times$}}
+ \end{picture}}
+ \put(240,0){%
+ \begin{picture}(180,180)
+ \multiput(0,0)(60,0){4}{\dashbox{5}(0,180){}}
+ \multiput(0,0)(0,60){4}{\dashbox{5}(180,0){}}
+ \put(0,0){\makebox(60,60){\Huge$\bullet$}}
+ \put(0,60){\makebox(60,60){\Huge$\bullet$}}
+ \put(60,120){\makebox(60,60){\Huge$\bullet$}}
+ \put(120,120){\makebox(60,60){\Huge$\bullet$}}
+ \put(60,120){\line(1,0){30}}
+ \put(60,90){\line(0,1){30}}
+ \put(60,90){\line(1,1){30}}
+ \end{picture}}
+ \end{picture}
+\end{center}
+
+The technique on the left has the advantage of producing clean crossings of
+$+$ strokes, but experimentation shows that it often yields bad crossings of
+$\times$ strokes. The technique on the right produces good crossings of
+$\times$ strokes, but it also generates crossings of $+$ strokes with
+unnecessarily round corners. I examined both alternatives with \MFT\ in proof
+mode, and I found that it is preferable to have characters occasionally
+slightly too smooth, rather than sharp ones occasionally rough. Therefore, the
+approach on the right is the one used in \verb"JIS2MF".
+
+\newpage %improve a bad page break
+
+The most complex situation occurs when the center cell is active. Each of its
+subcells will be filled by a square, a triangle, or a quarter circle. No
+reverse triangle is used in such instances since I insist that the interior of
+the cell be filled. As always, long triangles are tried first. The possible
+four cases involving the upper left subcell are:
+\begin{center}
+ \setlength{\unitlength}{0.4pt}
+ \begin{picture}(900,180)
+ \put(0,0){%
+ \begin{picture}(180,180)
+ \multiput(0,0)(60,0){4}{\dashbox{5}(0,180){}}
+ \multiput(0,0)(0,60){4}{\dashbox{5}(180,0){}}
+ \put(0,0){\makebox(60,60){\Huge$\bullet$}}
+ \put(120,60){\makebox(60,60){\Huge$\bullet$}}
+ \put(0,60){\makebox(60,60){\Huge$\times$}}
+ \put(0,120){\makebox(60,60){\Huge$\times$}}
+ \put(60,120){\makebox(60,60){\Huge$\times$}}
+ \put(120,120){\makebox(60,60){\Huge$\times$}}
+ \put(60,90){\line(1,0){60}}
+ \put(120,90){\line(0,1){30}}
+ \put(60,90){\line(2,1){60}}
+ \end{picture}}
+ \put(240,0){%
+ \begin{picture}(180,180)
+ \multiput(0,0)(60,0){4}{\dashbox{5}(0,180){}}
+ \multiput(0,0)(0,60){4}{\dashbox{5}(180,0){}}
+ \put(60,0){\makebox(60,60){\Huge$\bullet$}}
+ \put(120,120){\makebox(60,60){\Huge$\bullet$}}
+ \put(0,0){\makebox(60,60){\Huge$\times$}}
+ \put(0,60){\makebox(60,60){\Huge$\times$}}
+ \put(0,120){\makebox(60,60){\Huge$\times$}}
+ \put(60,120){\makebox(60,60){\Huge$\times$}}
+ \put(90,60){\line(0,1){60}}
+ \put(60,60){\line(1,0){30}}
+ \put(60,60){\line(1,2){30}}
+ \end{picture}}
+ \put(480,0){%
+ \begin{picture}(180,180)
+ \multiput(0,0)(60,0){4}{\dashbox{5}(0,180){}}
+ \multiput(0,0)(0,60){4}{\dashbox{5}(180,0){}}
+ \put(0,60){\makebox(60,60){\Huge$\bullet$}}
+ \put(120,0){\makebox(60,60){\Huge$\bullet$}}
+ \put(0,120){\makebox(60,60){\Huge$\times$}}
+ \put(60,120){\makebox(60,60){\Huge$\times$}}
+ \put(120,120){\makebox(60,60){\Huge$\times$}}
+ \put(120,60){\makebox(60,60){\Huge$\times$}}
+ \put(60,90){\line(1,0){60}}
+ \put(60,90){\line(0,1){30}}
+ \put(60,120){\line(2,-1){60}}
+ \end{picture}}
+ \put(720,0){%
+ \begin{picture}(180,180)
+ \multiput(0,0)(60,0){4}{\dashbox{5}(0,180){}}
+ \multiput(0,0)(0,60){4}{\dashbox{5}(180,0){}}
+ \put(120,0){\makebox(60,60){\Huge$\bullet$}}
+ \put(60,120){\makebox(60,60){\Huge$\bullet$}}
+ \put(0,0){\makebox(60,60){\Huge$\times$}}
+ \put(60,0){\makebox(60,60){\Huge$\times$}}
+ \put(0,60){\makebox(60,60){\Huge$\times$}}
+ \put(0,120){\makebox(60,60){\Huge$\times$}}
+ \put(90,60){\line(0,1){60}}
+ \put(60,120){\line(1,0){30}}
+ \put(60,120){\line(1,-2){30}}
+ \end{picture}}
+ \end{picture}
+\end{center}
+
+If none of these cases can be applied, the following three cases are tried out:
+\begin{center}
+ \setlength{\unitlength}{0.4pt}
+ \begin{picture}(660,180)
+ \put(0,0){%
+ \begin{picture}(180,180)
+ \multiput(0,0)(60,0){4}{\dashbox{5}(0,180){}}
+ \multiput(0,0)(0,60){4}{\dashbox{5}(180,0){}}
+ \put(0,60){\makebox(60,60){\Huge$\bullet$}}
+ \put(60,90){\framebox(30,30){}}
+ \end{picture}}
+ \put(240,0){%
+ \begin{picture}(180,180)
+ \multiput(0,0)(60,0){4}{\dashbox{5}(0,180){}}
+ \multiput(0,0)(0,60){4}{\dashbox{5}(180,0){}}
+ \put(0,120){\makebox(60,60){\Huge$\bullet$}}
+ \put(60,90){\framebox(30,30){}}
+ \end{picture}}
+ \put(480,0){%
+ \begin{picture}(180,180)
+ \multiput(0,0)(60,0){4}{\dashbox{5}(0,180){}}
+ \multiput(0,0)(0,60){4}{\dashbox{5}(180,0){}}
+ \put(60,120){\makebox(60,60){\Huge$\bullet$}}
+ \put(60,90){\framebox(30,30){}}
+ \end{picture}}
+ \end{picture}
+\end{center}
+
+If neither of these is relevant, I always resort to one of these three final
+cases:
+\begin{center}
+ \setlength{\unitlength}{0.4pt}
+ \begin{picture}(660,180)
+ \put(0,0){%
+ \begin{picture}(180,180)
+ \multiput(0,0)(60,0){4}{\dashbox{5}(0,180){}}
+ \multiput(0,0)(0,60){4}{\dashbox{5}(180,0){}}
+ \put(0,60){\makebox(60,60){\Huge$\times$}}
+ \put(0,120){\makebox(60,60){\Huge$\times$}}
+ \put(60,120){\makebox(60,60){\Huge$\times$}}
+ \put(120,120){\makebox(60,60){\Huge$\bullet$}}
+ \put(90,90){\line(-1,0){30}}
+ \put(90,90){\line(0,1){30}}
+ \put(60,90){\line(1,1){30}}
+ \end{picture}}
+ \put(240,0){%
+ \begin{picture}(180,180)
+ \multiput(0,0)(60,0){4}{\dashbox{5}(0,180){}}
+ \multiput(0,0)(0,60){4}{\dashbox{5}(180,0){}}
+ \put(0,60){\makebox(60,60){\Huge$\times$}}
+ \put(0,120){\makebox(60,60){\Huge$\times$}}
+ \put(60,120){\makebox(60,60){\Huge$\times$}}
+ \put(0,0){\makebox(60,60){\Huge$\bullet$}}
+ \put(90,90){\line(-1,0){30}}
+ \put(90,90){\line(0,1){30}}
+ \put(60,90){\line(1,1){30}}
+ \end{picture}}
+ \put(480,0){%
+ \begin{picture}(180,180)
+ \multiput(0,0)(60,0){4}{\dashbox{5}(0,180){}}
+ \multiput(0,0)(0,60){4}{\dashbox{5}(180,0){}}
+ \put(0,60){\makebox(60,60){\Huge$\times$}}
+ \put(0,120){\makebox(60,60){\Huge$\times$}}
+ \put(60,120){\makebox(60,60){\Huge$\times$}}
+ \put(0,0){\makebox(60,60){\Huge$\times$}}
+ \put(120,120){\makebox(60,60){\Huge$\times$}}
+ \put(90,90){\line(-1,0){30}}
+ \put(90,90){\line(0,1){30}}
+ \put(90.0,120.0){\circle*{1}}\put(89.3,120.0){\circle*{1}}
+ \put(88.6,120.0){\circle*{1}}\put(87.9,119.9){\circle*{1}}
+ \put(87.2,119.9){\circle*{1}}\put(86.5,119.8){\circle*{1}}
+ \put(85.8,119.7){\circle*{1}}\put(85.1,119.6){\circle*{1}}
+ \put(84.3,119.5){\circle*{1}}\put(83.6,119.3){\circle*{1}}
+ \put(82.9,119.2){\circle*{1}}\put(82.2,119.0){\circle*{1}}
+ \put(81.5,118.8){\circle*{1}}\put(80.8,118.6){\circle*{1}}
+ \put(80.1,118.3){\circle*{1}}\put(79.4,118.1){\circle*{1}}
+ \put(78.7,117.8){\circle*{1}}\put(78.0,117.5){\circle*{1}}
+ \put(77.3,117.2){\circle*{1}}\put(76.6,116.8){\circle*{1}}
+ \put(75.9,116.5){\circle*{1}}\put(75.2,116.1){\circle*{1}}
+ \put(74.4,115.7){\circle*{1}}\put(73.7,115.2){\circle*{1}}
+ \put(73.0,114.7){\circle*{1}}\put(72.3,114.2){\circle*{1}}
+ \put(71.6,113.7){\circle*{1}}\put(70.9,113.1){\circle*{1}}
+ \put(70.2,112.5){\circle*{1}}\put(69.5,111.9){\circle*{1}}
+ \put(68.8,111.2){\circle*{1}}\put(60.0,90.0){\circle*{1}}
+ \put(60.0,90.7){\circle*{1}}\put(60.0,91.4){\circle*{1}}
+ \put(60.1,92.1){\circle*{1}}\put(60.1,92.8){\circle*{1}}
+ \put(60.2,93.5){\circle*{1}}\put(60.3,94.2){\circle*{1}}
+ \put(60.4,94.9){\circle*{1}}\put(60.5,95.7){\circle*{1}}
+ \put(60.7,96.4){\circle*{1}}\put(60.8,97.1){\circle*{1}}
+ \put(61.0,97.8){\circle*{1}}\put(61.2,98.5){\circle*{1}}
+ \put(61.4,99.2){\circle*{1}}\put(61.7,99.9){\circle*{1}}
+ \put(61.9,100.6){\circle*{1}}\put(62.2,101.3){\circle*{1}}
+ \put(62.5,102.0){\circle*{1}}\put(62.8,102.7){\circle*{1}}
+ \put(63.2,103.4){\circle*{1}}\put(63.5,104.1){\circle*{1}}
+ \put(63.9,104.8){\circle*{1}}\put(64.3,105.6){\circle*{1}}
+ \put(64.8,106.3){\circle*{1}}\put(65.3,107.0){\circle*{1}}
+ \put(65.8,107.7){\circle*{1}}\put(66.3,108.4){\circle*{1}}
+ \put(66.9,109.1){\circle*{1}}\put(67.5,109.8){\circle*{1}}
+ \put(68.1,110.5){\circle*{1}}
+ \end{picture}}
+ \end{picture}
+\end{center}
+
+Note that an active cell surrounded by inactive ones is always eventually
+filled by four quarter circles; the original bitmap pixel remains unchanged. In
+that case, rather than using four quarter circle macro calls, I use one call to
+another macro which paints one complete circle. The case of four squares is
+handled similarly with one big square. These two additional macros complete the
+collection of painting macros used by \verb"JIS2MF".
+
+\newpage %improve a bad page break
+
+Figure~\ref{bitmapandcontinuouscharacter} illustrates typical results obtained
+with this algorithm using bitmap~2512 of the JIS~24 dot font.
+
+\begin{figure}[htb]
+ \begin{center}
+ \setlength{\unitlength}{6pt}
+ \begin{picture}(56,24)
+ \put(0,0){%
+ \begin{picture}(25,25)(1,1)
+ \put(1,1){\dashbox{0.25}(24,24){}}
+ \put(1,5){\makebox(1,1){$\bullet$}}\put(1,16){\makebox(1,1){$\bullet$}}
+ \put(1,20){\makebox(1,1){$\bullet$}}\put(2,6){\makebox(1,1){$\bullet$}}
+ \put(2,16){\makebox(1,1){$\bullet$}}\put(2,20){\makebox(1,1){$\bullet$}}
+ \put(3,7){\makebox(1,1){$\bullet$}}\put(3,8){\makebox(1,1){$\bullet$}}
+ \put(3,16){\makebox(1,1){$\bullet$}}\put(3,20){\makebox(1,1){$\bullet$}}
+ \put(4,8){\makebox(1,1){$\bullet$}}\put(4,9){\makebox(1,1){$\bullet$}}
+ \put(4,10){\makebox(1,1){$\bullet$}}\put(4,16){\makebox(1,1){$\bullet$}}
+ \put(4,21){\makebox(1,1){$\bullet$}}\put(5,10){\makebox(1,1){$\bullet$}}
+ \put(5,11){\makebox(1,1){$\bullet$}}\put(5,12){\makebox(1,1){$\bullet$}}
+ \put(5,13){\makebox(1,1){$\bullet$}}\put(5,16){\makebox(1,1){$\bullet$}}
+ \put(5,21){\makebox(1,1){$\bullet$}}\put(6,1){\makebox(1,1){$\bullet$}}
+ \put(6,2){\makebox(1,1){$\bullet$}}\put(6,3){\makebox(1,1){$\bullet$}}
+ \put(6,4){\makebox(1,1){$\bullet$}}\put(6,5){\makebox(1,1){$\bullet$}}
+ \put(6,6){\makebox(1,1){$\bullet$}}\put(6,7){\makebox(1,1){$\bullet$}}
+ \put(6,8){\makebox(1,1){$\bullet$}}\put(6,9){\makebox(1,1){$\bullet$}}
+ \put(6,10){\makebox(1,1){$\bullet$}}\put(6,11){\makebox(1,1){$\bullet$}}
+ \put(6,12){\makebox(1,1){$\bullet$}}\put(6,13){\makebox(1,1){$\bullet$}}
+ \put(6,14){\makebox(1,1){$\bullet$}}\put(6,15){\makebox(1,1){$\bullet$}}
+ \put(6,16){\makebox(1,1){$\bullet$}}\put(6,17){\makebox(1,1){$\bullet$}}
+ \put(6,18){\makebox(1,1){$\bullet$}}\put(6,19){\makebox(1,1){$\bullet$}}
+ \put(6,20){\makebox(1,1){$\bullet$}}\put(6,21){\makebox(1,1){$\bullet$}}
+ \put(7,1){\makebox(1,1){$\bullet$}}\put(7,2){\makebox(1,1){$\bullet$}}
+ \put(7,3){\makebox(1,1){$\bullet$}}\put(7,4){\makebox(1,1){$\bullet$}}
+ \put(7,5){\makebox(1,1){$\bullet$}}\put(7,6){\makebox(1,1){$\bullet$}}
+ \put(7,7){\makebox(1,1){$\bullet$}}\put(7,8){\makebox(1,1){$\bullet$}}
+ \put(7,9){\makebox(1,1){$\bullet$}}\put(7,10){\makebox(1,1){$\bullet$}}
+ \put(7,11){\makebox(1,1){$\bullet$}}\put(7,12){\makebox(1,1){$\bullet$}}
+ \put(7,13){\makebox(1,1){$\bullet$}}\put(7,14){\makebox(1,1){$\bullet$}}
+ \put(7,15){\makebox(1,1){$\bullet$}}\put(7,16){\makebox(1,1){$\bullet$}}
+ \put(7,17){\makebox(1,1){$\bullet$}}\put(7,18){\makebox(1,1){$\bullet$}}
+ \put(7,19){\makebox(1,1){$\bullet$}}\put(7,20){\makebox(1,1){$\bullet$}}
+ \put(7,21){\makebox(1,1){$\bullet$}}\put(7,22){\makebox(1,1){$\bullet$}}
+ \put(8,12){\makebox(1,1){$\bullet$}}\put(8,16){\makebox(1,1){$\bullet$}}
+ \put(8,22){\makebox(1,1){$\bullet$}}\put(9,12){\makebox(1,1){$\bullet$}}
+ \put(9,16){\makebox(1,1){$\bullet$}}\put(9,22){\makebox(1,1){$\bullet$}}
+ \put(9,23){\makebox(1,1){$\bullet$}}\put(10,3){\makebox(1,1){$\bullet$}}
+ \put(10,11){\makebox(1,1){$\bullet$}}\put(10,16){\makebox(1,1){$\bullet$}}
+ \put(10,17){\makebox(1,1){$\bullet$}}\put(10,23){\makebox(1,1){$\bullet$}}
+ \put(10,24){\makebox(1,1){$\bullet$}}\put(11,1){\makebox(1,1){$\bullet$}}
+ \put(11,2){\makebox(1,1){$\bullet$}}\put(11,3){\makebox(1,1){$\bullet$}}
+ \put(11,9){\makebox(1,1){$\bullet$}}\put(11,10){\makebox(1,1){$\bullet$}}
+ \put(11,11){\makebox(1,1){$\bullet$}}\put(11,16){\makebox(1,1){$\bullet$}}
+ \put(11,17){\makebox(1,1){$\bullet$}}\put(11,23){\makebox(1,1){$\bullet$}}
+ \put(11,24){\makebox(1,1){$\bullet$}}\put(12,2){\makebox(1,1){$\bullet$}}
+ \put(12,3){\makebox(1,1){$\bullet$}}\put(12,9){\makebox(1,1){$\bullet$}}
+ \put(12,10){\makebox(1,1){$\bullet$}}\put(12,16){\makebox(1,1){$\bullet$}}
+ \put(12,23){\makebox(1,1){$\bullet$}}\put(13,2){\makebox(1,1){$\bullet$}}
+ \put(13,3){\makebox(1,1){$\bullet$}}\put(14,2){\makebox(1,1){$\bullet$}}
+ \put(14,3){\makebox(1,1){$\bullet$}}\put(14,4){\makebox(1,1){$\bullet$}}
+ \put(14,5){\makebox(1,1){$\bullet$}}\put(15,3){\makebox(1,1){$\bullet$}}
+ \put(15,6){\makebox(1,1){$\bullet$}}\put(15,7){\makebox(1,1){$\bullet$}}
+ \put(15,8){\makebox(1,1){$\bullet$}}\put(15,9){\makebox(1,1){$\bullet$}}
+ \put(16,3){\makebox(1,1){$\bullet$}}\put(16,8){\makebox(1,1){$\bullet$}}
+ \put(16,9){\makebox(1,1){$\bullet$}}\put(16,10){\makebox(1,1){$\bullet$}}
+ \put(16,11){\makebox(1,1){$\bullet$}}\put(16,12){\makebox(1,1){$\bullet$}}
+ \put(16,13){\makebox(1,1){$\bullet$}}\put(16,14){\makebox(1,1){$\bullet$}}
+ \put(16,15){\makebox(1,1){$\bullet$}}\put(16,16){\makebox(1,1){$\bullet$}}
+ \put(17,3){\makebox(1,1){$\bullet$}}\put(17,12){\makebox(1,1){$\bullet$}}
+ \put(17,13){\makebox(1,1){$\bullet$}}\put(17,14){\makebox(1,1){$\bullet$}}
+ \put(17,15){\makebox(1,1){$\bullet$}}\put(17,16){\makebox(1,1){$\bullet$}}
+ \put(17,17){\makebox(1,1){$\bullet$}}\put(17,18){\makebox(1,1){$\bullet$}}
+ \put(17,19){\makebox(1,1){$\bullet$}}\put(17,20){\makebox(1,1){$\bullet$}}
+ \put(17,21){\makebox(1,1){$\bullet$}}\put(17,22){\makebox(1,1){$\bullet$}}
+ \put(17,23){\makebox(1,1){$\bullet$}}\put(17,24){\makebox(1,1){$\bullet$}}
+ \put(18,3){\makebox(1,1){$\bullet$}}\put(18,17){\makebox(1,1){$\bullet$}}
+ \put(18,18){\makebox(1,1){$\bullet$}}\put(18,19){\makebox(1,1){$\bullet$}}
+ \put(18,20){\makebox(1,1){$\bullet$}}\put(18,21){\makebox(1,1){$\bullet$}}
+ \put(18,22){\makebox(1,1){$\bullet$}}\put(18,23){\makebox(1,1){$\bullet$}}
+ \put(19,4){\makebox(1,1){$\bullet$}}\put(19,23){\makebox(1,1){$\bullet$}}
+ \put(20,4){\makebox(1,1){$\bullet$}}\put(20,8){\makebox(1,1){$\bullet$}}
+ \put(21,4){\makebox(1,1){$\bullet$}}\put(21,6){\makebox(1,1){$\bullet$}}
+ \put(21,7){\makebox(1,1){$\bullet$}}\put(22,4){\makebox(1,1){$\bullet$}}
+ \put(22,5){\makebox(1,1){$\bullet$}}\put(22,6){\makebox(1,1){$\bullet$}}
+ \put(23,1){\makebox(1,1){$\bullet$}}\put(23,2){\makebox(1,1){$\bullet$}}
+ \put(23,3){\makebox(1,1){$\bullet$}}\put(23,4){\makebox(1,1){$\bullet$}}
+ \put(23,5){\makebox(1,1){$\bullet$}}\put(24,1){\makebox(1,1){$\bullet$}}
+ \put(24,2){\makebox(1,1){$\bullet$}}\put(24,3){\makebox(1,1){$\bullet$}}
+ \end{picture}}
+ \put(32,0){%
+ \begin{picture}(24,21.25)(0,-2.75)
+ \newsavebox{\sss}
+ \sbox{\sss}{%
+ \begin{picture}(1,1)
+ \put(0,0){\framebox(1,1){}}
+ \end{picture}}
+ \newsavebox{\sul}
+ \sbox{\sul}{%
+ \begin{picture}(1,1)
+ \put(0,0.5){\framebox(0.5,0.5){}}
+ \end{picture}}
+ \newsavebox{\sur}
+ \sbox{\sur}{%
+ \begin{picture}(1,1)
+ \put(0.5,0.5){\framebox(0.5,0.5){}}
+ \end{picture}}
+ \newsavebox{\sbr}
+ \sbox{\sbr}{%
+ \begin{picture}(1,1)
+ \put(0.5,0){\framebox(0.5,0.5){}}
+ \end{picture}}
+ \newsavebox{\sbl}
+ \sbox{\sbl}{%
+ \begin{picture}(1,1)
+ \put(0,0){\framebox(0.5,0.5){}}
+ \end{picture}}
+ \newsavebox{\cul}
+ \sbox{\cul}{%
+ \begin{picture}(1,1)
+ \put(0.5,0.5){\line(-1,0){0.5}}
+ \put(0.5,0.5){\line(0,1){0.5}}
+ \put(0.50,1.00){\circle*{0.05}}\put(0.43,0.99){\circle*{0.05}}
+ \put(0.36,0.98){\circle*{0.05}}\put(0.29,0.95){\circle*{0.05}}
+ \put(0.22,0.91){\circle*{0.05}}\put(0.15,0.85){\circle*{0.05}}
+ \put(0.00,0.50){\circle*{0.05}}\put(0.01,0.57){\circle*{0.05}}
+ \put(0.02,0.64){\circle*{0.05}}\put(0.05,0.71){\circle*{0.05}}
+ \put(0.09,0.78){\circle*{0.05}}
+ \end{picture}}
+ \newsavebox{\cur}
+ \sbox{\cur}{%
+ \begin{picture}(1,1)
+ \put(0.5,0.5){\line(1,0){0.5}}
+ \put(0.5,0.5){\line(0,1){0.5}}
+ \put(0.50,1.00){\circle*{0.05}}\put(0.57,0.99){\circle*{0.05}}
+ \put(0.64,0.98){\circle*{0.05}}\put(0.71,0.95){\circle*{0.05}}
+ \put(0.78,0.91){\circle*{0.05}}\put(0.85,0.85){\circle*{0.05}}
+ \put(1.00,0.50){\circle*{0.05}}\put(0.99,0.57){\circle*{0.05}}
+ \put(0.98,0.64){\circle*{0.05}}\put(0.95,0.71){\circle*{0.05}}
+ \put(0.91,0.78){\circle*{0.05}}
+ \end{picture}}
+ \newsavebox{\cbr}
+ \sbox{\cbr}{%
+ \begin{picture}(1,1)
+ \put(0.5,0.5){\line(1,0){0.5}}
+ \put(0.5,0.5){\line(0,-1){0.5}}
+ \put(0.50,0.00){\circle*{0.05}}\put(0.57,0.01){\circle*{0.05}}
+ \put(0.64,0.02){\circle*{0.05}}\put(0.71,0.05){\circle*{0.05}}
+ \put(0.78,0.09){\circle*{0.05}}\put(0.85,0.15){\circle*{0.05}}
+ \put(1.00,0.50){\circle*{0.05}}\put(0.99,0.43){\circle*{0.05}}
+ \put(0.98,0.36){\circle*{0.05}}\put(0.95,0.29){\circle*{0.05}}
+ \put(0.91,0.22){\circle*{0.05}}
+ \end{picture}}
+ \newsavebox{\cbl}
+ \sbox{\cbl}{%
+ \begin{picture}(1,1)
+ \put(0.5,0.5){\line(-1,0){0.5}}
+ \put(0.5,0.5){\line(0,-1){0.5}}
+ \put(0.50,0.00){\circle*{0.05}}\put(0.43,0.01){\circle*{0.05}}
+ \put(0.36,0.02){\circle*{0.05}}\put(0.29,0.05){\circle*{0.05}}
+ \put(0.22,0.09){\circle*{0.05}}\put(0.15,0.15){\circle*{0.05}}
+ \put(0.00,0.50){\circle*{0.05}}\put(0.01,0.43){\circle*{0.05}}
+ \put(0.02,0.36){\circle*{0.05}}\put(0.05,0.29){\circle*{0.05}}
+ \put(0.09,0.22){\circle*{0.05}}
+ \end{picture}}
+ \newsavebox{\tul}
+ \sbox{\tul}{%
+ \begin{picture}(1,1)
+ \put(0.5,0.5){\line(-1,0){0.5}}
+ \put(0.5,0.5){\line(0,1){0.5}}
+ \multiput(0,0.5)(0.05,0.05){11}{\circle*{0.05}}
+ \end{picture}}
+ \newsavebox{\tur}
+ \sbox{\tur}{%
+ \begin{picture}(1,1)
+ \put(0.5,0.5){\line(1,0){0.5}}
+ \put(0.5,0.5){\line(0,1){0.5}}
+ \put(0.5,1){\line(1,-1){0.5}}
+ \multiput(0.5,1)(0.05,-0.05){11}{\circle*{0.05}}
+ \end{picture}}
+ \newsavebox{\tbr}
+ \sbox{\tbr}{%
+ \begin{picture}(1,1)
+ \put(0.5,0.5){\line(1,0){0.5}}
+ \put(0.5,0.5){\line(0,-1){0.5}}
+ \put(0.5,0){\line(1,1){0.5}}
+ \multiput(0.5,0)(0.05,0.05){11}{\circle*{0.05}}
+ \end{picture}}
+ \newsavebox{\tbl}
+ \sbox{\tbl}{%
+ \begin{picture}(1,1)
+ \put(0.5,0.5){\line(-1,0){0.5}}
+ \put(0.5,0.5){\line(0,-1){0.5}}
+ \put(0,0.5){\line(1,-1){0.5}}
+ \multiput(0,0.5)(0.05,-0.05){11}{\circle*{0.05}}
+ \end{picture}}
+ \newsavebox{\rul}
+ \sbox{\rul}{%
+ \begin{picture}(1,1)
+ \put(0,1){\line(1,0){0.5}}
+ \put(0,0.5){\line(0,1){0.5}}
+ \put(0,0.5){\line(1,1){0.5}}
+ \multiput(0,0.5)(0.05,0.05){11}{\circle*{0.05}}
+ \end{picture}}
+ \newsavebox{\rur}
+ \sbox{\rur}{%
+ \begin{picture}(1,1)
+ \put(0.5,1){\line(1,0){0.5}}
+ \put(1,0.5){\line(0,1){0.5}}
+ \put(0.5,1){\line(1,-1){0.5}}
+ \multiput(0.5,1)(0.05,-0.05){11}{\circle*{0.05}}
+ \end{picture}}
+ \newsavebox{\rbr}
+ \sbox{\rbr}{%
+ \begin{picture}(1,1)
+ \put(0.5,0){\line(1,0){0.5}}
+ \put(1,0){\line(0,1){0.5}}
+ \put(0.5,0){\line(1,1){0.5}}
+ \multiput(0.5,0)(0.05,0.05){11}{\circle*{0.05}}
+ \end{picture}}
+ \newsavebox{\rbl}
+ \sbox{\rbl}{%
+ \begin{picture}(1,1)
+ \put(0,0){\line(1,0){0.5}}
+ \put(0,0){\line(0,1){0.5}}
+ \put(0,0.5){\line(1,-1){0.5}}
+ \multiput(0,0.5)(0.05,-0.05){11}{\circle*{0.05}}
+ \end{picture}}
+ \newsavebox{\tuul}
+ \sbox{\tuul}{%
+ \begin{picture}(1,1)
+ \put(0,0.5){\line(1,0){1}}
+ \put(1,0.5){\line(0,1){0.5}}
+ \multiput(0,0.5)(0.05,0.025){21}{\circle*{0.05}}
+ \end{picture}}
+ \newsavebox{\tuur}
+ \sbox{\tuur}{%
+ \begin{picture}(1,1)
+ \put(0,0.5){\line(1,0){1}}
+ \put(0,0.5){\line(0,1){0.5}}
+ \multiput(0,1)(0.05,-0.025){21}{\circle*{0.05}}
+ \end{picture}}
+ \newsavebox{\tbbl}
+ \sbox{\tbbl}{%
+ \begin{picture}(1,1)
+ \put(0,0.5){\line(1,0){1}}
+ \put(1,0){\line(0,1){0.5}}
+ \multiput(0,0.5)(0.05,-0.025){21}{\circle*{0.05}}
+ \end{picture}}
+ \newsavebox{\tbbr}
+ \sbox{\tbbr}{%
+ \begin{picture}(1,1)
+ \put(0,0.5){\line(1,0){1}}
+ \put(0,0){\line(0,1){0.5}}
+ \multiput(0,0)(0.05,0.025){21}{\circle*{0.05}}
+ \end{picture}}
+ \newsavebox{\tull}
+ \sbox{\tull}{%
+ \begin{picture}(1,1)
+ \put(0.5,0){\line(0,1){1}}
+ \put(0,0){\line(1,0){0.5}}
+ \multiput(0,0)(0.025,0.05){21}{\circle*{0.05}}
+ \end{picture}}
+ \newsavebox{\turr}
+ \sbox{\turr}{%
+ \begin{picture}(1,1)
+ \put(0.5,0){\line(0,1){1}}
+ \put(0.5,0){\line(1,0){0.5}}
+ \multiput(0.5,1)(0.025,-0.05){21}{\circle*{0.05}}
+ \end{picture}}
+ \newsavebox{\tbll}
+ \sbox{\tbll}{%
+ \begin{picture}(1,1)
+ \put(0.5,0){\line(0,1){1}}
+ \put(0,1){\line(1,0){0.5}}
+ \multiput(0,1)(0.025,-0.05){21}{\circle*{0.05}}
+ \end{picture}}
+ \newsavebox{\tbrr}
+ \sbox{\tbrr}{%
+ \begin{picture}(1,1)
+ \put(0.5,0){\line(0,1){1}}
+ \put(0.5,1){\line(1,0){0.5}}
+ \multiput(0.5,0)(0.025,0.05){21}{\circle*{0.05}}
+ \end{picture}}
+ \newsavebox{\ruul}
+ \sbox{\ruul}{%
+ \begin{picture}(1,1)
+ \put(0,1){\line(1,0){0.5}}
+ \put(0,0){\line(0,1){1}}
+ \multiput(0,0)(0.025,0.05){21}{\circle*{0.05}}
+ \end{picture}}
+ \newsavebox{\ruur}
+ \sbox{\ruur}{%
+ \begin{picture}(1,1)
+ \put(0.5,1){\line(1,0){0.5}}
+ \put(1,0){\line(0,1){1}}
+ \multiput(0.5,1)(0.025,-0.05){21}{\circle*{0.05}}
+ \end{picture}}
+ \newsavebox{\rbbl}
+ \sbox{\rbbl}{%
+ \begin{picture}(1,1)
+ \put(0,0){\line(1,0){0.5}}
+ \put(0,0){\line(0,1){1}}
+ \multiput(0,1)(0.025,-0.05){21}{\circle*{0.05}}
+ \end{picture}}
+ \newsavebox{\rbbr}
+ \sbox{\rbbr}{%
+ \begin{picture}(1,1)
+ \put(0.5,0){\line(1,0){0.5}}
+ \put(1,0){\line(0,1){1}}
+ \multiput(0.5,0)(0.025,0.05){21}{\circle*{0.05}}
+ \end{picture}}
+ \newsavebox{\rull}
+ \sbox{\rull}{%
+ \begin{picture}(1,1)
+ \put(0,1){\line(1,0){1}}
+ \put(0,0.5){\line(0,1){0.5}}
+ \multiput(0,0.5)(0.05,0.025){21}{\circle*{0.05}}
+ \end{picture}}
+ \newsavebox{\rurr}
+ \sbox{\rurr}{%
+ \begin{picture}(1,1)
+ \put(0,1){\line(1,0){1}}
+ \put(1,0.5){\line(0,1){0.5}}
+ \multiput(0,1)(0.05,-0.025){21}{\circle*{0.05}}
+ \end{picture}}
+ \newsavebox{\rbll}
+ \sbox{\rbll}{%
+ \begin{picture}(1,1)
+ \put(0,0){\line(1,0){1}}
+ \put(0,0){\line(0,1){0.5}}
+ \multiput(0,0.5)(0.05,-0.025){21}{\circle*{0.05}}
+ \end{picture}}
+ \newsavebox{\rbrr}
+ \sbox{\rbrr}{%
+ \begin{picture}(1,1)
+ \put(0,0){\line(1,0){1}}
+ \put(1,0){\line(0,1){0.5}}
+ \multiput(0,0)(0.05,0.025){21}{\circle*{0.05}}
+ \end{picture}}
+ \put(0,-2.75){\dashbox{0.25}(24,24){}}
+ \put(0,0){\line(1,0){24}}
+ \put(0,1.25){\usebox{\tul}}\put(0,1.25){\usebox{\sur}}
+ \put(0,1.25){\usebox{\cbl}}\put(0,1.25){\usebox{\tbr}}
+ \put(0,2.25){\usebox{\rbr}}\put(0,12.25){\usebox{\cul}}
+ \put(0,12.25){\usebox{\sur}}\put(0,12.25){\usebox{\cbl}}
+ \put(0,12.25){\usebox{\sbr}}\put(0,16.25){\usebox{\cul}}
+ \put(0,16.25){\usebox{\sur}}\put(0,16.25){\usebox{\cbl}}
+ \put(0,16.25){\usebox{\sbr}}\put(1,1.25){\usebox{\rul}}
+ \put(1,2.25){\usebox{\tul}}\put(1,2.25){\usebox{\sur}}
+ \put(1,2.25){\usebox{\sbl}}\put(1,2.25){\usebox{\tbr}}
+ \put(1,3.25){\usebox{\rbbr}}\put(1,12.25){\usebox{\sss}}
+ \put(1,16.25){\usebox{\sss}}\put(2,2.25){\usebox{\rul}}
+ \put(2,3.25){\usebox{\sul}}\put(2,3.25){\usebox{\sur}}
+ \put(2,3.25){\usebox{\sbl}}\put(2,3.25){\usebox{\tbr}}
+ \put(2,4.25){\usebox{\tull}}\put(2,4.25){\usebox{\sur}}
+ \put(2,4.25){\usebox{\sbr}}\put(2,5.25){\usebox{\rbbr}}
+ \put(2,12.25){\usebox{\sss}}\put(2,16.25){\usebox{\tbbr}}
+ \put(2,16.25){\usebox{\sul}}\put(2,16.25){\usebox{\sur}}
+ \put(2,17.25){\usebox{\rbrr}}\put(3,3.25){\usebox{\rul}}
+ \put(3,4.25){\usebox{\tbrr}}\put(3,4.25){\usebox{\sul}}
+ \put(3,4.25){\usebox{\sbl}}\put(3,5.25){\usebox{\sss}}
+ \put(3,6.25){\usebox{\tull}}\put(3,6.25){\usebox{\sur}}
+ \put(3,6.25){\usebox{\sbr}}\put(3,7.25){\usebox{\rbbr}}
+ \put(3,12.25){\usebox{\sss}}\put(3,16.25){\usebox{\rull}}
+ \put(3,17.25){\usebox{\tuul}}\put(3,17.25){\usebox{\sbl}}
+ \put(3,17.25){\usebox{\sbr}}\put(4,5.25){\usebox{\rul}}
+ \put(4,5.25){\usebox{\rur}}\put(4,6.25){\usebox{\sss}}
+ \put(4,7.25){\usebox{\sss}}\put(4,8.25){\usebox{\sss}}
+ \put(4,9.25){\usebox{\tull}}\put(4,9.25){\usebox{\sur}}
+ \put(4,9.25){\usebox{\sbr}}\put(4,10.25){\usebox{\rbbr}}
+ \put(4,11.25){\usebox{\rur}}\put(4,12.25){\usebox{\sss}}
+ \put(4,13.25){\usebox{\rbr}}\put(4,16.25){\usebox{\rur}}
+ \put(4,17.25){\usebox{\sss}}\put(5,-2.75){\usebox{\sul}}
+ \put(5,-2.75){\usebox{\sur}}\put(5,-2.75){\usebox{\cbl}}
+ \put(5,-2.75){\usebox{\sbr}}\put(5,-1.75){\usebox{\sss}}
+ \put(5,-0.75){\usebox{\sss}}\put(5,0.25){\usebox{\sss}}
+ \put(5,1.25){\usebox{\sss}}\put(5,2.25){\usebox{\sss}}
+ \put(5,3.25){\usebox{\sss}}\put(5,4.25){\usebox{\sss}}
+ \put(5,5.25){\usebox{\sss}}\put(5,6.25){\usebox{\sss}}
+ \put(5,7.25){\usebox{\sss}}\put(5,8.25){\usebox{\sss}}
+ \put(5,9.25){\usebox{\sss}}\put(5,10.25){\usebox{\sss}}
+ \put(5,11.25){\usebox{\sss}}\put(5,12.25){\usebox{\sss}}
+ \put(5,13.25){\usebox{\sss}}\put(5,14.25){\usebox{\sss}}
+ \put(5,15.25){\usebox{\sss}}\put(5,16.25){\usebox{\sss}}
+ \put(5,17.25){\usebox{\sss}}\put(5,18.25){\usebox{\rbrr}}
+ \put(6,-2.75){\usebox{\sul}}\put(6,-2.75){\usebox{\sur}}
+ \put(6,-2.75){\usebox{\sbl}}\put(6,-2.75){\usebox{\cbr}}
+ \put(6,-1.75){\usebox{\sss}}\put(6,-0.75){\usebox{\sss}}
+ \put(6,0.25){\usebox{\sss}}\put(6,1.25){\usebox{\sss}}
+ \put(6,2.25){\usebox{\sss}}\put(6,3.25){\usebox{\sss}}
+ \put(6,4.25){\usebox{\sss}}\put(6,5.25){\usebox{\sss}}
+ \put(6,6.25){\usebox{\sss}}\put(6,7.25){\usebox{\sss}}
+ \put(6,8.25){\usebox{\sss}}\put(6,9.25){\usebox{\sss}}
+ \put(6,10.25){\usebox{\sss}}\put(6,11.25){\usebox{\sss}}
+ \put(6,12.25){\usebox{\sss}}\put(6,13.25){\usebox{\sss}}
+ \put(6,14.25){\usebox{\sss}}\put(6,15.25){\usebox{\sss}}
+ \put(6,16.25){\usebox{\sss}}\put(6,17.25){\usebox{\sss}}
+ \put(6,18.25){\usebox{\tuul}}\put(6,18.25){\usebox{\sbl}}
+ \put(6,18.25){\usebox{\sbr}}\put(7,7.25){\usebox{\rul}}
+ \put(7,8.25){\usebox{\sss}}\put(7,9.25){\usebox{\rbl}}
+ \put(7,11.25){\usebox{\rul}}\put(7,12.25){\usebox{\sss}}
+ \put(7,13.25){\usebox{\rbl}}\put(7,17.25){\usebox{\rul}}
+ \put(7,18.25){\usebox{\sss}}\put(7,19.25){\usebox{\rbrr}}
+ \put(8,7.25){\usebox{\rurr}}\put(8,8.25){\usebox{\tuur}}
+ \put(8,8.25){\usebox{\sbl}}\put(8,8.25){\usebox{\sbr}}
+ \put(8,12.25){\usebox{\sss}}\put(8,13.25){\usebox{\rbrr}}
+ \put(8,18.25){\usebox{\tbbr}}\put(8,18.25){\usebox{\sul}}
+ \put(8,18.25){\usebox{\sur}}\put(8,19.25){\usebox{\tul}}
+ \put(8,19.25){\usebox{\sur}}\put(8,19.25){\usebox{\sbl}}
+ \put(8,19.25){\usebox{\sbr}}\put(8,20.25){\usebox{\rbr}}
+ \put(9,-1.75){\usebox{\ruur}}\put(9,-0.75){\usebox{\cul}}
+ \put(9,-0.75){\usebox{\sur}}\put(9,-0.75){\usebox{\tbl}}
+ \put(9,-0.75){\usebox{\sbr}}\put(9,6.25){\usebox{\ruur}}
+ \put(9,7.25){\usebox{\sul}}\put(9,7.25){\usebox{\sur}}
+ \put(9,7.25){\usebox{\tbl}}\put(9,7.25){\usebox{\sbr}}
+ \put(9,8.25){\usebox{\rbll}}\put(9,12.25){\usebox{\sss}}
+ \put(9,13.25){\usebox{\tuul}}\put(9,13.25){\usebox{\sbl}}
+ \put(9,13.25){\usebox{\sbr}}\put(9,18.25){\usebox{\rull}}
+ \put(9,19.25){\usebox{\sss}}\put(9,20.25){\usebox{\tuul}}
+ \put(9,20.25){\usebox{\sbl}}\put(9,20.25){\usebox{\sbr}}
+ \put(10,-2.75){\usebox{\sul}}\put(10,-2.75){\usebox{\sur}}
+ \put(10,-2.75){\usebox{\cbl}}\put(10,-2.75){\usebox{\tbr}}
+ \put(10,-1.75){\usebox{\sss}}\put(10,-0.75){\usebox{\sss}}
+ \put(10,5.25){\usebox{\sul}}\put(10,5.25){\usebox{\sur}}
+ \put(10,5.25){\usebox{\cbl}}\put(10,5.25){\usebox{\sbr}}
+ \put(10,6.25){\usebox{\sss}}\put(10,7.25){\usebox{\tuur}}
+ \put(10,7.25){\usebox{\sbl}}\put(10,7.25){\usebox{\sbr}}
+ \put(10,12.25){\usebox{\sss}}\put(10,13.25){\usebox{\tuur}}
+ \put(10,13.25){\usebox{\sbl}}\put(10,13.25){\usebox{\sbr}}
+ \put(10,19.25){\usebox{\sss}}\put(10,20.25){\usebox{\tuur}}
+ \put(10,20.25){\usebox{\sbl}}\put(10,20.25){\usebox{\sbr}}
+ \put(11,-2.75){\usebox{\rull}}\put(11,-1.75){\usebox{\sss}}
+ \put(11,-0.75){\usebox{\sss}}\put(11,5.25){\usebox{\sul}}
+ \put(11,5.25){\usebox{\sur}}\put(11,5.25){\usebox{\sbl}}
+ \put(11,5.25){\usebox{\cbr}}\put(11,6.25){\usebox{\turr}}
+ \put(11,6.25){\usebox{\sul}}\put(11,6.25){\usebox{\sbl}}
+ \put(11,7.25){\usebox{\rbl}}\put(11,12.25){\usebox{\sul}}
+ \put(11,12.25){\usebox{\tur}}\put(11,12.25){\usebox{\sbl}}
+ \put(11,12.25){\usebox{\cbr}}\put(11,13.25){\usebox{\rbl}}
+ \put(11,19.25){\usebox{\sul}}\put(11,19.25){\usebox{\tur}}
+ \put(11,19.25){\usebox{\sbl}}\put(11,19.25){\usebox{\cbr}}
+ \put(11,20.25){\usebox{\rbl}}\put(12,-1.75){\usebox{\sss}}
+ \put(12,-0.75){\usebox{\sss}}\put(12,0.25){\usebox{\rbr}}
+ \put(13,-1.75){\usebox{\tbbr}}\put(13,-1.75){\usebox{\sul}}
+ \put(13,-1.75){\usebox{\sur}}\put(13,-0.75){\usebox{\sss}}
+ \put(13,0.25){\usebox{\sss}}\put(13,1.25){\usebox{\tull}}
+ \put(13,1.25){\usebox{\sur}}\put(13,1.25){\usebox{\sbr}}
+ \put(13,2.25){\usebox{\rbbr}}\put(14,-1.75){\usebox{\rull}}
+ \put(14,-0.75){\usebox{\sss}}\put(14,0.25){\usebox{\rbl}}
+ \put(14,1.25){\usebox{\ruul}}\put(14,2.25){\usebox{\tbrr}}
+ \put(14,2.25){\usebox{\sul}}\put(14,2.25){\usebox{\sbl}}
+ \put(14,3.25){\usebox{\sss}}\put(14,4.25){\usebox{\sss}}
+ \put(14,5.25){\usebox{\tull}}\put(14,5.25){\usebox{\sur}}
+ \put(14,5.25){\usebox{\sbr}}\put(14,6.25){\usebox{\rbbr}}
+ \put(15,-0.75){\usebox{\sss}}\put(15,3.25){\usebox{\ruul}}
+ \put(15,4.25){\usebox{\tbrr}}\put(15,4.25){\usebox{\sul}}
+ \put(15,4.25){\usebox{\sbl}}\put(15,5.25){\usebox{\sss}}
+ \put(15,6.25){\usebox{\sss}}\put(15,7.25){\usebox{\sss}}
+ \put(15,8.25){\usebox{\sss}}\put(15,9.25){\usebox{\sss}}
+ \put(15,10.25){\usebox{\sss}}\put(15,11.25){\usebox{\sss}}
+ \put(15,12.25){\usebox{\tull}}\put(15,12.25){\usebox{\sur}}
+ \put(15,12.25){\usebox{\sbr}}\put(15,13.25){\usebox{\rbbr}}
+ \put(16,-0.75){\usebox{\sss}}\put(16,7.25){\usebox{\ruul}}
+ \put(16,8.25){\usebox{\tbrr}}\put(16,8.25){\usebox{\sul}}
+ \put(16,8.25){\usebox{\sbl}}\put(16,9.25){\usebox{\sss}}
+ \put(16,10.25){\usebox{\sss}}\put(16,11.25){\usebox{\sss}}
+ \put(16,12.25){\usebox{\sss}}\put(16,13.25){\usebox{\sss}}
+ \put(16,14.25){\usebox{\sss}}\put(16,15.25){\usebox{\sss}}
+ \put(16,16.25){\usebox{\sss}}\put(16,17.25){\usebox{\sss}}
+ \put(16,18.25){\usebox{\sss}}\put(16,19.25){\usebox{\sss}}
+ \put(16,20.25){\usebox{\cul}}\put(16,20.25){\usebox{\tur}}
+ \put(16,20.25){\usebox{\sbl}}\put(16,20.25){\usebox{\sbr}}
+ \put(17,-0.75){\usebox{\tbbr}}\put(17,-0.75){\usebox{\sul}}
+ \put(17,-0.75){\usebox{\sur}}\put(17,0.25){\usebox{\rbrr}}
+ \put(17,12.25){\usebox{\ruul}}\put(17,13.25){\usebox{\tbrr}}
+ \put(17,13.25){\usebox{\sul}}\put(17,13.25){\usebox{\sbl}}
+ \put(17,14.25){\usebox{\sss}}\put(17,15.25){\usebox{\sss}}
+ \put(17,16.25){\usebox{\sss}}\put(17,17.25){\usebox{\sss}}
+ \put(17,18.25){\usebox{\sss}}\put(17,19.25){\usebox{\sss}}
+ \put(17,20.25){\usebox{\rbll}}\put(18,-0.75){\usebox{\rull}}
+ \put(18,0.25){\usebox{\tuul}}\put(18,0.25){\usebox{\sbl}}
+ \put(18,0.25){\usebox{\sbr}}\put(18,18.25){\usebox{\ruul}}
+ \put(18,19.25){\usebox{\sul}}\put(18,19.25){\usebox{\cur}}
+ \put(18,19.25){\usebox{\sbl}}\put(18,19.25){\usebox{\tbr}}
+ \put(19,0.25){\usebox{\sss}}\put(19,3.25){\usebox{\ruur}}
+ \put(19,4.25){\usebox{\cul}}\put(19,4.25){\usebox{\tur}}
+ \put(19,4.25){\usebox{\tbl}}\put(19,4.25){\usebox{\sbr}}
+ \put(20,0.25){\usebox{\sss}}\put(20,1.25){\usebox{\ruur}}
+ \put(20,1.25){\usebox{\rbr}}\put(20,2.25){\usebox{\tbll}}
+ \put(20,2.25){\usebox{\sur}}\put(20,2.25){\usebox{\sbr}}
+ \put(20,3.25){\usebox{\sul}}\put(20,3.25){\usebox{\tur}}
+ \put(20,3.25){\usebox{\sbl}}\put(20,3.25){\usebox{\sbr}}
+ \put(20,4.25){\usebox{\rbl}}\put(21,-0.75){\usebox{\rur}}
+ \put(21,0.25){\usebox{\sss}}\put(21,1.25){\usebox{\sss}}
+ \put(21,2.25){\usebox{\sul}}\put(21,2.25){\usebox{\tur}}
+ \put(21,2.25){\usebox{\sbl}}\put(21,2.25){\usebox{\sbr}}
+ \put(21,3.25){\usebox{\rbl}}\put(22,-2.75){\usebox{\sul}}
+ \put(22,-2.75){\usebox{\sur}}\put(22,-2.75){\usebox{\cbl}}
+ \put(22,-2.75){\usebox{\sbr}}\put(22,-1.75){\usebox{\sss}}
+ \put(22,-0.75){\usebox{\sss}}\put(22,0.25){\usebox{\sss}}
+ \put(22,1.25){\usebox{\turr}}\put(22,1.25){\usebox{\sul}}
+ \put(22,1.25){\usebox{\sbl}}\put(22,2.25){\usebox{\rbl}}
+ \put(23,-2.75){\usebox{\sul}}\put(23,-2.75){\usebox{\sur}}
+ \put(23,-2.75){\usebox{\sbl}}\put(23,-2.75){\usebox{\cbr}}
+ \put(23,-1.75){\usebox{\sss}}\put(23,-0.75){\usebox{\turr}}
+ \put(23,-0.75){\usebox{\sul}}\put(23,-0.75){\usebox{\sbl}}
+ \put(23,0.25){\usebox{\rbbl}}
+ \sbox{\sss}{}
+ \sbox{\sul}{}\sbox{\sur}{}\sbox{\sbr}{}\sbox{\sbl}{}
+ \sbox{\cul}{}\sbox{\cur}{}\sbox{\cbr}{}\sbox{\cbl}{}
+ \sbox{\tul}{}\sbox{\tur}{}\sbox{\tbr}{}\sbox{\tbl}{}
+ \sbox{\rul}{}\sbox{\rur}{}\sbox{\rbr}{}\sbox{\rbl}{}
+ \sbox{\tuul}{}\sbox{\tuur}{}\sbox{\tbbl}{}\sbox{\tbbr}{}
+ \sbox{\tull}{}\sbox{\turr}{}\sbox{\tbll}{}\sbox{\tbrr}{}
+ \sbox{\ruul}{}\sbox{\ruur}{}\sbox{\rbbl}{}\sbox{\rbbr}{}
+ \sbox{\rull}{}\sbox{\rurr}{}\sbox{\rbll}{}\sbox{\rbrr}{}
+ \end{picture}}
+ \end{picture}
+ \end{center}
+ \caption{Bitmap and Continuous Character.}
+ \label{bitmapandcontinuouscharacter}
+\end{figure}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\section{The \LLaTeX\ Interface}
+\typeout{3 The [La]TeX Interface}
+\label{thelatexinterface}
+
+The next challenge is to make \LLaTeX\ understand the output of a japanese text
+editor. There seems to be three ways of achieving this. First, one can modify
+the input routines of \TeX\ and recompile it. This is the approach used by
+J\TeX\ and \mbox{ASCII-j\TeX}. For the reasons mentioned in
+Subsection~\ref{whyjemtex}, I do not want to get into rebuilding \TeX.
+A second possibility is to write macros to have \TeX\ understand japanese.
+Unfortunately, I do not have the expertise to do that.
+
+The third possibility is to write a preprocessor to transform any japanese
+document into a standard \LLaTeX\ one. And I do know enough about japanese and
+\TeX\ to accomplish this. This important decision has several consequences. If
+I am to have the power of any programming language available somewhere in the
+chain from a japanese text to a final \LLaTeX\ document, I might as well fully
+exploit that power. As much as possible of the work should be done by the
+compiled preprocessor, keeping the necessary interpreted \LLaTeX\ macros simple
+and fast. This philosophy is present in many aspects of my work.
+
+\newpage %improve a bad page break
+
+The \JemTeX\ preprocessor deals with the following issues:
+\begin{itemize}
+ \item Loading and calling \JemTeX\ fonts.
+ \item Japanese hyphenation.
+ \item Japanese spacing.
+\end{itemize}
+
+The next subsections will discuss these topics and related subjects, before
+eventually taking up the actual operation of the preprocessor.
+
+\subsection{Japanese Encodings}
+\label{japaneseencodings}
+
+The reasonable thing to do at this point is to look into how japanese is
+represented by a japanese text editor. The first method I came across is the
+Japanese Industrial Standard (JIS). Unfortunately, my japanese text editor is
+very unreliable in JIS mode and this is why I never use it in this mode. I also
+do not know exactly how JIS works, but I do know that it involves escape
+sequences. I will be happy to support it in future versions of \JemTeX\, if
+users express that need and if somebody gives me more information about it.
+
+\label{euc}
+
+The second method is the Extended UNIX Code (EUC). I like it because it is the
+only encoding that my japanese text editor handles reliably. Each japanese
+character is represented by a pair of ASCII characters in the range
+$[161,\ldots,254]$. Given an EUC character $(x,y)$, its position in the JIS~24
+dot font is simply:
+ \[ 94 \times ( x - 161 ) + ( y - 161 ) + 1 \]
+
+\label{mskanji}
+
+A third method is the \mbox{MS-kanji} (\mbox{Shift-JIS}) code which is very
+popular in the DOS world. As for EUC, each japanese character is represented by
+a pair of ASCII characters. The first character is always in the range
+$[129,\ldots,159,224,\ldots,234]$ and the second character is always in the
+range $[64,\ldots,126,128,\ldots,252]$. Given an \mbox{MS-kanji} character,
+consider the coordinates $(x,y)$ obtained by shifting the upper subranges so
+that they are consecutive to the lower subranges, the position of the character
+in the JIS~24 dot font then is:
+ \[ 188 \times ( x - 129 ) + ( y - 64 ) + 1 \]
+
+The preprocessor supports EUC and \mbox{MS-kanji}. You may freely use both in
+any \JemTeX\ document.
+
+\subsection{Using Fonts}
+\label{usingfonts}
+
+This subsection covers all the details having to do with \JemTeX\ fonts.
+
+One of the operation carried out by the preprocessor is the replacement of any
+EUC or \mbox{MS-kanji} character pair by the appropriate font name and symbol
+number. However, all \JemTeX\ fonts must first be declared in a \LLaTeX\ header
+before they can be used.
+
+\label{header}
+
+In \LaTeX, a \JemTeX\ font at magstep~$3.0$, say, is loaded with the following
+command:
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+\newfont{\keac}{kanjiac scaled 1728}
+\end{verbatim}
+\end{quote}
+In \TeX, it is loaded with:
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+\font\keac=kanjiac scaled 1728
+\end{verbatim}
+\end{quote}
+The \JemTeX\ font is referred to by \verb"\keac", which is a convenient short
+name. The number $1728$ comes from $1728 = 1000 \times 1.2^{3.0}$.
+
+The preprocessor scans the input file in a first pass and determines the
+\JemTeX\ fonts needed. It then writes a \LLaTeX\ header to load these fonts,
+and finally appends the translation obtained by a second pass of the input
+file.
+
+There are at most 128~symbols numbered from~0 to~127 in a \JemTeX\ font. A
+japanese symbol can be produced in \TeX\ and in \LaTeX\ with the following
+command:
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+\kk{\keac}{65}
+\end{verbatim}
+\end{quote}
+The preprocessor will supply these automatically for you.
+
+\subsection{Hyphenation}
+\label{hyphenation}
+
+In order to produce a right margin which is even, \TeX\ occasionally needs to
+hyphenate some words. Although it is pretty good at this in english, \TeX\ is
+incapable of doing it in japanese. Therefore, the preprocessor must supply
+explicitly all possible hyphenation locations for \TeX. This subsection
+describes the rules governing this process.
+
+\label{hyphen}
+
+Hyphenation is relevant only between two consecutive characters. Hyphenation in
+english is obtained with a \verb"\-" command. In japanese, it is obtained with
+a \verb"\hh" command. The preprocessor will never allow japanese hyphenation
+between two characters when one or both are roman. But if the two characters
+are japanese, it may insert a \verb"\hh" command in between. Contrary to
+english, no - gets appended at the end of a line hyphenated by a \verb"\hh"
+command.
+
+All japanese characters encountered are classified as {\em alphabetical\/} or
+{\em symbolic}. The alphabetical japanese characters are hiraganas, katakanas,
+and kanjis. All other japanese characters found in the JIS~24 dot font are
+symbolic, they include punctuation signs, english, greek, and russian
+characters.
+
+This classification is important because it is difficult for the \JemTeX\
+preprocessor to automatically decide where to allow hyphenation when
+mathematics or foreign languages are concerned. Consequently, the preprocessor
+never allows hyphenation between two japanese characters when both are
+symbolic. But if one or both japanese characters are alphabetical, hyphenation
+may be allowed since one can hyphenate anywhere in japanese, except possibly
+when punctuation signs are involved. This is not too difficult to handle for
+the preprocessor.
+
+More precisely, the preprocessor will not allow hyphenation before the
+following japanese punctuation signs .,!?:;$\cdot)]\}\rfloor\rangle$'\,'' and
+other related closing characters. It will not allow hyphenation either after
+$([\{\lceil\langle$`\,`` and other related opening characters.
+
+\label{preventh}
+
+If you would like to allow japanese hyphenation where the preprocessor would
+not allow it, simply put a \verb"\hh" command at the right place in your
+source file. If the next character is a roman letter, you have to use instead
+\verb"\hh{}" to prevent confusion. If you would like to prevent the
+preprocessor from allowing japanese hyphenation, put a \verb"{}" to separate
+the two consecutive japanese characters in your source file. The preprocessor
+will not realize that the japanese characters are consecutive anymore, and it
+will not allow hyphenation.
+
+\subsection{Spacing}
+\label{spacing}
+
+In addition to explicitly telling \TeX\ where japanese hyphenation is allowed,
+it is also necessary to add space around some japanese characters. For example,
+this occurs around japanese punctuation signs or at transitions from japanese
+to roman. Indeed, when \TeX\ comes across the command \verb"\kk{\kaaa}{3}", it
+has no idea that this is a japanese period. The preprocessor has to give \TeX\
+a hand in these cases. Such space must always be added after any hyphenation
+command \verb"\hh" that may already have been inserted. Otherwise, you risk
+compromising the flush right margin.
+
+\TeX\ normally introduces extra space after a roman period only if a roman
+space follows it. My japanese text editor does not support spaces while in
+japanese mode. After all, there are no spaces between words in japanese. This
+implies that one would have to enter, say, a japanese period, then switch to
+roman mode, enter a space, and finally switch back to japanese mode. I think
+this is too cumbersome. Therefore, the preprocessor handles japanese spacing
+issues without expecting roman spaces anywhere.
+
+\label{bigmedium}
+
+The preprocessor uses three types of space to achieve its goal; a big space
+with a \verb"\eeee" command, a medium space with a \verb"\eee" command, and a
+tiny space with a \verb"\ee" command. Only one space is added at one place. For
+example, if logic calls for a big, a medium, and a medium space between two
+consecutive characters, only a big one will be inserted by the preprocessor.
+
+No space is ever added between two consecutive roman characters, but as soon as
+one or both characters are japanese, space may become necessary. Let us first
+look at the mixed case where one japanese character is involved with a roman
+one. A big space is inserted after all japanese punctuation signs .,!?\
+followed by a roman character. A medium space is inserted after all japanese
+punctuation signs :;$\cdot)]\}\rfloor\rangle$'\,'' followed by a roman
+character. A medium space is also inserted after all roman characters followed
+by any of the japanese punctuation signs $\cdot([\{\lceil\langle$`\,``.
+
+This takes care of the japanese punctuation spaces. Space is also added for
+transitions as follows. A medium space is inserted after all roman letters and
+all roman digits followed by a japanese character, except if that japanese
+character is any of the following punctuation signs
+.,!?:;$)]\}\rfloor\rangle$'\,''. A medium space is also inserted after a
+japanese character followed by a roman letter or a roman digit, except if that
+japanese character is any of the following punctuation signs
+$([\{\lceil\langle$`\,``.
+
+The case of two consecutive japanese characters is more precise since more
+information is known. It is also closely related to the previous mixed case.
+A big space is inserted after all japanese punctuation signs .,!? but not
+before any of the japanese punctuation signs .,!?$)]\}\rfloor\rangle$'\,''.
+A medium space is inserted after all japanese punctuation signs
+:;$\cdot)]\}\rfloor\rangle$'\,'' but not before any of the japanese punctuation
+signs .,!?:;$)]\}\rfloor\rangle$'\,''. A medium space is also inserted before
+all the japanese punctuation signs $\cdot([\{\lceil\langle$`\,`` but not after
+any of the japanese punctuation signs $([\{\lceil\langle$`\,``.
+
+This covers all cases of big and medium spaces. If you would like to add space
+where the preprocessor would not, simply put a \verb"\eeee" command or a
+\verb"\eee" command at the right place in your source file. Remember to do that
+only after any hyphenation \verb"\hh" command that you may already have added.
+If the next character is a roman letter, you have to use instead \verb"\eeee{}"
+and \verb"\eee{}" to prevent confusion.
+
+\label{prevents}
+
+There are cases where it is preferable to have no extra space after a japanese
+punctuation sign. For example, when typesetting music with \MuTeX, one does not
+want extra space if the japanese text is going under the staff. This affects
+adversary its centering under notes. If you would like to prevent the
+preprocessor from adding space, try to put a \verb"{}" at the right place to
+separate the two consecutive japanese characters, or the japanese character
+from the roman letter or the roman digit. In the few remaining cases where this
+cannot work, you have to temporarily disable the preprocessor's ability to add
+spaces. Subsection~\ref{thejem2texpreprocessor} explains how to do this.
+
+Tiny space has to do with line breaking, and it is very important. \TeX\
+creates a flush right margin by adding extra space between words. However,
+\TeX\ does not add extra space between characters making up words. Since words
+in japanese are not separated by spaces, the only opportunity \TeX\ has to add
+extra space is where big and medium spaces have been added by the preprocessor.
+Some long japanese sentence may span several lines without any added space.
+\TeX\ then has no opportunity at all to stretch space in order to generate a
+flush right margin.
+
+To solve this serious problem, a tiny space is added between all consecutive
+japanese characters, unless some big or medium space has already been inserted.
+If you should ever want to disable this feature, proceed as before by inserting
+a \verb"{}" at the right place. This will always work.
+
+\subsection{\LLaTeX\ Comments}
+\label{llatexcomments}
+
+It is quite clear from the previous two subsections that the concept of
+consecutive characters is very important for the preprocessor. This notion is
+closely related to \LLaTeX\ comments and end of lines. Let us first discuss the
+english case before moving on to the japanese one.
+
+\newpage %improve a bad page break
+
+In most circumstances, the character \verb"%" tells \TeX\ to consider the
+remainder of the current line as a comment and to simply ignore it. Consider
+the following example:
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+A% Here is a TeX comment.
+% Here is a TeX comment.
+B% Here is a TeX comment.
+\end{verbatim}
+\end{quote}
+Even though \verb"A" and \verb"B" are not at all consecutive in the source file
+because of the comments separating them, they are consecutive as far as \TeX\
+is concerned. One could equally well have entered instead \verb"AB" without any
+comments in between.
+
+Consider now another example:
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+A
+B
+\end{verbatim}
+\end{quote}
+The characters \verb"A" and \verb"B" are not consecutive because they are
+separated by an invisible end of line character. \TeX\ treats an end of line
+character just like if a space was present between \verb"A" and \verb"B".
+
+These remarks apply equally well if \verb"A" and \verb"B" were japanese
+characters. To distinguish both types of end of line, I will say that an end of
+line is roman if the last character on that line is a roman character. A
+similar definition holds for japanese end of lines. It is important for the
+preprocessor to determine if japanese characters are consecutive in order to
+allow hyphenation and add space correctly. The remainder of this subsection
+explains how this is achieved.
+
+In english, any given input line usually terminates just after a word. The end
+of line character after that word is replaced by a space by \TeX, which is
+perfectly acceptable since a space should separate english words. In japanese,
+there is no space between words, so this end of line character must be removed
+to prevent \TeX\ from adding space. There are two ways of doing this while
+using \JemTeX.
+
+\label{eol}
+
+First, you can explicitly put a \verb"%" after all japanese end of lines. This
+will always work, but it is also tedious. Second, you can let the preprocessor
+do that for you. However, you should make sure your input lines do end with a
+japanese character, not a roman space character. This can be a problem because
+some text editors insist on putting some space characters at the end of each
+line. You should make sure that your text editor does not do so. Then, the
+\JemTeX\ preprocessor will have no problem in detecting japanese end of lines
+and will add all the \verb"%" characters for you.
+
+It is also important for the preprocessor to detect \TeX\ comments. The
+preprocessor recognizes a comment if it starts in the first column of the input
+file, or if it's a comment that the processor had to insert itself, i.e.\ after
+a japanese end of line. Therefore, when typing the japanese parts of your
+source file, you should always use comments starting in the first column and
+let the preprocessor handle japanese end of lines. This makes it almost certain
+that the preprocessor will handle hyphenation and spacing correctly.
+
+\subsection{\LLaTeX\ Limitations}
+\label{llatexlimitations}
+
+The previous subsections introduced the different operations that the \JemTeX\
+preprocessor must perform in order to produce an acceptable \LLaTeX\ document
+from a japanese one. Each japanese character is replaced by a command like
+\verb"\kk{\kaaa}{109}" potentially followed by an hyphenation command
+\verb"\hh" and potentially followed by a spacing command like \verb"\eeee{}".
+In the worst case, the two characters representing the original japanese one
+are replaced by approximately 25~roman characters.
+
+This expansion of the source file could cause some problems because there is a
+limit to the maximum length of an input line that \TeX\ can accept. Here are
+typical statistics for one big \emTeX\ run:
+\begin{small}%Don't put spaces after the next line!
+\begin{verbatim}
+Here is how much of TeX's memory you used:
+ 181 strings out of 6937
+ 1607 string characters out of 28560
+ 83907 words of memory out of 262142
+ 2145 multiletter control sequences out of 5000
+ 20585 words of font info for 79 fonts, out of 81920 for 254
+ 15 hyphenation exceptions out of 607
+ 13i,8n,21p,321b,309s positions out of 300i,100n,60p,3000b,1000s
+\end{verbatim}
+\end{small}
+
+The last line (\verb"3000b") tells us that big \emTeX\ can accept input lines
+of 3000~roman characters. Therefore, big \emTeX\ can handle lines of
+approximately 120~japanese characters. Most monitors support only~40, 80, or
+132~characters per line, that should be enough. However, some japanese text
+editors display text on separate lines while whole paragraphs are actually kept
+on one single line internally. You should make sure that your japanese text
+editor does split its paragraphs into lines of a reasonable size.
+
+The only potential remaining problem has to do with the \verb".toc" and
+\verb".aux" files. These files are created by \LaTeX\ for its personal use and
+contain such things as chapter names, cross-references, etc. These are always
+formatted one item per line. If you have a chapter name which is longer than
+120~japanese characters, you can split it on several lines in your source file.
+Then, \LaTeX\ will have no problem with the title itself. But in its first
+pass, it will create the \verb".toc" and \verb".aux" files which will have a
+very long line. When \LaTeX\ starts to read the resulting \verb".aux" file on
+its second pass, it will complain that the line is too long and stop. I think
+it is unlikely that you will ever have such a long chapter name. But if you do,
+here is my solution.
+
+Suppose your \verb".aux" file contains one long line of japanese text:
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+\@writefile{toc}{Very long japanese text.}
+\end{verbatim}
+\end{quote}
+Edit the \verb".aux" file and replace the troublesome line by:
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+\@writefile{toc}{\texta \textb \textc \textd}
+\end{verbatim}
+\end{quote}
+And add the following macros to your \LaTeX\ source file:
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+\newcommand{\texta}{Very}
+\newcommand{\textb}{long}
+\newcommand{\textc}{japanese}
+\newcommand{\textd}{text.}
+\end{verbatim}
+\end{quote}
+Having done all that, you may now successfully run \LaTeX\ once.
+
+Unfortunately, this run will modify your \verb".aux" file again. There are two
+ways around this. First, you could use the \LaTeX\ command \verb"\nofiles".
+Secondly, you could edit your \verb".aux" once again. As I already mentioned,
+it is unlikely that you will ever need to resort to this trick since the
+current limit of 120~japanese characters is quite reasonable. But if you are
+curious, that's how you can avoid the problem.
+
+\subsection{The {\tt JEM2TEX} Preprocessor}
+\label{thejem2texpreprocessor}
+
+Given a japanese source file, my program \verb"JEM2TEX" can generate an
+equivalent \LLaTeX\ source file. You have been supplied with the source and the
+compressed compiled version of this C program. The only information necessary
+is the source file name and some parameters. \verb"JEM2TEX" will try the file
+name extensions \verb".jem", \verb".jpn", and \verb".jap" for you so you do not
+need to specify them.
+
+If you simply start \verb"JEM2TEX" without any command line information, it
+will run in manual mode where you must answer questions interactively
+throughout the operation. If you specify any command line information, the
+preprocessor then runs in automatic mode. In addition to specifying the source
+file name on the command line, you can also supply command line parameters on
+it. These always begin with a \verb"/" or a \verb"-", and any combination of
+small and capital letters is acceptable.
+
+In automatic mode, a \LaTeX\ document \verb"japanese.jem" with japanese
+extended EUC characters at magstep~$3.0$, and with spaces to add, and with
+\verb"%" to add at japanese end of lines is assumed as default. However, you
+may override or confirm any of these default values with the appropriate
+command line parameters. The recognized ones are listed in
+Tables~\ref{spaceparameters}, \ref{japaneseeolparameters},
+\ref{encodingparameters}, \ref{fontsizeparameters}, and~\ref{headerparameters}.
+
+\begin{table}[htb]
+ \begin{center}
+ \begin{tabular}{ll}
+ \mbox{$\left.\parbox{3cm}{%
+ \verb"/Space" \\
+ \verb"/Extra" \\
+ \verb"/ExtraSpace"}\right\}$} & Spaces added. \\[5.5mm]
+ \mbox{$\left.\parbox{3cm}{%
+ \verb"/NoSpace" \\
+ \verb"/NoExtra" \\
+ \verb"/NoExtraSpace"}\right\}$} & No spaces added.
+ \end{tabular}
+ \end{center}
+ \caption{Space Parameters.}
+ \label{spaceparameters}
+ \begin{center}
+ \begin{tabular}{ll}
+ \mbox{$\left.\parbox{2.3cm}{%
+ \verb"/EOL" \\
+ \verb"/Percent" \\
+ \verb"/Comment"}\right\}$} & \verb"%" added. \\[6.5mm]
+ \mbox{$\left.\parbox{2.3cm}{%
+ \verb"/NoEOL" \\
+ \verb"/NoPercent" \\
+ \verb"/NoComment"}\right\}$} & No \verb"%" added.
+ \end{tabular}
+ \end{center}
+ \caption{Japanese EOL Parameters.}
+ \label{japaneseeolparameters}
+\end{table}
+
+\newpage %improve a bad page break
+
+\begin{table}[htb]
+ \begin{center}
+ \begin{tabular}{ll}
+ \parbox{2.2cm}{\verb"/EUC"} & Extended UNIX code. \\[1.5mm]
+ \mbox{$\left.\parbox{2.2cm}{%
+ \verb"/MSkanji" \\
+ \verb"/ShiftJIS"}\right\}$} & MS-kanji code. \\[2.5mm]
+ \parbox{2.2cm}{\verb"/Extended"} & Extended characters. \\
+ \parbox{2.2cm}{\verb"/Standard"} & Standard characters.
+ \end{tabular}
+ \end{center}
+ \caption{Encoding Parameters.}
+ \label{encodingparameters}
+ \begin{center}
+ \begin{tabular}{ll}
+ \mbox{$\left.\parbox{3cm}{%
+ \verb"/1000 /0.0 /0" \\
+ \verb"/1095 /0.5" \\
+ \verb"/1200 /1.0 /1" \\
+ \verb"/1440 /2.0 /2" \\
+ \verb"/1728 /3.0 /3" \\
+ \verb"/2074 /4.0 /4" \\
+ \verb"/2488 /5.0 /5"}\right\}$} & Initial japanese font size.
+ \end{tabular}
+ \end{center}
+ \caption{Font Size Parameters.}
+ \label{fontsizeparameters}
+ \begin{center}
+ \begin{tabular}{ll}
+ \parbox{1.5cm}{\verb"/LaTeX"} & \LaTeX\ header. \\[1mm]
+ \mbox{$\left.\parbox{1.5cm}{%
+ \verb"/TeX" \\
+ \verb"/MuTeX"}\right\}$} & \TeX\ header.
+ \end{tabular}
+ \end{center}
+ \caption{Header Parameters.}
+ \label{headerparameters}
+\end{table}
+
+For music, I usually use only hiraganas and katakanas. The following is
+appropriate since these japanese characters are simple:
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+jem2tex anri /MuTeX /NoEOL /NoSpace /Standard /EUC /0.5
+\end{verbatim}
+\end{quote}
+For a letter with complicated kanjis, I would rather use:
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+jem2tex yuka /LaTeX /EOL /Space /Extended /EUC /2
+\end{verbatim}
+\end{quote}
+It is also possible to change these parameters at run-time with \TeX\ comments.
+Here is an example:
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+% jem2tex /LaTeX /Space /EOL /MSkanji /1440
+\end{verbatim}
+\end{quote}
+
+The preprocessor expects the \verb"%" to be the first character of the line as
+explained in Subsection~\ref{llatexcomments}. Then one of the keywords
+\verb"jem2tex", \verb"jpn2tex", or~\verb"jap2tex" must follow immediately, or
+after some spaces. Valid parameters are then scanned. The preprocessor will
+produce comments in the \LLaTeX\ file as its status is changed. An invalid
+parameter stops the current scan for parameters, but does not terminate the
+preprocessor's operation.
+
+\label{nospaces}
+\label{fonts}
+
+Run-time parameters can be used to change japanese font sizes according to
+environments and to temporarily disable space insertion. I also always put in
+the first line of my \verb".jem" files the initial parameters. Here is an
+example:
+\begin{quote}
+\verb"%JEM2TEX /Space /EOL /Extended /EUC /LaTeX" \\
+\verb"\documentstyle[12pt]{tegami}" \\
+\verb"\begin{document}" \\
+\verb"\begin{large}" \\
+\verb"%JEM2TEX /1440" \\
+$\vdots$ \\
+\verb"Here is some japanese text" \\
+\verb"%JEM2TEX /1000" \\
+\verb"\footnote{Japanese footnote.}%" \\
+\verb"%JEM2TEX /1440" \\
+\verb"with a footnote showing the font size change." \\
+$\vdots$ \\
+\verb"\end{large}" \\
+\verb"\end{document}"
+\end{quote}
+
+\label{12points}
+
+As mentioned in the \LaTeX\ book about loading fonts, using a japanese font
+doesn't change style parameters like \verb"\baselineskip". Make sure the
+appropriate size changing command is active when a japanese font is used. In
+the previous example, the \verb"/1440" indicates that magstep~$2.0$ is desired
+for the japanese fonts. The command \verb"large" insures that \LaTeX\ is aware
+of the proper line spacing needed while processing these japanese characters.
+The command \verb"large" also tells \LaTeX\ to use roman characters of a size
+comparable to the japanese ones. I usually use \verb"12pt" document styles and
+Table~\ref{12ptfontsizes} shows the appropriate font sizes for them.
+
+\begin{table}[htb]
+ \begin{center}
+ \begin{tabular}{l|l}
+ \verb"\footnotesize" & \verb"/1000" \\
+ \verb"\small" & \verb"/1095" \\
+ \verb"\normalsize" & \verb"/1200" \\
+ \verb"\large" & \verb"/1440" \\
+ \verb"\Large" & \verb"/1728" \\
+ \verb"\LARGE" & \verb"/2074" \\
+ \verb"\huge" & \verb"/2488"
+ \end{tabular}
+ \end{center}
+ \caption{{\tt 12pt} Font Sizes.}
+ \label{12ptfontsizes}
+\end{table}
+
+Finally, note the \verb"%" at the end of the \verb"\footnote" line in the last
+example. The filter will not append it for you since this is a roman end of the
+line. But this \verb"%" is essential to prevent \LLaTeX\ from inserting some
+inter-word space between the footnote number and the following japanese
+character.
+
+\subsection{Font Tables}
+\label{fonttables}
+
+I occasionally come across a japanese character that my japanese text editor
+cannot insert in the text for me. This is usually the result of an incomplete
+kanji lookup dictionary or a consequence of wanting to use extended JIS~24
+characters. In such cases, one has to enter the character by hand. There are a
+number of ways to do that.
+
+Your japanese text editor may support character entry by \mbox{MS-kanji} or EUC
+numbers. That is certainly the most preferable solution. If not, you could use
+\mbox{Alt-Combinations} under a word processor to enter the arbitrary
+characters in your text. Modifying the source file in these fashions is the
+best approach.
+
+You could also choose to leave a few blank spaces at the right places in the
+source file, process it with \verb"JEM2TEX", and then insert a few \verb"\kk"
+macros with the proper kanji fonts and symbol numbers. Unfortunately, such a
+patch must be performed every time the original source file is modified and
+processed by \verb"JEM2TEX". This is why I never proceed this way.
+
+Because of this foreseeable occasional need, I thought it would be useful to
+create font tables like the ones found in Appendix~F of the {\TeX}book. They
+would have to mention the JIS~24 dot font numbers along with the EUC number
+pairs. I designed such tables at magstep~$3.0$ and managed to squeeze three
+\JemTeX\ fonts per page.
+
+My Pascal program \verb"FONTABLE" creates a 60~Kb japanese file
+\verb"fontable.jem" for you in the current directory. Then, simply process
+that file with \verb"JEM2TEX" in automatic mode to eventually obtain
+\verb"fontable.tex". Finally, complete the process with big \LaTeX\, which
+should yield a twenty page document ready for previewing and printing.
+
+You may have to divide and process this document in smaller pieces for several
+reasons. Perhaps you only have a small version of \TeX. Perhaps your printer
+driver has difficulty processing it. This can be caused by your computer
+lacking memory, but is more likely nowadays to be caused by a primitive printer
+driver lacking a decent memory management system. Perhaps you are using a laser
+printer with only 1~Mb of memory. Note that dot matrix printers do not suffer
+from such lack of memory problems since they have very little memory. Their
+language is very verbose since the fonts are explicitly supplied each time they
+are used.
+
+If needed, you should divide the file \verb"fontable.jem", but not the file
+\verb"fontable.tex" unless you also modify the individual headers to avoid
+loading a lot of fonts for nothing. I think the former approach is easier and
+less error prone. If splitting \verb"fontable.jem" still does not work for you,
+talk to me!
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\section{\JemTeX\ Quick Reference}
+\typeout{4 JemTeX Quick Reference}
+\label{jemtexquickreference}
+\vspace{1cm}
+\begin{quote}%Don't put spaces after the next line!
+\begin{verbatim}
+MF &cm kanjiaa >NUL:
+\end{verbatim}
+\end{quote}
+\begin{center}
+ METAFONT Proof Mode (page~\pageref{mftproof})
+\end{center}
+\vspace{1cm}
+\begin{quote}
+\begin{small}%Don't put spaces after the next line!
+\begin{verbatim}
+MF &cm \mode:=epsonfx; \mag:=magstep(0.0); \input kanjiaa.mf
+\end{verbatim}
+\end{small}
+\end{quote}
+\begin{center}
+ METAFONT Standard Mode (page~\pageref{mftstandard})
+\end{center}
+\vspace{1cm}
+\begin{center}
+ \begin{tabular}{l|ccccccc}
+ Font Size & 1000 & 1095 & 1200 & 1440 & 1728 & 2074 & 2488 \\ \hline
+ Disk Space & 558 & 622 & 680 & 819 & 1008 & 1228 & 1530
+ \end{tabular}
+\end{center}
+\begin{center}
+ Space Requirements (240DPI)
+\end{center}
+\newpage
+\vspace*{\fill}
+\begin{center}
+ \begin{tabular}{ll}
+ \mbox{$\left.\parbox{4.6cm}{%
+ \verb"/FixedWidth" \\
+ \verb"/FixedX" \\
+ \verb"/NoProportionalWidth" \\
+ \verb"/NoProportionalX"}\right\}$} &
+ Fixed width (page~\pageref{widthheight}). \\[8mm]
+ \mbox{$\left.\parbox{4.6cm}{%
+ \verb"/NoFixedWidth" \\
+ \verb"/NoFixedX" \\
+ \verb"/ProportionalWidth" \\
+ \verb"/ProportionalX"}\right\}$} &
+ Minimized width (page~\pageref{widthheight}). \\[8mm]
+ \mbox{$\left.\parbox{4.6cm}{%
+ \verb"/FixedHeight" \\
+ \verb"/FixedY" \\
+ \verb"/NoProportionalHeight" \\
+ \verb"/NoProportionalY"}\right\}$} &
+ Fixed height (page~\pageref{widthheight}). \\[8mm]
+ \mbox{$\left.\parbox{4.6cm}{%
+ \verb"/NoFixedHeight" \\
+ \verb"/NoFixedY" \\
+ \verb"/ProportionalHeight" \\
+ \verb"/ProportionalY"}\right\}$} &
+ Minimized height (page~\pageref{widthheight}). \\[8mm]
+ \parbox{4.6cm}{\verb"/Standard"} &
+ Standard positioning (page~\pageref{positioning}). \\
+ \parbox{4.6cm}{\verb"/Dictionary"} &
+ Dictionary positioning (page~\pageref{positioning}). \\
+ \parbox{4.6cm}{\verb"/Batch"} &
+ Batch mode (page~\pageref{batch}).
+ \end{tabular}
+\end{center}
+\vspace{3mm}
+\begin{center}
+ \verb"JIS2MF" Parameters
+\end{center}
+\vspace*{\fill}
+\newpage
+\vspace*{\fill}
+\begin{center}
+ \begin{tabular}{ll}
+ \parbox{3cm}{\verb"/EUC"} &
+ Extended UNIX code (page~\pageref{euc}). \\[1mm]
+ \mbox{$\left.\parbox{3cm}{%
+ \verb"/MSkanji" \\
+ \verb"/ShiftJIS"}\right\}$} &
+ MS-kanji code (page~\pageref{mskanji}). \\[3mm]
+ \parbox{3cm}{\verb"/Extended"} &
+ Extended characters (page~\pageref{extended}). \\
+ \parbox{3cm}{\verb"/Standard"} &
+ Standard characters (page~\pageref{standard}). \\
+ \parbox{3cm}{\verb"/LaTeX"} &
+ \LaTeX\ header (page~\pageref{header}). \\[1.5mm]
+ \mbox{$\left.\parbox{3cm}{%
+ \verb"/TeX" \\
+ \verb"/MuTeX"}\right\}$} &
+ \TeX\ header (page~\pageref{header}). \\[4mm]
+ \mbox{$\left.\parbox{3cm}{%
+ \verb"/Space" \\
+ \verb"/Extra" \\
+ \verb"/ExtraSpace"}\right\}$} &
+ Spaces added (page~\pageref{spacing}). \\[6mm]
+ \mbox{$\left.\parbox{3cm}{%
+ \verb"/NoSpace" \\
+ \verb"/NoExtra" \\
+ \verb"/NoExtraSpace"}\right\}$} &
+ No spaces added (page~\pageref{nospaces}). \\[6mm]
+ \mbox{$\left.\parbox{3cm}{%
+ \verb"/EOL" \\
+ \verb"/Percent" \\
+ \verb"/Comment"}\right\}$} &
+ \verb"%" added (page~\pageref{eol}). \\[6mm]
+ \mbox{$\left.\parbox{3cm}{%
+ \verb"/NoEOL" \\
+ \verb"/NoPercent" \\
+ \verb"/NoComment"}\right\}$} &
+ No \verb"%" added (page~\pageref{eol}). \\[6mm]
+ \mbox{$\left.\parbox{3cm}{%
+ \verb"/1000 /0.0 /0" \\
+ \verb"/1095 /0.5" \\
+ \verb"/1200 /1.0 /1" \\
+ \verb"/1440 /2.0 /2" \\
+ \verb"/1728 /3.0 /3" \\
+ \verb"/2074 /4.0 /4" \\
+ \verb"/2488 /5.0 /5"}\right\}$} &
+ Initial japanese font size (page~\pageref{fonts}).
+ \end{tabular}
+\end{center}
+\vspace{3mm}
+\begin{center}
+ \verb"JEM2TEX" Parameters
+\end{center}
+\vspace*{\fill}
+\newpage
+\vspace*{\fill}
+\begin{center}
+ \begin{tabular}{l|l}
+ \verb"\hh" & Allow japanese hyphenation (page~\pageref{hyphen}). \\
+ \verb"\eeee" & Insert big space (page~\pageref{bigmedium}). \\
+ \verb"\eee" & Insert medium space (page~\pageref{bigmedium}). \\
+ \verb"{}" & Prevent hyphenation (page~\pageref{preventh}) and space
+ insertion (page~\pageref{prevents}).
+ \end{tabular}
+\end{center}
+\begin{center}
+ Quick Fixes
+\end{center}
+\vspace{1cm}
+\begin{center}
+ \begin{tabular}{l|l}
+ \verb"\footnotesize" & \verb"/1000" \\
+ \verb"\small" & \verb"/1095" \\
+ \verb"\normalsize" & \verb"/1200" \\
+ \verb"\large" & \verb"/1440" \\
+ \verb"\Large" & \verb"/1728" \\
+ \verb"\LARGE" & \verb"/2074" \\
+ \verb"\huge" & \verb"/2488"
+ \end{tabular}
+\end{center}
+\begin{center}
+ \verb"12pt" Font Sizes (page~\pageref{12points})
+\end{center}
+\vspace*{\fill}
+\end{document}
diff --git a/systems/msdos/jemtex2/jis24 b/systems/msdos/jemtex2/jis24
new file mode 100644
index 0000000000..2a3ed9d2e1
--- /dev/null
+++ b/systems/msdos/jemtex2/jis24
Binary files differ
diff --git a/systems/msdos/jemtex2/jis2mf.c b/systems/msdos/jemtex2/jis2mf.c
new file mode 100644
index 0000000000..083fe59e0d
--- /dev/null
+++ b/systems/msdos/jemtex2/jis2mf.c
@@ -0,0 +1,996 @@
+/* -mt -f -A -K -G -O -w */
+/* Compile with Turbo-C 2.0 */
+/*
+ This program generates METAFONT code from a Bitmaps file JIS24
+
+ Author: Francois Jalbert
+ '
+ Date: November 1990
+
+ Version: 1.0
+
+ Date: April 1991
+
+ Version: 2.00
+
+ Modifications: - Added four kanjis.
+ - Fixed incorrect VGA resolution.
+ - Command line parameter now supported.
+ - Added automatic mode.
+ - Added batch mode.
+ - Updated and improved run-time messages.
+ - Long triangles added by Mr. Masatoshi Watanabe. Fantastic!
+ - Fixed and proportional parameters added.
+ - Standard and dictionary parameters added.
+ - JIS24 now accessed through low-level I/O channel for speed.
+
+ Error Levels: 0 - Normal termination.
+ 1 - Error.
+ 2 - All fonts generated (batch).
+*/
+
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#ifdef __TURBOC__
+#include <process.h>
+#endif
+
+#define True 1
+#define False 0
+/* Number of Bitmaps in JIS24 */
+#define BitmapMax 7806
+/* Size of each square Bitmap */
+#define SizeMax 24
+#define SizeMax1 25
+/* DOS file name length */
+#define FileNameDOS 250 /* includes path */
+#define TotalNameDOS 254
+/* DOS Record Size */
+#define RecSize 72 /* SizeMax*SizeMax/8 */
+/* Parameter flag */
+#define Flag1 '/' /* DOS style */
+#define Flag2 '-' /* UNIX style */
+/* Parameter keywords */
+#define ParamMax 20
+char FixedX1[]="FIXEDWIDTH";
+char FixedX2[]="FIXEDX";
+char FixedX3[]="NOPROPORTIONALWIDTH";
+char FixedX4[]="NOPROPORTIONALX";
+char NoFixedX1[]="NOFIXEDWIDTH";
+char NoFixedX2[]="NOFIXEDX";
+char NoFixedX3[]="PROPORTIONALWIDTH";
+char NoFixedX4[]="PROPORTIONALX";
+char FixedY1[]="FIXEDHEIGHT";
+char FixedY2[]="FIXEDY";
+char FixedY3[]="NOPROPORTIONALHEIGHT";
+char FixedY4[]="NOPROPORTIONALY";
+char NoFixedY1[]="NOFIXEDHEIGHT";
+char NoFixedY2[]="NOFIXEDY";
+char NoFixedY3[]="PROPORTIONALHEIGHT";
+char NoFixedY4[]="PROPORTIONALY";
+char Standard1[]="STANDARD";
+char NoStandard1[]="DICTIONARY";
+char Batch1[]="BATCH";
+/* Answer maximum length */
+#define AnswerMax 254
+
+typedef char FileNameType[FileNameDOS+1];
+typedef char TotalNameType[TotalNameDOS+1];
+typedef char ParamType[ParamMax+1];
+typedef char AnswerType[AnswerMax+1];
+/* Buffer for the Bitmap Data */
+struct ColumnType {
+ unsigned char Data1,Data2,Data3;
+};
+typedef struct ColumnType BufferType[SizeMax]; /* start at 0 because of fread */
+/* The Bitmap array is defined larger to simplify the forthcoming code */
+typedef int BitmapType[SizeMax1+1][SizeMax1+1];
+struct BitmapsType {
+ BitmapType Bitmap;
+ int XMin,XMax,YMin,YMax;
+};
+/* Run time parameters */
+struct RunTimeType {
+ FileNameType FileName;
+ /* Batch mode */
+ int Batch;
+ /* Automatic mode for JemTeX fonts only */
+ int Automatic;
+ /* Fixed or proportional fonts */
+ int FixedX,FixedY;
+ /* Standard or dictionary fonts */
+ int Standard;
+};
+
+void Delete(char *String, int Length)
+/* Delete the first Length characters of String */
+{
+ int Index;
+
+ Index=0;
+ do String[Index]=String[Index+Length];
+ while (String[++Index]!='\0');
+}
+
+/*------------------------------- GetParameters -----------------------------*/
+
+void SimpleQuery(char Title[], char ChoiceA[], char ChoiceB[], int *Answer)
+{
+ char JChar[2];
+ int Valid;
+
+ do {
+ Valid=True;
+ printf("%s:\n",Title);
+ printf(" a) %s\n",ChoiceA);
+ printf(" b) %s\n",ChoiceB);
+ printf("Your choice? ");
+ if (ferror(stdout)) exit(1);
+ if (gets(JChar)==NULL) exit(1);
+ if (strlen(JChar)>1) exit(1);
+ JChar[0]=toupper(JChar[0]);
+ if (JChar[0]=='A') *Answer=True;
+ else
+ if (JChar[0]=='B') *Answer=False;
+ else {
+ Valid=False;
+ if (putchar('\7')==EOF) exit(1);
+ }
+ } while (!Valid);
+ printf("\n");
+ if (ferror(stdout)) exit(1);
+}
+
+void GetMode(struct RunTimeType *RunTime)
+/* Determines if the desired font is a JemTeX font */
+{
+ RunTime->Automatic=False;
+ if (toupper(RunTime->FileName[0])=='K')
+ if (toupper(RunTime->FileName[1])=='A')
+ if (toupper(RunTime->FileName[2])=='N')
+ if (toupper(RunTime->FileName[3])=='J')
+ if (toupper(RunTime->FileName[4])=='I')
+ if(('A'<=toupper(RunTime->FileName[5]))&&(toupper(RunTime->FileName[5])<='H'))
+ if(('A'<=toupper(RunTime->FileName[6]))&&(toupper(RunTime->FileName[6])<='H'))
+ if (strlen(RunTime->FileName)==7)
+ if (toupper(RunTime->FileName[5])<='G') RunTime->Automatic=True;
+ else
+ if (toupper(RunTime->FileName[6])<='E') RunTime->Automatic=True;
+}
+
+void EchoParameters(struct RunTimeType *RunTime)
+/* Echoes the current parameters */
+{
+ printf("Font=%s",RunTime->FileName);
+ if (RunTime->FixedX) printf(" Fixed Width");
+ else printf(" Prop. Width");
+ if (RunTime->FixedY) printf(" Fixed Height");
+ else printf(" Prop. Height");
+ if (RunTime->Standard) printf(" Standard");
+ else printf(" Dictionary");
+ if (RunTime->Automatic) printf(" Automatic");
+ else printf(" Manual");
+ if (RunTime->Batch) printf(" Batch");
+ printf(".\n");
+ if (ferror(stdout)) exit(1);
+}
+
+void Manual(struct RunTimeType *RunTime)
+/* Get parameters from user */
+{
+ printf("METAFONT file name? ");
+ if (ferror(stdout)) exit(1);
+ if (gets(RunTime->FileName)==NULL) exit(1);
+ if (strlen(RunTime->FileName)>FileNameDOS) {
+ /* File name too long */
+ printf("\7File name too long: %s...",RunTime->FileName);
+ exit(1);
+ }
+ printf("\n");
+ if (ferror(stdout)) exit(1);
+ SimpleQuery("Fixed or proportional font width","Fixed","Proportional",
+ &RunTime->FixedX);
+ SimpleQuery("Fixed or proportional font height","Fixed","Proportional",
+ &RunTime->FixedY);
+ SimpleQuery("Standard or dictionary font","Standard","Dictionary",
+ &RunTime->Standard);
+ /* Batch mode intrinsically isn't manual */
+ RunTime->Batch=False;
+}
+
+void FindBefore(FileNameType FileName)
+/* No check for before kanjiaa */
+{
+ if (FileName[6]=='a') {
+ FileName[6]='h';
+ FileName[5]--;
+ }
+ else
+ FileName[6]--;
+}
+
+void FindAfter(FileNameType FileName)
+/* No check for above kanjihe */
+{
+ if (FileName[6]=='h') {
+ FileName[6]='a';
+ FileName[5]++;
+ }
+ else
+ FileName[6]++;
+}
+
+void ScanMF(FileNameType FileName)
+/* Scans backwards for the last JemTeX font generated */
+/* Looks first for a .TFM and then for an .MF */
+/* If no more fonts to generate, stops with error level 2 */
+{
+ FILE *TestFile;
+ TotalNameType TotalName;
+ int Found;
+
+ strcpy(FileName,"kanjihf");
+ do {
+ FindBefore(FileName);
+ strcpy(TotalName,FileName);
+ strcat(TotalName,".tfm");
+ TestFile=fopen(TotalName,"r");
+ Found=(TestFile!=NULL);
+ if (!Found) {
+ strcpy(TotalName,FileName);
+ strcat(TotalName,".mf");
+ TestFile=fopen(TotalName,"r");
+ Found=(TestFile!=NULL);
+ }
+ } while (!Found && strcmp(FileName,"kanjiaa"));
+ if (Found) {
+ if (fclose(TestFile)==EOF) exit(1);
+ if (strcmp(FileName,"kanjihe")) FindAfter(FileName);
+ else {
+ printf("\7All JemTeX fonts generated!\n");
+ exit(2);
+ }
+ }
+}
+
+void Automate(struct RunTimeType *RunTime, int argc, char *argv[])
+/* Get parameters from command line */
+/* Finds the next font to be generated if in batch mode */
+{
+ int ParamIndex,ParamLength,Index;
+ ParamType Param;
+
+ /* Defaults */
+ strcpy(RunTime->FileName,"kanjiaa");
+ RunTime->FixedX=False;
+ RunTime->FixedY=False;
+ RunTime->Standard=True;
+ RunTime->Batch=False;
+ /* Scan command line parameters */
+ /* 0th is program's name, last is NULL */
+ for (ParamIndex=1 ; ParamIndex<argc ; ParamIndex++) {
+ ParamLength=strlen(argv[ParamIndex]);
+ if (ParamLength>ParamMax) {
+ /* Keyword too long */
+ printf("\7Invalid command line parameter: %s...",argv[ParamIndex]);
+ exit(1);
+ }
+ strcpy(Param,argv[ParamIndex]);
+ if ((Param[0]==Flag1) || (Param[0]==Flag2)) {
+ /* Not a font name */
+ /* Delete 1 char at the 1st position */
+ Delete(Param,1);
+ /* Convert to upper case */
+ for (Index=0 ; Index<ParamLength ; Index++)
+ Param[Index]=toupper(Param[Index]);
+ /* Scan known keywords */
+ if ((!strcmp(Param,FixedX1)) || (!strcmp(Param,FixedX2)) ||
+ (!strcmp(Param,FixedX3)) || (!strcmp(Param,FixedX4)))
+ RunTime->FixedX=True;
+ else
+ if ((!strcmp(Param,NoFixedX1)) || (!strcmp(Param,NoFixedX2)) ||
+ (!strcmp(Param,NoFixedX3)) || (!strcmp(Param,NoFixedX4)))
+ RunTime->FixedX=False;
+ else
+ if ((!strcmp(Param,FixedY1)) || (!strcmp(Param,FixedY2)) ||
+ (!strcmp(Param,FixedY3)) || (!strcmp(Param,FixedY4)))
+ RunTime->FixedY=True;
+ else
+ if ((!strcmp(Param,NoFixedY1)) || (!strcmp(Param,NoFixedY2)) ||
+ (!strcmp(Param,NoFixedY3)) || (!strcmp(Param,NoFixedY4)))
+ RunTime->FixedY=False;
+ else
+ if (!strcmp(Param,Standard1))
+ RunTime->Standard=True;
+ else
+ if (!strcmp(Param,NoStandard1))
+ RunTime->Standard=False;
+ else
+ if (!strcmp(Param,Batch1))
+ RunTime->Batch=True;
+ else {
+ /* Unknown keyword */
+ printf("\7Invalid command line parameter: %s...\n",Param);
+ exit(1);
+ }
+ }
+ else {
+ /* Must be a font name */
+ if (ParamLength>FileNameDOS) {
+ /* File name too long */
+ printf("\7File name too long: %s...\n",Param);
+ exit(1);
+ }
+ strcpy(RunTime->FileName,Param);
+ }
+ }
+ if (RunTime->Batch) ScanMF(RunTime->FileName);
+}
+
+void GetParameters(struct RunTimeType *RunTime, int argc, char *argv[])
+/* Get parameters from user or command line */
+{
+ /* 0th is program's name, last is NULL */
+ if (argc==1) Manual(RunTime);
+ else Automate(RunTime,argc,argv);
+ GetMode(RunTime);
+ EchoParameters(RunTime);
+ printf("\n");
+ if (ferror(stdout)) exit(1);
+}
+
+/*---------------------------------- Output ---------------------------------*/
+
+void BeginOut(FILE *OutFile, struct RunTimeType *RunTime)
+/* Writes initial METAFONT header */
+/* Co-author is Mr. Masatoshi Watanabe */
+{
+ fprintf(OutFile,"%%JIS2MF Version 2.00 of 14 April 1991.\n");
+ fprintf(OutFile,"\n");
+ fprintf(OutFile,"%% Font=%s\n",RunTime->FileName);
+ if (RunTime->FixedX) fprintf(OutFile,"%% Fixed Width\n");
+ else fprintf(OutFile,"%% Proportional Width\n");
+ if (RunTime->FixedY) fprintf(OutFile,"%% Fixed Height\n");
+ else fprintf(OutFile,"%% Proportional Height\n");
+ if (RunTime->Standard) fprintf(OutFile,"%% Standard Positioning\n");
+ else fprintf(OutFile,"%% Dictionary Positioning\n");
+ fprintf(OutFile,"\n");
+ fprintf(OutFile,"tracingstats:=1;\n");
+ fprintf(OutFile,"screen_cols:=640; %%VGA\n");
+ fprintf(OutFile,"screen_rows:=480; %%VGA\n");
+ fprintf(OutFile,"font_size 10pt#;\n");
+ if (RunTime->Standard) {
+ fprintf(OutFile,"u#:=12.7/36pt#;\n");
+ fprintf(OutFile,"body_height#:=23.25u#;\n");
+ fprintf(OutFile,"desc_depth#:=4.75u#;\n");
+ }
+ else {
+ fprintf(OutFile,"u#:=13/36pt#;\n");
+ fprintf(OutFile,"body_height#:=21u#;\n");
+ fprintf(OutFile,"desc_depth#:=7u#;\n");
+ }
+ fprintf(OutFile,"\n");
+ fprintf(OutFile,"letter_fit#:=0pt#;\n");
+ fprintf(OutFile,"asc_height#:=0pt#;\n");
+ fprintf(OutFile,"cap_height#:=0pt#;\n");
+ fprintf(OutFile,"fig_height#:=0pt#;\n");
+ fprintf(OutFile,"x_height#:=0pt#;\n");
+ fprintf(OutFile,"math_axis#:=0pt#;\n");
+ fprintf(OutFile,"bar_height#:=0pt#;\n");
+ fprintf(OutFile,"comma_depth#:=0pt#;\n");
+ fprintf(OutFile,"crisp#:=0pt#;\n");
+ fprintf(OutFile,"tiny#:=0pt#;\n");
+ fprintf(OutFile,"fine#:=0pt#;\n");
+ fprintf(OutFile,"thin_join#:=0pt#;\n");
+ fprintf(OutFile,"hair#:=1pt#;\n");
+ fprintf(OutFile,"stem#:=1pt#;\n");
+ fprintf(OutFile,"curve#:=1pt#;\n");
+ fprintf(OutFile,"flare#:=1pt#;\n");
+ fprintf(OutFile,"dot_size#:=0pt#;\n");
+ fprintf(OutFile,"cap_hair#:=1pt#;\n");
+ fprintf(OutFile,"cap_stem#:=1pt#;\n");
+ fprintf(OutFile,"cap_curve#:=1pt#;\n");
+ fprintf(OutFile,"rule_thickness#:=0pt#;\n");
+ fprintf(OutFile,"vair#:=0pt#;\n");
+ fprintf(OutFile,"notch_cut#:=0pt#;\n");
+ fprintf(OutFile,"bar#:=1pt#;\n");
+ fprintf(OutFile,"slab#:=1pt#;\n");
+ fprintf(OutFile,"cap_bar#:=1pt#;\n");
+ fprintf(OutFile,"cap_band#:=1pt#;\n");
+ fprintf(OutFile,"cap_notch_cut#:=0pt#;\n");
+ fprintf(OutFile,"serif_drop#:=0pt#;\n");
+ fprintf(OutFile,"stem_corr#:=0pt#;\n");
+ fprintf(OutFile,"vair_corr#:=0pt#;\n");
+ fprintf(OutFile,"o#:=0pt#;\n");
+ fprintf(OutFile,"apex_o#:=0pt#;\n");
+ fprintf(OutFile,"hefty:=true;\n");
+ fprintf(OutFile,"serifs:=true;\n");
+ fprintf(OutFile,"monospace:=false;\n");
+ fprintf(OutFile,"math_fitting:=false;\n");
+ fprintf(OutFile,"\n");
+ fprintf(OutFile,"mode_setup;\n");
+ fprintf(OutFile,"font_setup;\n");
+ fprintf(OutFile,"\n");
+ fprintf(OutFile,"pair z;\n");
+ fprintf(OutFile,"\n");
+ fprintf(OutFile,"def s(expr col,row)= %%square\n");
+ fprintf(OutFile," z:=((col*u),(row*u));\n");
+ fprintf(OutFile," fill unitsquare scaled u shifted z;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def sul(expr col,row)= %%upper left square\n");
+ fprintf(OutFile," z:=((col*u),(row*u)+.5u);\n");
+ fprintf(OutFile," fill unitsquare scaled .5u shifted z;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def sur(expr col,row)= %%upper right square\n");
+ fprintf(OutFile," z:=((col*u)+.5u,(row*u)+.5u);\n");
+ fprintf(OutFile," fill unitsquare scaled .5u shifted z;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def sbr(expr col,row)= %%bottom right square\n");
+ fprintf(OutFile," z:=((col*u)+.5u,(row*u));\n");
+ fprintf(OutFile," fill unitsquare scaled .5u shifted z;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def sbl(expr col,row)= %%bottom left square\n");
+ fprintf(OutFile," z:=((col*u),(row*u));\n");
+ fprintf(OutFile," fill unitsquare scaled .5u shifted z;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"\n");
+ fprintf(OutFile,"def c(expr col,row)= %%circle\n");
+ fprintf(OutFile," z:=((col*u)+.5u,(row*u)+.5u);\n");
+ fprintf(OutFile," fill fullcircle scaled u shifted z;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def cul(expr col,row)= %%upper left circle\n");
+ fprintf(OutFile," z:=((col*u)+.5u,(row*u)+.5u);\n");
+ fprintf(OutFile," fill z--quartercircle rotated 90 scaled u shifted z--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def cur(expr col,row)= %%upper right circle\n");
+ fprintf(OutFile," z:=((col*u)+.5u,(row*u)+.5u);\n");
+ fprintf(OutFile," fill z--quartercircle scaled u shifted z--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def cbr(expr col,row)= %%bottom right circle\n");
+ fprintf(OutFile," z:=((col*u)+.5u,(row*u)+.5u);\n");
+ fprintf(OutFile," fill z--quartercircle rotated 270 scaled u shifted z--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def cbl(expr col,row)= %%bottom left circle\n");
+ fprintf(OutFile," z:=((col*u)+.5u,(row*u)+.5u);\n");
+ fprintf(OutFile," fill z--quartercircle rotated 180 scaled u shifted z--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"\n");
+ fprintf(OutFile,"def tul(expr col,row)= %%upper left triangle\n");
+ fprintf(OutFile," z:=((col*u)+.5u,(row*u)+.5u);\n");
+ fprintf(OutFile," fill z--z+(0,.5u)--z-(.5u,0)--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def tur(expr col,row)= %%upper right triangle\n");
+ fprintf(OutFile," z:=((col*u)+.5u,(row*u)+.5u);\n");
+ fprintf(OutFile," fill z--z+(0,.5u)--z+(.5u,0)--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def tbr(expr col,row)= %%bottom right triangle\n");
+ fprintf(OutFile," z:=((col*u)+.5u,(row*u)+.5u);\n");
+ fprintf(OutFile," fill z--z-(0,.5u)--z+(.5u,0)--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def tbl(expr col,row)= %%bottom left triangle\n");
+ fprintf(OutFile," z:=((col*u)+.5u,(row*u)+.5u);\n");
+ fprintf(OutFile," fill z--z-(0,.5u)--z-(.5u,0)--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"\n");
+ fprintf(OutFile,"def rul(expr col,row)= %%upper left reverse triangle\n");
+ fprintf(OutFile," z:=((col*u),(row*u)+u);\n");
+ fprintf(OutFile," fill z--z-(0,.5u)--z+(.5u,0)--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def rur(expr col,row)= %%upper right reverse triangle\n");
+ fprintf(OutFile," z:=((col*u)+u,(row*u)+u);\n");
+ fprintf(OutFile," fill z--z-(0,.5u)--z-(.5u,0)--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def rbr(expr col,row)= %%bottom right reverse triangle\n");
+ fprintf(OutFile," z:=((col*u)+u,(row*u));\n");
+ fprintf(OutFile," fill z--z+(0,.5u)--z-(.5u,0)--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def rbl(expr col,row)= %%bottom left reverse triangle\n");
+ fprintf(OutFile," z:=((col*u),(row*u));\n");
+ fprintf(OutFile," fill z--z+(0,.5u)--z+(.5u,0)--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"\n");
+ fprintf(OutFile,"def tuul(expr col,row)= %%upper left long triangle\n");
+ fprintf(OutFile," z:=((col*u)+u,(row*u)+.5u);\n");
+ fprintf(OutFile," fill z--z+(0,.5u)--z-(u,0)--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def tull(expr col,row)= %%upper left long triangle\n");
+ fprintf(OutFile," z:=((col*u)+.5u,(row*u));\n");
+ fprintf(OutFile," fill z--z+(0,u)--z-(.5u,0)--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def tuur(expr col,row)= %%upper right long triangle\n");
+ fprintf(OutFile," z:=((col*u),(row*u)+.5u);\n");
+ fprintf(OutFile," fill z--z+(0,.5u)--z+(u,0)--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def turr(expr col,row)= %%upper right long triangle\n");
+ fprintf(OutFile," z:=((col*u)+.5u,(row*u));\n");
+ fprintf(OutFile," fill z--z+(0,u)--z+(.5u,0)--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def tbbr(expr col,row)= %%bottom right long triangle\n");
+ fprintf(OutFile," z:=((col*u),(row*u)+.5u);\n");
+ fprintf(OutFile," fill z--z-(0,.5u)--z+(u,0)--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def tbrr(expr col,row)= %%bottom right long triangle\n");
+ fprintf(OutFile," z:=((col*u)+.5u,(row*u)+u);\n");
+ fprintf(OutFile," fill z--z-(0,u)--z+(.5u,0)--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def tbbl(expr col,row)= %%bottom left long triangle\n");
+ fprintf(OutFile," z:=((col*u)+u,(row*u)+.5u);\n");
+ fprintf(OutFile," fill z--z-(0,.5u)--z-(u,0)--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def tbll(expr col,row)= %%bottom left long triangle\n");
+ fprintf(OutFile," z:=((col*u)+.5u,(row*u)+u);\n");
+ fprintf(OutFile," fill z--z-(0,u)--z-(.5u,0)--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"\n");
+ fprintf(OutFile,"def ruul(expr col,row)= %%upper left reverse long triangle\n");
+ fprintf(OutFile," z:=((col*u),(row*u)+u);\n");
+ fprintf(OutFile," fill z--z-(0,u)--z+(.5u,0)--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def rull(expr col,row)= %%upper left reverse long triangle\n");
+ fprintf(OutFile," z:=((col*u),(row*u)+u);\n");
+ fprintf(OutFile," fill z--z-(0,.5u)--z+(u,0)--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def ruur(expr col,row)= %%upper right reverse long triangle\n");
+ fprintf(OutFile," z:=((col*u)+u,(row*u)+u);\n");
+ fprintf(OutFile," fill z--z-(0,u)--z-(.5u,0)--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def rurr(expr col,row)= %%upper right reverse long triangle\n");
+ fprintf(OutFile," z:=((col*u)+u,(row*u)+u);\n");
+ fprintf(OutFile," fill z--z-(0,.5u)--z-(u,0)--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def rbbr(expr col,row)= %%bottom right reverse long triangle\n");
+ fprintf(OutFile," z:=((col*u)+u,(row*u));\n");
+ fprintf(OutFile," fill z--z+(0,u)--z-(.5u,0)--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def rbrr(expr col,row)= %%bottom right reverse long triangle\n");
+ fprintf(OutFile," z:=((col*u)+u,(row*u));\n");
+ fprintf(OutFile," fill z--z+(0,.5u)--z-(u,0)--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def rbbl(expr col,row)= %%bottom left reverse long triangle\n");
+ fprintf(OutFile," z:=((col*u),(row*u));\n");
+ fprintf(OutFile," fill z--z+(0,u)--z+(.5u,0)--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"def rbll(expr col,row)= %%bottom left reverse long triangle\n");
+ fprintf(OutFile," z:=((col*u),(row*u));\n");
+ fprintf(OutFile," fill z--z+(0,.5u)--z+(u,0)--cycle;\n");
+ fprintf(OutFile,"enddef;\n");
+ fprintf(OutFile,"\n");
+ if (ferror(OutFile)) exit(1);
+}
+
+void ActiveBitmap(FILE *OutFile, BitmapType Bitmap, int X, int Y, int XX,
+ float YY)
+/* Writes METAFONT code for an active cell */
+/* Co-author is Mr. Masatoshi Watanabe */
+{
+ int SquareUR,SquareUL,SquareBR,SquareBL;
+ int CircleUR,CircleUL,CircleBR,CircleBL;
+ int LTryUUR,LTryURR,LTryUUL,LTryULL;
+ int LTryBBR,LTryBRR,LTryBBL,LTryBLL;
+
+ SquareUL=(Bitmap[X-1][Y] || Bitmap[X-1][Y+1] || Bitmap[X][Y+1]);
+ SquareUR=(Bitmap[X+1][Y] || Bitmap[X+1][Y+1] || Bitmap[X][Y+1]);
+ SquareBL=(Bitmap[X-1][Y] || Bitmap[X-1][Y-1] || Bitmap[X][Y-1]);
+ SquareBR=(Bitmap[X+1][Y] || Bitmap[X+1][Y-1] || Bitmap[X][Y-1]);
+ CircleUL=(!Bitmap[X-1][Y-1] && !Bitmap[X-1][Y] && !Bitmap[X-1][Y+1] &&
+ !Bitmap[X][Y+1] && !Bitmap[X+1][Y+1]);
+ CircleUR=(!Bitmap[X+1][Y-1] && !Bitmap[X+1][Y] && !Bitmap[X+1][Y+1] &&
+ !Bitmap[X][Y+1] && !Bitmap[X-1][Y+1]);
+ CircleBL=(!Bitmap[X-1][Y+1] && !Bitmap[X-1][Y] && !Bitmap[X-1][Y-1] &&
+ !Bitmap[X][Y-1] && !Bitmap[X+1][Y-1]);
+ CircleBR=(!Bitmap[X+1][Y+1] && !Bitmap[X+1][Y] && !Bitmap[X+1][Y-1] &&
+ !Bitmap[X][Y-1] && !Bitmap[X-1][Y-1]);
+ LTryUUL=(Bitmap[X-1][Y-1] && !Bitmap[X-1][Y] && !Bitmap[X-1][Y+1] &&
+ !Bitmap[X][Y+1] && !Bitmap[X+1][Y+1] && Bitmap[X+1][Y]);
+ LTryUUR=(Bitmap[X+1][Y-1] && !Bitmap[X+1][Y] && !Bitmap[X+1][Y+1] &&
+ !Bitmap[X][Y+1] && !Bitmap[X-1][Y+1] && Bitmap[X-1][Y]);
+ LTryBBL=(Bitmap[X-1][Y+1] && !Bitmap[X-1][Y] && !Bitmap[X-1][Y-1] &&
+ !Bitmap[X][Y-1] && !Bitmap[X+1][Y-1] && Bitmap[X+1][Y]);
+ LTryBBR=(Bitmap[X+1][Y+1] && !Bitmap[X+1][Y] && !Bitmap[X+1][Y-1] &&
+ !Bitmap[X][Y-1] && !Bitmap[X-1][Y-1] && Bitmap[X-1][Y]);
+ LTryULL=(!Bitmap[X-1][Y-1] && !Bitmap[X-1][Y] && !Bitmap[X-1][Y+1] &&
+ !Bitmap[X][Y+1] && Bitmap[X+1][Y+1] && Bitmap[X][Y-1]);
+ LTryURR=(!Bitmap[X+1][Y-1] && !Bitmap[X+1][Y] && !Bitmap[X+1][Y+1] &&
+ !Bitmap[X][Y+1] && Bitmap[X-1][Y+1] && Bitmap[X][Y-1]);
+ LTryBLL=(!Bitmap[X-1][Y+1] && !Bitmap[X-1][Y] && !Bitmap[X-1][Y-1] &&
+ !Bitmap[X][Y-1] && Bitmap[X+1][Y-1] && Bitmap[X][Y+1]);
+ LTryBRR=(!Bitmap[X+1][Y+1] && !Bitmap[X+1][Y] && !Bitmap[X+1][Y-1] &&
+ !Bitmap[X][Y-1] && Bitmap[X-1][Y-1] && Bitmap[X][Y+1]);
+ if (LTryUUL) fprintf(OutFile,"tuul(%d,%4.2f);",XX,YY);
+ if (LTryULL) fprintf(OutFile,"tull(%d,%4.2f);",XX,YY);
+ if (LTryUUR) fprintf(OutFile,"tuur(%d,%4.2f);",XX,YY);
+ if (LTryURR) fprintf(OutFile,"turr(%d,%4.2f);",XX,YY);
+ if (LTryBBL) fprintf(OutFile,"tbbl(%d,%4.2f);",XX,YY);
+ if (LTryBLL) fprintf(OutFile,"tbll(%d,%4.2f);",XX,YY);
+ if (LTryBBR) fprintf(OutFile,"tbbr(%d,%4.2f);",XX,YY);
+ if (LTryBRR) fprintf(OutFile,"tbrr(%d,%4.2f);",XX,YY);
+ if (SquareUL && SquareUR && SquareBL && SquareBR)
+ fprintf(OutFile,"s(%d,%4.2f);",XX,YY);
+ else
+ if (CircleUL && CircleUR && CircleBL && CircleBR)
+ fprintf(OutFile,"c(%d,%4.2f);",XX,YY);
+ else {
+ if (!LTryUUL && !LTryULL && !LTryUUR && !LTryBLL)
+ if (SquareUL) fprintf(OutFile,"sul(%d,%4.2f);",XX,YY);
+ else
+ if (CircleUL) fprintf(OutFile,"cul(%d,%4.2f);",XX,YY);
+ else fprintf(OutFile,"tul(%d,%4.2f);",XX,YY);
+ if (!LTryUUL && !LTryURR && !LTryUUR && !LTryBRR)
+ if (SquareUR) fprintf(OutFile,"sur(%d,%4.2f);",XX,YY);
+ else
+ if (CircleUR) fprintf(OutFile,"cur(%d,%4.2f);",XX,YY);
+ else fprintf(OutFile,"tur(%d,%4.2f);",XX,YY);
+ if (!LTryBBL && !LTryULL && !LTryBBR && !LTryBLL)
+ if (SquareBL) fprintf(OutFile,"sbl(%d,%4.2f);",XX,YY);
+ else
+ if (CircleBL) fprintf(OutFile,"cbl(%d,%4.2f);",XX,YY);
+ else fprintf(OutFile,"tbl(%d,%4.2f);",XX,YY);
+ if (!LTryBBL && !LTryURR && !LTryBBR && !LTryBRR)
+ if (SquareBR) fprintf(OutFile,"sbr(%d,%4.2f);",XX,YY);
+ else
+ if (CircleBR) fprintf(OutFile,"cbr(%d,%4.2f);",XX,YY);
+ else fprintf(OutFile,"tbr(%d,%4.2f);",XX,YY);
+ }
+ if (ferror(OutFile)) exit(1);
+}
+
+void InactiveBitmap(FILE *OutFile, BitmapType Bitmap, int X, int Y, int XX,
+ float YY, int *Active)
+/* Writes METAFONT code for an inactive cell */
+/* Co-author is Mr. Masatoshi Watanabe */
+{
+ if (Bitmap[X-1][Y] && Bitmap[X][Y+1])
+ if (Bitmap[X-1][Y-1] && !Bitmap[X+1][Y+1])
+ { *Active=True; fprintf(OutFile,"ruul(%d,%4.2f);",XX,YY); }
+ else
+ if (Bitmap[X+1][Y+1] && !Bitmap[X-1][Y-1])
+ { *Active=True; fprintf(OutFile,"rull(%d,%4.2f);",XX,YY); }
+ else
+ { *Active=True; fprintf(OutFile,"rul(%d,%4.2f);",XX,YY); }
+ if (Bitmap[X+1][Y] && Bitmap[X][Y+1])
+ if (Bitmap[X+1][Y-1] && !Bitmap[X-1][Y+1])
+ { *Active=True; fprintf(OutFile,"ruur(%d,%4.2f);",XX,YY); }
+ else
+ if (Bitmap[X-1][Y+1] && !Bitmap[X+1][Y-1])
+ { *Active=True; fprintf(OutFile,"rurr(%d,%4.2f);",XX,YY); }
+ else
+ { *Active=True; fprintf(OutFile,"rur(%d,%4.2f);",XX,YY); }
+ if (Bitmap[X-1][Y] && Bitmap[X][Y-1])
+ if (Bitmap[X-1][Y+1] && !Bitmap[X+1][Y-1])
+ { *Active=True; fprintf(OutFile,"rbbl(%d,%4.2f);",XX,YY); }
+ else
+ if (Bitmap[X+1][Y-1] && !Bitmap[X-1][Y+1])
+ { *Active=True; fprintf(OutFile,"rbll(%d,%4.2f);",XX,YY); }
+ else
+ { *Active=True; fprintf(OutFile,"rbl(%d,%4.2f);",XX,YY); }
+ if (Bitmap[X+1][Y] && Bitmap[X][Y-1])
+ if (Bitmap[X+1][Y+1] && !Bitmap[X-1][Y-1])
+ { *Active=True; fprintf(OutFile,"rbbr(%d,%4.2f);",XX,YY); }
+ else
+ if (Bitmap[X-1][Y-1] && !Bitmap[X+1][Y+1])
+ { *Active=True; fprintf(OutFile,"rbrr(%d,%4.2f);",XX,YY); }
+ else
+ { *Active=True; fprintf(OutFile,"rbr(%d,%4.2f);",XX,YY); }
+ if (ferror(OutFile)) exit(1);
+}
+
+void MiddleOut(FILE *OutFile, struct BitmapsType *Bitmaps, int Number,
+ int Standard)
+/* Writes METAFONT code for a given Bitmap */
+{
+ int X,Y;
+ int Active;
+
+ fprintf(OutFile,"beginchar(%d,%du#,",Number,Bitmaps->XMax-Bitmaps->XMin+1);
+ if (Standard) {
+ if (Bitmaps->YMax>0.75) fprintf(OutFile,"%4.2fu#,",Bitmaps->YMax-0.75);
+ else fprintf(OutFile,"0,");
+ if (5.75>Bitmaps->YMin) fprintf(OutFile,"%4.2fu#);\n",5.75-Bitmaps->YMin);
+ else fprintf(OutFile,"0);\n");
+ }
+ else {
+ if (Bitmaps->YMax>3) fprintf(OutFile,"%du#,",Bitmaps->YMax-3);
+ else fprintf(OutFile,"0,");
+ if (8>Bitmaps->YMin) fprintf(OutFile,"%du#);\n",8-Bitmaps->YMin);
+ else fprintf(OutFile,"0);\n");
+ }
+ fprintf(OutFile,"normal_adjust_fit(2u#,2u#);\n");
+ for (X=Bitmaps->XMin ; X<=Bitmaps->XMax ; X++)
+ for (Y=1 ; Y<=SizeMax ; Y++) {
+ Active=Bitmaps->Bitmap[X][Y];
+ if (Active)
+ /* Current pixel is on */
+ if (Standard)
+ ActiveBitmap(OutFile,Bitmaps->Bitmap,X,Y,X-Bitmaps->XMin,Y-3.75);
+ else
+ ActiveBitmap(OutFile,Bitmaps->Bitmap,X,Y,X-Bitmaps->XMin,Y-6);
+ else
+ /* Current pixel is off */
+ if (Standard)
+ InactiveBitmap(OutFile,Bitmaps->Bitmap,X,Y,X-Bitmaps->XMin,Y-3.75,
+ &Active);
+ else
+ InactiveBitmap(OutFile,Bitmaps->Bitmap,X,Y,X-Bitmaps->XMin,Y-6,
+ &Active);
+ /* Avoid METAFONT buffer overflow */
+ if (Active) fprintf(OutFile,"\n");
+ }
+ fprintf(OutFile,"endchar;\n");
+ fprintf(OutFile,"\n");
+ if (ferror(OutFile)) exit(1);
+}
+
+void EndOut(FILE *OutFile, struct RunTimeType *RunTime)
+/* Writes final METAFONT header */
+{
+ fprintf(OutFile,"font_identifier \"%s\";\n",RunTime->FileName);
+ if (RunTime->Standard)
+ fprintf(OutFile,"font_coding_scheme \"JemTeX Standard\";\n");
+ else
+ fprintf(OutFile,"font_coding_scheme \"JemTeX Dictionary\";\n");
+ fprintf(OutFile,"font_slant slant;\n");
+ fprintf(OutFile,"font_normal_space 8u#;\n");
+ fprintf(OutFile,"font_normal_stretch 4u#;\n");
+ fprintf(OutFile,"font_normal_shrink 3u#;\n");
+ fprintf(OutFile,"font_x_height 24u#; %%ex\n");
+ fprintf(OutFile,"font_quad 24u#; %%em\n");
+ fprintf(OutFile,"font_extra_space 0u#;\n");
+ fprintf(OutFile,"\n");
+ /* Must end with CR/LF because of a bug(?) in emTeX METAFONT */
+ fprintf(OutFile,"bye\n");
+ if (ferror(OutFile)) exit(1);
+}
+
+/*--------------------------------- Generate --------------------------------*/
+
+void FindWantedBitmap(int Automatic, int *First, int *WantedBitmap, int *Number)
+/* Finds number of the next desired Bitmap either automatically or manually */
+/* The characters 0 and 1 in the first font kanjiaa are both set to Bitmap 1 */
+{
+ int Valid;
+ AnswerType Answer;
+
+ if (Automatic)
+ /* Find automatically */
+ if (*First)
+ /* Early in font kanjiaa */
+ if (*WantedBitmap==-1) *WantedBitmap=1;
+ else {
+ *WantedBitmap=1;
+ *First=False;
+ }
+ else
+ if ( (*Number==128) || (*WantedBitmap==BitmapMax) ) *WantedBitmap=0;
+ else (*WantedBitmap)++;
+ else
+ /* Find manually */
+ do {
+ printf("Bitmap number? ");
+ if (ferror(stdout)) exit(1);
+ if (gets(Answer)==NULL) exit(1);
+ if (1!=sscanf(Answer,"%d",WantedBitmap)) exit(1);
+ Valid=( (0<=*WantedBitmap) && (*WantedBitmap<=BitmapMax) );
+ if (!Valid) {
+ printf("\7Bitmap %d out of range...\n",*WantedBitmap);
+ if (ferror(stdout)) exit(1);
+ }
+ } while (!Valid);
+ printf("Bitmap number %d.\n",*WantedBitmap);
+ if (ferror(stdout)) exit(1);
+}
+
+void ScanBitmap(FILE *InFile, BitmapType Bitmap, int *Empty)
+/* Reads the Bitmap in a logical grid */
+/* (0,0) is the lower left corner of the Bitmap */
+{
+ int Y;
+ BufferType Buffer;
+ struct ColumnType *Column;
+
+ /* Read the Bitmap */
+ if (fread(Buffer,(unsigned)RecSize,1U,InFile)!=1U) exit(1);
+ /* Find if the Bitmap is empty */
+ *Empty=True;
+ for (Y=1 ; Y<=SizeMax ; Y++) {
+ Column=&Buffer[Y-1];
+ if ( (Column->Data1!=(unsigned char)'\x00') ||
+ (Column->Data2!=(unsigned char)'\x00') ||
+ (Column->Data3!=(unsigned char)'\x00') ) {
+ *Empty=False;
+ break;
+ }
+ }
+ /* Update logical grid */
+ if (!*Empty)
+ for (Y=1 ; Y<=SizeMax ; Y++) {
+ Column=&Buffer[SizeMax-Y];
+ Bitmap[ 1][Y]=(int)(Column->Data1 & (unsigned char)'\x80');
+ Bitmap[ 2][Y]=(int)(Column->Data1 & (unsigned char)'\x40');
+ Bitmap[ 3][Y]=(int)(Column->Data1 & (unsigned char)'\x20');
+ Bitmap[ 4][Y]=(int)(Column->Data1 & (unsigned char)'\x10');
+ Bitmap[ 5][Y]=(int)(Column->Data1 & (unsigned char)'\x08');
+ Bitmap[ 6][Y]=(int)(Column->Data1 & (unsigned char)'\x04');
+ Bitmap[ 7][Y]=(int)(Column->Data1 & (unsigned char)'\x02');
+ Bitmap[ 8][Y]=(int)(Column->Data1 & (unsigned char)'\x01');
+ Bitmap[ 9][Y]=(int)(Column->Data2 & (unsigned char)'\x80');
+ Bitmap[10][Y]=(int)(Column->Data2 & (unsigned char)'\x40');
+ Bitmap[11][Y]=(int)(Column->Data2 & (unsigned char)'\x20');
+ Bitmap[12][Y]=(int)(Column->Data2 & (unsigned char)'\x10');
+ Bitmap[13][Y]=(int)(Column->Data2 & (unsigned char)'\x08');
+ Bitmap[14][Y]=(int)(Column->Data2 & (unsigned char)'\x04');
+ Bitmap[15][Y]=(int)(Column->Data2 & (unsigned char)'\x02');
+ Bitmap[16][Y]=(int)(Column->Data2 & (unsigned char)'\x01');
+ Bitmap[17][Y]=(int)(Column->Data3 & (unsigned char)'\x80');
+ Bitmap[18][Y]=(int)(Column->Data3 & (unsigned char)'\x40');
+ Bitmap[19][Y]=(int)(Column->Data3 & (unsigned char)'\x20');
+ Bitmap[20][Y]=(int)(Column->Data3 & (unsigned char)'\x10');
+ Bitmap[21][Y]=(int)(Column->Data3 & (unsigned char)'\x08');
+ Bitmap[22][Y]=(int)(Column->Data3 & (unsigned char)'\x04');
+ Bitmap[23][Y]=(int)(Column->Data3 & (unsigned char)'\x02');
+ Bitmap[24][Y]=(int)(Column->Data3 & (unsigned char)'\x01');
+ }
+}
+
+void ScanSides(struct BitmapsType *Bitmaps, int FixedX, int FixedY)
+/* Determines the minimal size of the Bitmap for proportional spacing */
+{
+ int X,Y;
+
+ if (FixedX) {
+ Bitmaps->XMin=1;
+ Bitmaps->XMax=SizeMax;
+ }
+ else {
+ Bitmaps->XMin=SizeMax1;
+ for (X=SizeMax ; X>=1 ; X--)
+ for (Y=1 ; Y<=SizeMax ; Y++)
+ if (Bitmaps->Bitmap[X][Y]) Bitmaps->XMin=X;
+ Bitmaps->XMax=0;
+ for (X=1 ; X<=SizeMax ; X++)
+ for (Y=1 ; Y<=SizeMax ; Y++)
+ if (Bitmaps->Bitmap[X][Y]) Bitmaps->XMax=X;
+ }
+ if (FixedY) {
+ Bitmaps->YMin=1;
+ Bitmaps->YMax=SizeMax;
+ }
+ else {
+ Bitmaps->YMin=SizeMax1;
+ for (Y=SizeMax ; Y>=1 ; Y--)
+ for (X=1 ; X<=SizeMax ; X++)
+ if (Bitmaps->Bitmap[X][Y]) Bitmaps->YMin=Y;
+ Bitmaps->YMax=0;
+ for (Y=1 ; Y<=SizeMax ; Y++)
+ for (X=1 ; X<=SizeMax ; X++)
+ if (Bitmaps->Bitmap[X][Y]) Bitmaps->YMax=Y;
+ }
+}
+
+void Generate(FILE *InFile, FILE *OutFile, int *Number,
+ struct RunTimeType *RunTime)
+/* Generates the METAFONT code for the selected font */
+{
+ /* Bitmap pointers */
+ int CurrentBitmap,WantedBitmap;
+ /* Current Bitmap and its dimensions */
+ struct BitmapsType Bitmaps;
+ int X,Y;
+ /* Indicates early in font kanjiaa */
+ int First;
+ /* Indicates current Bitmap is empty */
+ int Empty;
+
+ /* Clear the area outside the Bitmap once and for all */
+ for (X=0 ; X<=SizeMax1 ; X++) {
+ Bitmaps.Bitmap[X][0]=False; Bitmaps.Bitmap[X][SizeMax1]=False; }
+ for (Y=1 ; Y<=SizeMax ; Y++) {
+ Bitmaps.Bitmap[0][Y]=False; Bitmaps.Bitmap[SizeMax1][Y]=False; }
+ /* Number of the Bitmap ready to be read */
+ CurrentBitmap=1;
+ /* First METAFONT character number */
+ *Number=0;
+ /* First Bitmap wanted */
+ if (RunTime->Automatic) {
+ WantedBitmap=1024 * ( toupper(RunTime->FileName[5])-'A' ) +
+ 128 * ( toupper(RunTime->FileName[6])-'A' ) - 1;
+ First=(WantedBitmap==-1);
+ }
+ do {
+ FindWantedBitmap(RunTime->Automatic,&First,&WantedBitmap,Number);
+ if (WantedBitmap) {
+ /* Position pointer */
+ if (WantedBitmap!=CurrentBitmap) {
+ if ( fseek(InFile , ((WantedBitmap-1L)*RecSize) , 0) ) exit(1);
+ CurrentBitmap=WantedBitmap;
+ }
+ printf("Reading Bitmap");
+ if (ferror(stdout)) exit(1);
+ ScanBitmap(InFile,Bitmaps.Bitmap,&Empty);
+ CurrentBitmap++;
+ printf(".\n");
+ if (ferror(stdout)) exit(1);
+ /* Process Bitmap */
+ if (Empty) printf("Bitmap is empty, no METAFONT code %d.\n",*Number);
+ else {
+ printf("Writing METAFONT code %d",*Number);
+ ScanSides(&Bitmaps,RunTime->FixedX,RunTime->FixedY);
+ MiddleOut(OutFile,&Bitmaps,*Number,RunTime->Standard);
+ printf(".\n");
+ }
+ printf("\n");
+ if (ferror(stdout)) exit(1);
+ /* Ready to generate next METAFONT character */
+ (*Number)++;
+ }
+ } while (WantedBitmap);
+}
+
+/*----------------------------------- Main ----------------------------------*/
+
+main(int argc, char *argv[])
+{
+ /* JIS24 and METAFONT file names */
+ FILE *InFile;
+ FILE *OutFile;
+ TotalNameType TotalName;
+ /* Current METAFONT character number */
+ int Number;
+ /* Run time parameters */
+ struct RunTimeType RunTime;
+
+ printf("\n");
+ printf("Bitmaps to METAFONT Conversion Program.\n"); /*To make Borland happy*/
+ printf("Version 2.00 Copyright F. Jalbert 1991.\n");
+ printf("\n");
+ if (ferror(stdout)) exit(1);
+
+ printf("Opening Bitmap file JIS24");
+ InFile=fopen("jis24","rb");
+ if (InFile==NULL) exit(1);
+ printf(".\n");
+ printf("\n");
+ if (ferror(stdout)) exit(1);
+
+ GetParameters(&RunTime,argc,argv);
+ strcpy(TotalName,RunTime.FileName);
+ strcat(TotalName,".mf");
+ printf("Creating METAFONT file %s",TotalName);
+ OutFile=fopen(TotalName,"wt");
+ if (OutFile==NULL) exit(1);
+ printf(".\n");
+ printf("\n");
+ if (ferror(stdout)) exit(1);
+
+ printf("Writing initial METAFONT header");
+ #ifndef __TURBOC__
+ printf("\n");
+ #endif
+ BeginOut(OutFile,&RunTime);
+ printf(".\n");
+ printf("\n");
+ Generate(InFile,OutFile,&Number,&RunTime);
+ printf("\n");
+ if (ferror(stdout)) exit(1);
+
+ printf("Writing final METAFONT header");
+ #ifndef __TURBOC__
+ printf("\n");
+ #endif
+ EndOut(OutFile,&RunTime);
+ printf(".\n");
+ printf("Closing METAFONT file %s",TotalName);
+ if (fclose(OutFile)==EOF) exit(1);
+ printf(".\n");
+ printf("Closing Bitmap file JIS24");
+ if (fclose(InFile)==EOF) exit(1);
+ printf(".\n");
+ printf("\n");
+ if (ferror(stdout)) exit(1);
+
+ printf("METAFONT code for %d Bitmap(s) generated.\n",Number);
+ printf("\n");
+ if (ferror(stdout)) exit(1);
+
+ return(0);
+}
diff --git a/systems/msdos/jemtex2/jis2mf.pas b/systems/msdos/jemtex2/jis2mf.pas
new file mode 100644
index 0000000000..ee944f7913
--- /dev/null
+++ b/systems/msdos/jemtex2/jis2mf.pas
@@ -0,0 +1,939 @@
+{$A-,B-,D-,E-,F-,I+,L-,N-,O-,R-,S-,V-}
+{Compile with Turbo-Pascal 5.0}
+Program JIS2MF(Input,Output);
+{
+ This program generates METAFONT code from a Bitmaps file JIS24
+
+ Author: Francois Jalbert
+ '
+ Date: November 1990
+
+ Version: 1.0
+
+ Date: April 1991
+
+ Version: 2.00
+
+ Modifications: - Added four kanjis.
+ - Fixed incorrect VGA resolution.
+ - Command line parameter now supported.
+ - Added automatic mode.
+ - Added batch mode.
+ - Updated and improved run-time messages.
+ - Long triangles added by Mr. Masatoshi Watanabe. Fantastic!
+ - Fixed and proportional parameters added.
+ - Standard and dictionary parameters added.
+ - JIS24 now accessed through low-level I/O channel for speed.
+
+ Error Levels: 0 - Normal termination.
+ 1 - Error.
+ 2 - All fonts generated (batch).
+}
+Const
+ {Number of Bitmaps in JIS24}
+ BitmapMax=7806;
+ {Size of each square Bitmap}
+ SizeMax=24;
+ SizeMax1=25;
+ {DOS Record Size}
+ RecSize=72; {SizeMax*SizeMax/8}
+ {Parameter flag}
+ Flag1='/'; {DOS style}
+ Flag2='-'; {UNIX style}
+ {Parameter keywords}
+ FixedX1:String[10]='FIXEDWIDTH';
+ FixedX2:String[6]='FIXEDX';
+ FixedX3:String[19]='NOPROPORTIONALWIDTH';
+ FixedX4:String[15]='NOPROPORTIONALX';
+ NoFixedX1:String[12]='NOFIXEDWIDTH';
+ NoFixedX2:String[8]='NOFIXEDX';
+ NoFixedX3:String[17]='PROPORTIONALWIDTH';
+ NoFixedX4:String[13]='PROPORTIONALX';
+ FixedY1:String[11]='FIXEDHEIGHT';
+ FixedY2:String[6]='FIXEDY';
+ FixedY3:String[20]='NOPROPORTIONALHEIGHT';
+ FixedY4:String[15]='NOPROPORTIONALY';
+ NoFixedY1:String[13]='NOFIXEDHEIGHT';
+ NoFixedY2:String[8]='NOFIXEDY';
+ NoFixedY3:String[18]='PROPORTIONALHEIGHT';
+ NoFixedY4:String[13]='PROPORTIONALY';
+ Standard1:String[8]='STANDARD';
+ NoStandard1:String[10]='DICTIONARY';
+ Batch1:String[5]='BATCH';
+
+Type
+ InFileType=File; {Low-level I/O channel}
+ OutFileType=Text;
+ BitmapRange=1..BitmapMax;
+ Bitmap0Range=0..BitmapMax;
+ SizeRange=1..SizeMax;
+ Size0Range=0..SizeMax1;
+ {Buffer for the Bitmap Data}
+ ColumnType=Record Data1,Data2,Data3:Byte End;
+ BufferType=Array [SizeRange] Of ColumnType;
+ {The Bitmap array is defined larger to simplify the forthcoming code}
+ BitmapType=Array [Size0Range,Size0Range] Of Boolean;
+ BitmapsType=Record
+ Bitmap:BitmapType;
+ XMin,XMax,YMin,YMax:Size0Range
+ End;
+ {Run time parameters}
+ RunTimeType=Record
+ FileName:String;
+ {Batch mode}
+ Batch:Boolean;
+ {Automatic mode for JemTeX fonts only}
+ Automatic:Boolean;
+ {Fixed or proportional fonts}
+ FixedX,FixedY:Boolean;
+ {Standard or dictionary fonts}
+ Standard:Boolean
+ End;
+
+Var
+ {JIS24 and METAFONT file names}
+ InFile:InFileType;
+ OutFile:OutFileType;
+ {Current METAFONT character number}
+ Number:Integer;
+ {Run time parameters}
+ RunTime:RunTimeType;
+
+{-------------------------------- GetParameters ------------------------------}
+
+Procedure SimpleQuery(Title,ChoiceA,ChoiceB:String; Var Answer:Boolean);
+Var
+ JChar:Char;
+ Valid:Boolean;
+Begin
+Repeat
+ Valid:=True;
+ Writeln(Title+':');
+ Writeln(' a) '+ChoiceA);
+ Writeln(' b) '+ChoiceB);
+ Write('Your choice? ');
+ Readln(JChar);
+ JChar:=UpCase(JChar);
+ If JChar='A' Then Answer:=True
+ Else
+ If JChar='B' Then Answer:=False
+ Else
+ Begin Valid:=False; Write(Chr(7)) End
+Until Valid;
+Writeln
+End;
+
+Procedure GetMode(Var RunTime:RunTimeType);
+{Determines if the desired font is a JemTeX font}
+Begin
+With RunTime Do
+ Begin
+ Automatic:=False;
+ If UpCase(FileName[1])='K' Then
+ If UpCase(FileName[2])='A' Then
+ If UpCase(FileName[3])='N' Then
+ If UpCase(FileName[4])='J' Then
+ If UpCase(FileName[5])='I' Then
+ If ('A'<=UpCase(FileName[6])) And (UpCase(FileName[6])<='H') Then
+ If ('A'<=UpCase(FileName[7])) And (UpCase(FileName[7])<='H') Then
+ If Length(FileName)=7 Then
+ If UpCase(FileName[6])<='G' Then Automatic:=True
+ Else
+ If UpCase(FileName[7])<='E' Then Automatic:=True
+ End
+End;
+
+Procedure EchoParameters(Var RunTime:RunTimeType);
+{Echoes the current parameters}
+Begin
+With RunTime Do
+ Begin
+ Write('Font='+FileName);
+ If FixedX Then Write(' Fixed Width')
+ Else Write(' Prop. Width');
+ If FixedY Then Write(' Fixed Height')
+ Else Write(' Prop. Height');
+ If Standard Then Write(' Standard')
+ Else Write(' Dictionary');
+ If Automatic Then Write(' Automatic')
+ Else Write(' Manual');
+ If Batch Then Write(' Batch');
+ Writeln('.')
+ End
+End;
+
+Procedure Manual(Var RunTime:RunTimeType);
+{Get parameters from user}
+Begin
+With RunTime Do
+ Begin
+ Write('METAFONT file name? ');
+ Readln(FileName);
+ Writeln;
+ SimpleQuery('Fixed or proportional font width','Fixed','Proportional',FixedX);
+ SimpleQuery('Fixed or proportional font height','Fixed','Proportional',FixedY);
+ SimpleQuery('Standard or dictionary font','Standard','Dictionary',Standard);
+ {Batch mode intrinsically isn't manual}
+ Batch:=False
+ End
+End;
+
+Procedure FindBefore(Var FileName:String);
+{No check for before kanjiaa}
+Begin
+If FileName[7]='a' Then
+ Begin
+ FileName[7]:='h';
+ FileName[6]:=Pred(FileName[6])
+ End
+Else
+ FileName[7]:=Pred(FileName[7])
+End;
+
+Procedure FindAfter(Var FileName:String);
+{No check for above kanjihe}
+Begin
+If FileName[7]='h' Then
+ Begin
+ FileName[7]:='a';
+ FileName[6]:=Succ(FileName[6])
+ End
+Else
+ FileName[7]:=Succ(FileName[7])
+End;
+
+Procedure ScanMF(Var FileName:String);
+{Scans backwards for the last JemTeX font generated}
+{Looks first for a .TFM and then for an .MF}
+{If no more fonts to generate, stops with error level 2}
+Var
+ TestFile:Text;
+ Found:Boolean;
+Begin
+FileName:='kanjihf';
+Repeat
+ FindBefore(FileName);
+ Assign(TestFile,FileName+'.tfm');
+ {$I-}Reset(TestFile);{$I+}
+ {IOResult must be immediately used once only}
+ Found:=(IOResult=0);
+ If Not Found Then
+ Begin
+ Assign(TestFile,FileName+'.mf');
+ {$I-}Reset(TestFile);{$I+}
+ {IOResult must be immediately used once only}
+ Found:=(IOResult=0)
+ End;
+Until Found Or (FileName='kanjiaa');
+If Found Then
+ Begin
+ Close(TestFile);
+ If FileName='kanjihe' Then
+ Begin
+ Writeln(Chr(7)+'All JemTeX fonts generated!');
+ Halt(2)
+ End
+ Else FindAfter(FileName)
+ End
+End;
+
+Procedure Automate(Var RunTime:RunTimeType);
+{Get parameters from command line}
+{Finds the next font to be generated if in batch mode}
+Var
+ ParamIndex,Index:Integer;
+ Param:String;
+Begin
+With RunTime Do
+ Begin
+ {Defaults}
+ FileName:='kanjiaa';
+ FixedX:=False;
+ FixedY:=False;
+ Standard:=True;
+ Batch:=False;
+ {Scan command line parameters}
+ For ParamIndex:=1 To ParamCount Do
+ Begin
+ Param:=ParamStr(ParamIndex);
+ If (Param[1]=Flag1) Or (Param[1]=Flag2) Then
+ {Not a font name}
+ Begin
+ {Delete 1 char at the 1st position}
+ Delete(Param,1,1);
+ {Convert to upper case}
+ For Index:=1 To Length(Param) Do
+ Param[Index]:=UpCase(Param[Index]);
+ {Scan known keywords}
+ If (Param=FixedX1) Or (Param=FixedX2) Or (Param=FixedX3) Or
+ (Param=FixedX4) Then FixedX:=True
+ Else
+ If (Param=NoFixedX1) Or (Param=NoFixedX2) Or (Param=NoFixedX3) Or
+ (Param=NoFixedX4) Then FixedX:=False
+ Else
+ If (Param=FixedY1) Or (Param=FixedY2) Or (Param=FixedY3) Or
+ (Param=FixedY4) Then FixedY:=True
+ Else
+ If (Param=NoFixedY1) Or (Param=NoFixedY2) Or (Param=NoFixedY3) Or
+ (Param=NoFixedY4) Then FixedY:=False
+ Else
+ If Param=Standard1 Then Standard:=True
+ Else
+ If Param=NoStandard1 Then Standard:=False
+ Else
+ If Param=Batch1 Then Batch:=True
+ Else
+ {Unknown keyword}
+ Begin
+ Writeln(Chr(7)+'Invalid command line parameter: '+Param+'...');
+ Halt(1)
+ End
+ End
+ Else
+ {Must be a font name}
+ FileName:=Param
+ End;
+ If Batch Then ScanMF(FileName)
+ End
+End;
+
+Procedure GetParameters(Var RunTime:RunTimeType);
+{Get parameters from user or command line}
+Begin
+If ParamCount=0 Then Manual(RunTime)
+Else Automate(RunTime);
+GetMode(RunTime);
+EchoParameters(RunTime);
+Writeln
+End;
+
+{----------------------------------- Output ----------------------------------}
+
+Procedure BeginOut(Var OutFile:OutFileType; Var RunTime:RunTimeType);
+{Writes initial METAFONT header}
+{Co-author is Mr. Masatoshi Watanabe}
+Begin
+Writeln(OutFile,'%JIS2MF Version 2.00 of 14 April 1991.');
+Writeln(OutFile);
+Writeln(OutFile,'% Font='+RunTime.FileName);
+If RunTime.FixedX Then Writeln(OutFile,'% Fixed Width')
+Else Writeln(OutFile,'% Proportional Width');
+If RunTime.FixedY Then Writeln(OutFile,'% Fixed Height')
+Else Writeln(OutFile,'% Proportional Height');
+If RunTime.Standard Then Writeln(OutFile,'% Standard Positioning')
+Else Writeln(OutFile,'% Dictionary Positioning');
+Writeln(OutFile);
+Writeln(OutFile,'tracingstats:=1;');
+Writeln(OutFile,'screen_cols:=640; %VGA');
+Writeln(OutFile,'screen_rows:=480; %VGA');
+Writeln(OutFile,'font_size 10pt#;');
+If RunTime.Standard Then
+ Begin
+ Writeln(OutFile,'u#:=12.7/36pt#;');
+ Writeln(OutFile,'body_height#:=23.25u#;');
+ Writeln(OutFile,'desc_depth#:=4.75u#;')
+ End
+Else
+ Begin
+ Writeln(OutFile,'u#:=13/36pt#;');
+ Writeln(OutFile,'body_height#:=21u#;');
+ Writeln(OutFile,'desc_depth#:=7u#;')
+ End;
+Writeln(OutFile);
+Writeln(OutFile,'letter_fit#:=0pt#;');
+Writeln(OutFile,'asc_height#:=0pt#;');
+Writeln(OutFile,'cap_height#:=0pt#;');
+Writeln(OutFile,'fig_height#:=0pt#;');
+Writeln(OutFile,'x_height#:=0pt#;');
+Writeln(OutFile,'math_axis#:=0pt#;');
+Writeln(OutFile,'bar_height#:=0pt#;');
+Writeln(OutFile,'comma_depth#:=0pt#;');
+Writeln(OutFile,'crisp#:=0pt#;');
+Writeln(OutFile,'tiny#:=0pt#;');
+Writeln(OutFile,'fine#:=0pt#;');
+Writeln(OutFile,'thin_join#:=0pt#;');
+Writeln(OutFile,'hair#:=1pt#;');
+Writeln(OutFile,'stem#:=1pt#;');
+Writeln(OutFile,'curve#:=1pt#;');
+Writeln(OutFile,'flare#:=1pt#;');
+Writeln(OutFile,'dot_size#:=0pt#;');
+Writeln(OutFile,'cap_hair#:=1pt#;');
+Writeln(OutFile,'cap_stem#:=1pt#;');
+Writeln(OutFile,'cap_curve#:=1pt#;');
+Writeln(OutFile,'rule_thickness#:=0pt#;');
+Writeln(OutFile,'vair#:=0pt#;');
+Writeln(OutFile,'notch_cut#:=0pt#;');
+Writeln(OutFile,'bar#:=1pt#;');
+Writeln(OutFile,'slab#:=1pt#;');
+Writeln(OutFile,'cap_bar#:=1pt#;');
+Writeln(OutFile,'cap_band#:=1pt#;');
+Writeln(OutFile,'cap_notch_cut#:=0pt#;');
+Writeln(OutFile,'serif_drop#:=0pt#;');
+Writeln(OutFile,'stem_corr#:=0pt#;');
+Writeln(OutFile,'vair_corr#:=0pt#;');
+Writeln(OutFile,'o#:=0pt#;');
+Writeln(OutFile,'apex_o#:=0pt#;');
+Writeln(OutFile,'hefty:=true;');
+Writeln(OutFile,'serifs:=true;');
+Writeln(OutFile,'monospace:=false;');
+Writeln(OutFile,'math_fitting:=false;');
+Writeln(OutFile);
+Writeln(OutFile,'mode_setup;');
+Writeln(OutFile,'font_setup;');
+Writeln(OutFile);
+Writeln(OutFile,'pair z;');
+Writeln(OutFile);
+Writeln(OutFile,'def s(expr col,row)= %square');
+Writeln(OutFile,' z:=((col*u),(row*u));');
+Writeln(OutFile,' fill unitsquare scaled u shifted z;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def sul(expr col,row)= %upper left square');
+Writeln(OutFile,' z:=((col*u),(row*u)+.5u);');
+Writeln(OutFile,' fill unitsquare scaled .5u shifted z;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def sur(expr col,row)= %upper right square');
+Writeln(OutFile,' z:=((col*u)+.5u,(row*u)+.5u);');
+Writeln(OutFile,' fill unitsquare scaled .5u shifted z;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def sbr(expr col,row)= %bottom right square');
+Writeln(OutFile,' z:=((col*u)+.5u,(row*u));');
+Writeln(OutFile,' fill unitsquare scaled .5u shifted z;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def sbl(expr col,row)= %bottom left square');
+Writeln(OutFile,' z:=((col*u),(row*u));');
+Writeln(OutFile,' fill unitsquare scaled .5u shifted z;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile);
+Writeln(OutFile,'def c(expr col,row)= %circle');
+Writeln(OutFile,' z:=((col*u)+.5u,(row*u)+.5u);');
+Writeln(OutFile,' fill fullcircle scaled u shifted z;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def cul(expr col,row)= %upper left circle');
+Writeln(OutFile,' z:=((col*u)+.5u,(row*u)+.5u);');
+Writeln(OutFile,' fill z--quartercircle rotated 90 scaled u shifted z--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def cur(expr col,row)= %upper right circle');
+Writeln(OutFile,' z:=((col*u)+.5u,(row*u)+.5u);');
+Writeln(OutFile,' fill z--quartercircle scaled u shifted z--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def cbr(expr col,row)= %bottom right circle');
+Writeln(OutFile,' z:=((col*u)+.5u,(row*u)+.5u);');
+Writeln(OutFile,' fill z--quartercircle rotated 270 scaled u shifted z--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def cbl(expr col,row)= %bottom left circle');
+Writeln(OutFile,' z:=((col*u)+.5u,(row*u)+.5u);');
+Writeln(OutFile,' fill z--quartercircle rotated 180 scaled u shifted z--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile);
+Writeln(OutFile,'def tul(expr col,row)= %upper left triangle');
+Writeln(OutFile,' z:=((col*u)+.5u,(row*u)+.5u);');
+Writeln(OutFile,' fill z--z+(0,.5u)--z-(.5u,0)--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def tur(expr col,row)= %upper right triangle');
+Writeln(OutFile,' z:=((col*u)+.5u,(row*u)+.5u);');
+Writeln(OutFile,' fill z--z+(0,.5u)--z+(.5u,0)--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def tbr(expr col,row)= %bottom right triangle');
+Writeln(OutFile,' z:=((col*u)+.5u,(row*u)+.5u);');
+Writeln(OutFile,' fill z--z-(0,.5u)--z+(.5u,0)--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def tbl(expr col,row)= %bottom left triangle');
+Writeln(OutFile,' z:=((col*u)+.5u,(row*u)+.5u);');
+Writeln(OutFile,' fill z--z-(0,.5u)--z-(.5u,0)--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile);
+Writeln(OutFile,'def rul(expr col,row)= %upper left reverse triangle');
+Writeln(OutFile,' z:=((col*u),(row*u)+u);');
+Writeln(OutFile,' fill z--z-(0,.5u)--z+(.5u,0)--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def rur(expr col,row)= %upper right reverse triangle');
+Writeln(OutFile,' z:=((col*u)+u,(row*u)+u);');
+Writeln(OutFile,' fill z--z-(0,.5u)--z-(.5u,0)--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def rbr(expr col,row)= %bottom right reverse triangle');
+Writeln(OutFile,' z:=((col*u)+u,(row*u));');
+Writeln(OutFile,' fill z--z+(0,.5u)--z-(.5u,0)--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def rbl(expr col,row)= %bottom left reverse triangle');
+Writeln(OutFile,' z:=((col*u),(row*u));');
+Writeln(OutFile,' fill z--z+(0,.5u)--z+(.5u,0)--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile);
+Writeln(OutFile,'def tuul(expr col,row)= %upper left long triangle');
+Writeln(OutFile,' z:=((col*u)+u,(row*u)+.5u);');
+Writeln(OutFile,' fill z--z+(0,.5u)--z-(u,0)--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def tull(expr col,row)= %upper left long triangle');
+Writeln(OutFile,' z:=((col*u)+.5u,(row*u));');
+Writeln(OutFile,' fill z--z+(0,u)--z-(.5u,0)--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def tuur(expr col,row)= %upper right long triangle');
+Writeln(OutFile,' z:=((col*u),(row*u)+.5u);');
+Writeln(OutFile,' fill z--z+(0,.5u)--z+(u,0)--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def turr(expr col,row)= %upper right long triangle');
+Writeln(OutFile,' z:=((col*u)+.5u,(row*u));');
+Writeln(OutFile,' fill z--z+(0,u)--z+(.5u,0)--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def tbbr(expr col,row)= %bottom right long triangle');
+Writeln(OutFile,' z:=((col*u),(row*u)+.5u);');
+Writeln(OutFile,' fill z--z-(0,.5u)--z+(u,0)--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def tbrr(expr col,row)= %bottom right long triangle');
+Writeln(OutFile,' z:=((col*u)+.5u,(row*u)+u);');
+Writeln(OutFile,' fill z--z-(0,u)--z+(.5u,0)--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def tbbl(expr col,row)= %bottom left long triangle');
+Writeln(OutFile,' z:=((col*u)+u,(row*u)+.5u);');
+Writeln(OutFile,' fill z--z-(0,.5u)--z-(u,0)--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def tbll(expr col,row)= %bottom left long triangle');
+Writeln(OutFile,' z:=((col*u)+.5u,(row*u)+u);');
+Writeln(OutFile,' fill z--z-(0,u)--z-(.5u,0)--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile);
+Writeln(OutFile,'def ruul(expr col,row)= %upper left reverse long triangle');
+Writeln(OutFile,' z:=((col*u),(row*u)+u);');
+Writeln(OutFile,' fill z--z-(0,u)--z+(.5u,0)--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def rull(expr col,row)= %upper left reverse long triangle');
+Writeln(OutFile,' z:=((col*u),(row*u)+u);');
+Writeln(OutFile,' fill z--z-(0,.5u)--z+(u,0)--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def ruur(expr col,row)= %upper right reverse long triangle');
+Writeln(OutFile,' z:=((col*u)+u,(row*u)+u);');
+Writeln(OutFile,' fill z--z-(0,u)--z-(.5u,0)--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def rurr(expr col,row)= %upper right reverse long triangle');
+Writeln(OutFile,' z:=((col*u)+u,(row*u)+u);');
+Writeln(OutFile,' fill z--z-(0,.5u)--z-(u,0)--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def rbbr(expr col,row)= %bottom right reverse long triangle');
+Writeln(OutFile,' z:=((col*u)+u,(row*u));');
+Writeln(OutFile,' fill z--z+(0,u)--z-(.5u,0)--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def rbrr(expr col,row)= %bottom right reverse long triangle');
+Writeln(OutFile,' z:=((col*u)+u,(row*u));');
+Writeln(OutFile,' fill z--z+(0,.5u)--z-(u,0)--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def rbbl(expr col,row)= %bottom left reverse long triangle');
+Writeln(OutFile,' z:=((col*u),(row*u));');
+Writeln(OutFile,' fill z--z+(0,u)--z+(.5u,0)--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile,'def rbll(expr col,row)= %bottom left reverse long triangle');
+Writeln(OutFile,' z:=((col*u),(row*u));');
+Writeln(OutFile,' fill z--z+(0,.5u)--z+(u,0)--cycle;');
+Writeln(OutFile,'enddef;');
+Writeln(OutFile)
+End;
+
+Procedure ActiveBitmap(Var OutFile:OutFileType; Var Bitmap:BitmapType;
+ X,Y:SizeRange; XX:Integer; YY:Real);
+{Writes METAFONT code for an active cell}
+{Co-author is Mr. Masatoshi Watanabe}
+Var
+ SquareUR,SquareUL,SquareBR,SquareBL:Boolean;
+ CircleUR,CircleUL,CircleBR,CircleBL:Boolean;
+ LTryUUR,LTryURR,LTryUUL,LTryULL:Boolean;
+ LTryBBR,LTryBRR,LTryBBL,LTryBLL:Boolean;
+Begin
+SquareUL:=(Bitmap[X-1,Y] Or Bitmap[X-1,Y+1] Or Bitmap[X,Y+1]);
+SquareUR:=(Bitmap[X+1,Y] Or Bitmap[X+1,Y+1] Or Bitmap[X,Y+1]);
+SquareBL:=(Bitmap[X-1,Y] Or Bitmap[X-1,Y-1] Or Bitmap[X,Y-1]);
+SquareBR:=(Bitmap[X+1,Y] Or Bitmap[X+1,Y-1] Or Bitmap[X,Y-1]);
+CircleUL:=(Not Bitmap[X-1,Y-1] And Not Bitmap[X-1,Y] And Not Bitmap[X-1,Y+1] And
+ Not Bitmap[X,Y+1] And Not Bitmap[X+1,Y+1]);
+CircleUR:=(Not Bitmap[X+1,Y-1] And Not Bitmap[X+1,Y] And Not Bitmap[X+1,Y+1] And
+ Not Bitmap[X,Y+1] And Not Bitmap[X-1,Y+1]);
+CircleBL:=(Not Bitmap[X-1,Y+1] And Not Bitmap[X-1,Y] And Not Bitmap[X-1,Y-1] And
+ Not Bitmap[X,Y-1] And Not Bitmap[X+1,Y-1]);
+CircleBR:=(Not Bitmap[X+1,Y+1] And Not Bitmap[X+1,Y] And Not Bitmap[X+1,Y-1] And
+ Not Bitmap[X,Y-1] And Not Bitmap[X-1,Y-1]);
+LTryUUL:=(Bitmap[X-1,Y-1] And Not Bitmap[X-1,Y] And Not Bitmap[X-1,Y+1] And
+ Not Bitmap[X,Y+1] And Not Bitmap[X+1,Y+1] And Bitmap[X+1,Y]);
+LTryUUR:=(Bitmap[X+1,Y-1] And Not Bitmap[X+1,Y] And Not Bitmap[X+1,Y+1] And
+ Not Bitmap[X,Y+1] And Not Bitmap[X-1,Y+1] And Bitmap[X-1,Y]);
+LTryBBL:=(Bitmap[X-1,Y+1] And Not Bitmap[X-1,Y] And Not Bitmap[X-1,Y-1] And
+ Not Bitmap[X,Y-1] And Not Bitmap[X+1,Y-1] And Bitmap[X+1,Y]);
+LTryBBR:=(Bitmap[X+1,Y+1] And Not Bitmap[X+1,Y] And Not Bitmap[X+1,Y-1] And
+ Not Bitmap[X,Y-1] And Not Bitmap[X-1,Y-1] And Bitmap[X-1,Y]);
+LTryULL:=(Not Bitmap[X-1,Y-1] And Not Bitmap[X-1,Y] And Not Bitmap[X-1,Y+1] And
+ Not Bitmap[X,Y+1] And Bitmap[X+1,Y+1] And Bitmap[X,Y-1]);
+LTryURR:=(Not Bitmap[X+1,Y-1] And Not Bitmap[X+1,Y] And Not Bitmap[X+1,Y+1] And
+ Not Bitmap[X,Y+1] And Bitmap[X-1,Y+1] And Bitmap[X,Y-1]);
+LTryBLL:=(Not Bitmap[X-1,Y+1] And Not Bitmap[X-1,Y] And Not Bitmap[X-1,Y-1] And
+ Not Bitmap[X,Y-1] And Bitmap[X+1,Y-1] And Bitmap[X,Y+1]);
+LTryBRR:=(Not Bitmap[X+1,Y+1] And Not Bitmap[X+1,Y] And Not Bitmap[X+1,Y-1] And
+ Not Bitmap[X,Y-1] And Bitmap[X-1,Y-1] And Bitmap[X,Y+1]);
+If LTryUUL Then Write(OutFile,'tuul(',XX,',',YY:4:2,');');
+If LTryULL Then Write(OutFile,'tull(',XX,',',YY:4:2,');');
+If LTryUUR Then Write(OutFile,'tuur(',XX,',',YY:4:2,');');
+If LTryURR Then Write(OutFile,'turr(',XX,',',YY:4:2,');');
+If LTryBBL Then Write(OutFile,'tbbl(',XX,',',YY:4:2,');');
+If LTryBLL Then Write(OutFile,'tbll(',XX,',',YY:4:2,');');
+If LTryBBR Then Write(OutFile,'tbbr(',XX,',',YY:4:2,');');
+If LTryBRR Then Write(OutFile,'tbrr(',XX,',',YY:4:2,');');
+If SquareUL And SquareUR And SquareBL And SquareBR Then
+ Write(OutFile,'s(',XX,',',YY:4:2,');')
+Else
+ If CircleUL And CircleUR And CircleBL And CircleBR Then
+ Write(OutFile,'c(',XX,',',YY:4:2,');')
+ Else
+ Begin
+ If Not LTryUUL And Not LTryULL And Not LTryUUR And Not LTryBLL Then
+ If SquareUL Then Write(OutFile,'sul(',XX,',',YY:4:2,');')
+ Else
+ If CircleUL Then Write(OutFile,'cul(',XX,',',YY:4:2,');')
+ Else Write(OutFile,'tul(',XX,',',YY:4:2,');');
+ If Not LTryUUL And Not LTryURR And Not LTryUUR And Not LTryBRR Then
+ If SquareUR Then Write(OutFile,'sur(',XX,',',YY:4:2,');')
+ Else
+ If CircleUR Then Write(OutFile,'cur(',XX,',',YY:4:2,');')
+ Else Write(OutFile,'tur(',XX,',',YY:4:2,');');
+ If Not LTryBBL And Not LTryULL And Not LTryBBR And Not LTryBLL Then
+ If SquareBL Then Write(OutFile,'sbl(',XX,',',YY:4:2,');')
+ Else
+ If CircleBL Then Write(OutFile,'cbl(',XX,',',YY:4:2,');')
+ Else Write(OutFile,'tbl(',XX,',',YY:4:2,');');
+ If Not LTryBBL And Not LTryURR And Not LTryBBR And Not LTryBRR Then
+ If SquareBR Then Write(OutFile,'sbr(',XX,',',YY:4:2,');')
+ Else
+ If CircleBR Then Write(OutFile,'cbr(',XX,',',YY:4:2,');')
+ Else Write(OutFile,'tbr(',XX,',',YY:4:2,');')
+ End
+End;
+
+Procedure InactiveBitmap(Var OutFile:OutFileType; Var Bitmap:BitmapType;
+ X,Y:SizeRange; XX:Integer; YY:Real; Var Active:Boolean);
+{Writes METAFONT code for an inactive cell}
+{Co-author is Mr. Masatoshi Watanabe}
+Begin
+If Bitmap[X-1,Y] And Bitmap[X,Y+1] Then
+ If Bitmap[X-1,Y-1] And Not Bitmap[X+1,Y+1] Then
+ Begin Active:=True; Write(OutFile,'ruul(',XX,',',YY:4:2,');') End
+ Else
+ If Bitmap[X+1,Y+1] And Not Bitmap[X-1,Y-1] Then
+ Begin Active:=True; Write(OutFile,'rull(',XX,',',YY:4:2,');') End
+ Else
+ Begin Active:=True; Write(OutFile,'rul(',XX,',',YY:4:2,');') End;
+If Bitmap[X+1,Y] And Bitmap[X,Y+1] Then
+ If Bitmap[X+1,Y-1] And Not Bitmap[X-1,Y+1] Then
+ Begin Active:=True; Write(OutFile,'ruur(',XX,',',YY:4:2,');') End
+ Else
+ If Bitmap[X-1,Y+1] And Not Bitmap[X+1,Y-1] Then
+ Begin Active:=True; Write(OutFile,'rurr(',XX,',',YY:4:2,');') End
+ Else
+ Begin Active:=True; Write(OutFile,'rur(',XX,',',YY:4:2,');') End;
+If Bitmap[X-1,Y] And Bitmap[X,Y-1] Then
+ If Bitmap[X-1,Y+1] And Not Bitmap[X+1,Y-1] Then
+ Begin Active:=True; Write(OutFile,'rbbl(',XX,',',YY:4:2,');') End
+ Else
+ If Bitmap[X+1,Y-1] And Not Bitmap[X-1,Y+1] Then
+ Begin Active:=True; Write(OutFile,'rbll(',XX,',',YY:4:2,');') End
+ Else
+ Begin Active:=True; Write(OutFile,'rbl(',XX,',',YY:4:2,');') End;
+If Bitmap[X+1,Y] And Bitmap[X,Y-1] Then
+ If Bitmap[X+1,Y+1] And Not Bitmap[X-1,Y-1] Then
+ Begin Active:=True; Write(OutFile,'rbbr(',XX,',',YY:4:2,');') End
+ Else
+ If Bitmap[X-1,Y-1] And Not Bitmap[X+1,Y+1] Then
+ Begin Active:=True; Write(OutFile,'rbrr(',XX,',',YY:4:2,');') End
+ Else
+ Begin Active:=True; Write(OutFile,'rbr(',XX,',',YY:4:2,');') End
+End;
+
+Procedure MiddleOut(Var OutFile:OutFileType; Var Bitmaps:BitmapsType;
+ Number:Integer; Standard:Boolean);
+{Writes METAFONT code for a given Bitmap}
+Var
+ X,Y:SizeRange;
+ Active:Boolean;
+Begin
+With Bitmaps Do
+ Begin
+ Write(OutFile,'beginchar(',Number,',',XMax-XMin+1,'u#,');
+ If Standard Then
+ Begin
+ If YMax>0.75 Then Write(OutFile,(YMax-0.75):4:2,'u#,')
+ Else Write(OutFile,'0,');
+ If 5.75>YMin Then Writeln(OutFile,(5.75-YMin):4:2,'u#);')
+ Else Writeln(OutFile,'0);')
+ End
+ Else
+ Begin
+ If YMax>3 Then Write(OutFile,YMax-3,'u#,')
+ Else Write(OutFile,'0,');
+ If 8>YMin Then Writeln(OutFile,8-YMin,'u#);')
+ Else Writeln(OutFile,'0);')
+ End;
+ Writeln(OutFile,'normal_adjust_fit(2u#,2u#);');
+ For X:=XMin To XMax Do
+ For Y:=1 To SizeMax Do
+ Begin
+ Active:=Bitmap[X,Y];
+ If Active Then
+ {Current pixel is on}
+ If Standard Then ActiveBitmap(OutFile,Bitmap,X,Y,X-XMin,Y-3.75)
+ Else ActiveBitmap(OutFile,Bitmap,X,Y,X-XMin,Y-6)
+ Else
+ {Current pixel is off}
+ If Standard Then InactiveBitmap(OutFile,Bitmap,X,Y,X-XMin,Y-3.75,Active)
+ Else InactiveBitmap(OutFile,Bitmap,X,Y,X-XMin,Y-6,Active);
+ {Avoid METAFONT buffer overflow}
+ If Active Then Writeln(OutFile)
+ End;
+ Writeln(OutFile,'endchar;');
+ Writeln(OutFile)
+ End
+End;
+
+Procedure EndOut(Var OutFile:OutFileType; Var RunTime:RunTimeType);
+{Writes final METAFONT header}
+Begin
+Writeln(OutFile,'font_identifier "'+RunTime.FileName+'";');
+If RunTime.Standard Then
+ Writeln(OutFile,'font_coding_scheme "JemTeX Standard";')
+Else Writeln(OutFile,'font_coding_scheme "JemTeX Dictionary";');
+Writeln(OutFile,'font_slant slant;');
+Writeln(OutFile,'font_normal_space 8u#;');
+Writeln(OutFile,'font_normal_stretch 4u#;');
+Writeln(OutFile,'font_normal_shrink 3u#;');
+Writeln(OutFile,'font_x_height 24u#; %ex');
+Writeln(OutFile,'font_quad 24u#; %em');
+Writeln(OutFile,'font_extra_space 0u#;');
+Writeln(OutFile);
+{Must end with CR/LF because of a bug(?) in emTeX METAFONT}
+Writeln(OutFile,'bye')
+End;
+
+{---------------------------------- Generate ---------------------------------}
+
+Procedure FindWantedBitmap(Automatic:Boolean; Var First:Boolean;
+ Var WantedBitmap:Bitmap0Range; Var Number:Integer);
+{Finds the number of the next desired Bitmap either automatically or manually}
+{The characters 0 and 1 in the first font kanjiaa are both set to Bitmap 1}
+Var Valid:Boolean;
+Begin
+If Automatic Then
+ {Find automatically}
+ If First Then
+ {Early in font kanjiaa}
+ If WantedBitmap=-1 Then WantedBitmap:=1
+ Else
+ Begin
+ WantedBitmap:=1;
+ First:=False
+ End
+ Else
+ If (Number=128) Or (WantedBitmap=BitmapMax) Then WantedBitmap:=0
+ Else WantedBitmap:=WantedBitmap+1
+Else
+ {Find manually}
+ Repeat
+ Write('Bitmap number? ');
+ Readln(WantedBitmap);
+ Writeln;
+ Valid:=( (0<=WantedBitmap) And (WantedBitmap<=BitmapMax) );
+ If Not Valid Then Writeln(Chr(7)+'Bitmap ',WantedBitmap,' out of range...')
+ Until Valid;
+Writeln('Bitmap number ',WantedBitmap,'.')
+End;
+
+Procedure ScanBitmap(Var InFile:InFileType; Var Bitmap:BitmapType;
+ Var Empty:Boolean);
+{Reads the Bitmap in a logical grid}
+{(0,0) is the lower left corner of the Bitmap}
+Label 1;
+Var
+ Y:SizeRange;
+ Buffer:BufferType;
+Begin
+{Read the Bitmap}
+BlockRead(InFile,Buffer,1);
+{Find if the Bitmap is empty}
+Empty:=True;
+For Y:=1 To SizeMax Do
+ With Buffer[Y] Do
+ If (Data1<>$00) Or (Data2<>$00) Or (Data3<>$00) Then
+ Begin
+ Empty:=False;
+ Goto 1
+ End;
+{Update logical grid}
+1:If Not Empty Then
+ For Y:=1 To SizeMax Do
+ With Buffer[SizeMax1-Y] Do
+ Begin
+ Bitmap[ 1,Y]:=((Data1 And $80)<>0);
+ Bitmap[ 2,Y]:=((Data1 And $40)<>0);
+ Bitmap[ 3,Y]:=((Data1 And $20)<>0);
+ Bitmap[ 4,Y]:=((Data1 And $10)<>0);
+ Bitmap[ 5,Y]:=((Data1 And $08)<>0);
+ Bitmap[ 6,Y]:=((Data1 And $04)<>0);
+ Bitmap[ 7,Y]:=((Data1 And $02)<>0);
+ Bitmap[ 8,Y]:=((Data1 And $01)<>0);
+ Bitmap[ 9,Y]:=((Data2 And $80)<>0);
+ Bitmap[10,Y]:=((Data2 And $40)<>0);
+ Bitmap[11,Y]:=((Data2 And $20)<>0);
+ Bitmap[12,Y]:=((Data2 And $10)<>0);
+ Bitmap[13,Y]:=((Data2 And $08)<>0);
+ Bitmap[14,Y]:=((Data2 And $04)<>0);
+ Bitmap[15,Y]:=((Data2 And $02)<>0);
+ Bitmap[16,Y]:=((Data2 And $01)<>0);
+ Bitmap[17,Y]:=((Data3 And $80)<>0);
+ Bitmap[18,Y]:=((Data3 And $40)<>0);
+ Bitmap[19,Y]:=((Data3 And $20)<>0);
+ Bitmap[20,Y]:=((Data3 And $10)<>0);
+ Bitmap[21,Y]:=((Data3 And $08)<>0);
+ Bitmap[22,Y]:=((Data3 And $04)<>0);
+ Bitmap[23,Y]:=((Data3 And $02)<>0);
+ Bitmap[24,Y]:=((Data3 And $01)<>0)
+ End
+End;
+
+Procedure ScanSides(Var Bitmaps:BitmapsType; FixedX,FixedY:Boolean);
+{Determines the minimal size of the Bitmap for proportional spacing}
+Var X,Y:SizeRange;
+Begin
+With Bitmaps Do
+ Begin
+ If FixedX Then
+ Begin
+ XMin:=1;
+ XMax:=SizeMax
+ End
+ Else
+ Begin
+ XMin:=SizeMax1;
+ For X:=SizeMax DownTo 1 Do
+ For Y:=1 To SizeMax Do
+ If Bitmap[X,Y] Then XMin:=X;
+ XMax:=0;
+ For X:=1 To SizeMax Do
+ For Y:=1 To SizeMax Do
+ If Bitmap[X,Y] Then XMax:=X
+ End;
+ If FixedY Then
+ Begin
+ YMin:=1;
+ YMax:=SizeMax
+ End
+ Else
+ Begin
+ YMin:=SizeMax1;
+ For Y:=SizeMax DownTo 1 Do
+ For X:=1 To SizeMax Do
+ If Bitmap[X,Y] Then YMin:=Y;
+ YMax:=0;
+ For Y:=1 To SizeMax Do
+ For X:=1 To SizeMax Do
+ If Bitmap[X,Y] Then YMax:=Y
+ End
+ End
+End;
+
+Procedure Generate(Var InFile:InFileType; Var OutFile:OutFileType;
+ Var Number:Integer; Var RunTime:RunTimeType);
+{Generates the METAFONT code for the selected font}
+Var
+ {Bitmap pointers}
+ CurrentBitmap,WantedBitmap:Bitmap0Range;
+ {Current Bitmap}
+ Bitmaps:BitmapsType;
+ X,Y:Size0Range;
+ {Indicates early in font kanjiaa}
+ First:Boolean;
+ {Indicates current Bitmap is empty}
+ Empty:Boolean;
+Begin
+{Clear the area outside the Bitmap once and for all}
+With Bitmaps Do
+ Begin
+ For X:=0 To SizeMax1 Do
+ Begin Bitmap[X,0]:=False; Bitmap[X,SizeMax1]:=False End;
+ For Y:=1 To SizeMax Do
+ Begin Bitmap[0,Y]:=False; Bitmap[SizeMax1,Y]:=False End
+ End;
+{Number of the Bitmap ready to be read}
+CurrentBitmap:=1;
+{First METAFONT character number}
+Number:=0;
+{First Bitmap wanted}
+If RunTime.Automatic Then
+ Begin
+ WantedBitmap:=1024 * ( Ord(UpCase(RunTime.FileName[6]))-Ord('A') ) +
+ 128 * ( Ord(UpCase(RunTime.FileName[7]))-Ord('A') ) - 1;
+ First:=(WantedBitmap=-1)
+ End;
+Repeat
+ FindWantedBitmap(RunTime.Automatic,First,WantedBitmap,Number);
+ If WantedBitmap<>0 Then
+ Begin
+ {Position pointer}
+ If WantedBitmap<>CurrentBitmap Then
+ Begin
+ Seek(InFile,WantedBitmap-1);
+ CurrentBitmap:=WantedBitmap
+ End;
+ Write('Reading Bitmap');
+ ScanBitmap(InFile,Bitmaps.Bitmap,Empty);
+ CurrentBitmap:=CurrentBitmap+1;
+ Writeln('.');
+ {Process Bitmap}
+ If Empty Then Writeln('Bitmap is empty, no METAFONT code ',Number,'.')
+ Else
+ Begin
+ Write('Writing METAFONT code ',Number);
+ ScanSides(Bitmaps,RunTime.FixedX,RunTime.FixedY);
+ MiddleOut(OutFile,Bitmaps,Number,RunTime.Standard);
+ Writeln('.')
+ End;
+ Writeln;
+ {Ready to generate next METAFONT character}
+ Number:=Number+1
+ End;
+Until WantedBitmap=0
+End;
+
+{------------------------------------ Main -----------------------------------}
+
+Begin
+Writeln;
+Writeln('Bitmaps to METAFONT Conversion Program.'); {To make Borland happy}
+Writeln('Version 2.00 Copyright F. Jalbert 1991.');
+Writeln;
+
+Write('Opening Bitmap file JIS24');
+Assign(InFile,'JIS24');
+Reset(InFile,RecSize);
+Writeln('.');
+Writeln;
+
+GetParameters(RunTime);
+Write('Creating METAFONT file '+RunTime.FileName+'.mf');
+Assign(OutFile,RunTime.FileName+'.mf');
+Rewrite(OutFile);
+Writeln('.');
+Writeln;
+
+Write('Writing initial METAFONT header');
+BeginOut(OutFile,RunTime);
+Writeln('.');
+Writeln;
+Generate(InFile,OutFile,Number,RunTime);
+Writeln;
+
+Write('Writing final METAFONT header');
+EndOut(OutFile,RunTime);
+Writeln('.');
+Write('Closing METAFONT file '+RunTime.FileName+'.mf');
+Close(OutFile);
+Writeln('.');
+Write('Closing Bitmap file JIS24');
+Close(InFile);
+Writeln('.');
+Writeln;
+
+Writeln('METAFONT code for ',Number,' Bitmap(s) generated.');
+Writeln
+End.