home *** CD-ROM | disk | FTP | other *** search
- /*
- *
- * This program generates an IFF FTXT file from an ASCII file. The syntax is
- *
- * IFF infile outfile
- *
- * To change the fonts inserted in the FTXT file, change the stems "fontname.i.j."
- * The first number is the font number, the second number lets you specify many
- * alternatives if you wanna be sure that some font will eventually match. The
- * LAST (highest number) font matched is the one Leggi will keep. So don't
- * exaggerate, or reading your IFF file will take minutes, since every font
- * must be opened. NOTE: Comment out the font you're not using!
- *
- */
-
- fontname.='NOFONT'
- fontname.1.1='Diamond.font/17'
- fontname.2.1='Diamond.font/20'
- /*
- fontname.3.1='Times.font/18'
- fontname.4.1='Times.font/24'
- fontname.5.1='Helvetica.font/18'
- fontname.6.1='Helvetica.font/24'
- fontname.7.1='Garnet.font/9'
- fontname.8.1='Garnet.font/16'
- */
-
- parse arg in ' ' out
-
- if open('outfile', out, 'w') == 0 then
- do
- say 'Can''t open output file'
- exit 0
- end
-
- rc = writech('outfile', 'FORM');
- rc = WriteLongWord(0)
- rc = writech('outfile', 'FTXT');
-
- do i = 1 to 8
-
- do j=1 while fontname.i.j ~= 'NOFONT'
- l = length(fontname.i.j)
- rc = writech('outfile', 'FONS');
- rc = WriteLongWord(l-(l//2)+6)
- rc = writech('outfile', d2c(i-1)||d2c(0)||d2c(0)||d2c(0))
- rc = writech('outfile', fontname.i.j)
- rc = writech('outfile', d2c(0))
- if l//2 = 0 then rc = writech('outfile', d2c(0))
- end
-
- end
-
- if open('infile', in, 'r') == 0 then
- do
- say 'Can''t open input file'
- exit 0
- end
-
- l = seek('infile', 0, 'e')
- rc = seek('infile', 0, 'b')
- a = readch('infile', l)
-
- rc = writech('outfile', 'CHRS')
- rc = WriteLongWord(l+(l//2))
- rc = writech('outfile', a)
- if l//2 ~= 0 then rc = writech('outfile', d2c(0))
- l = seek('outfile', 0, 'e');
- rc = seek('outfile', 4, 'b');
- rc = WriteLongWord(l-8)
-
- exit 0
-
-
- WriteLongWord: procedure
- arg n
- rc = writech('outfile', right( d2c(0)||d2c(0)||d2c(0)||d2c(n), 4));
- return rc
-