[comp.text] Switching fonts in ditroff

simpson@trwrb.UUCP (Scott Simpson) (11/07/87)

Okay, boys and girls.  First I wish to thank all of you for answering my
question about how to get a literal string out to ditroff.  Now I have a 
harder question.  I have recently completed an otroff driver for our laser
printers.  I hacked up the TeX Computer Modern fonts and got them to work with
otroff.  I created a roman, italic, bold and special font.  The otroff driver
works great.  I also wrote a ditroff driver.  It works great too, except for
one problem: ditroff doesn't do an explicit switch to the special font when
it uses a special font character.  For example, in old troff, the input

	Hello\(**

would cause troff to change to upper rail, upper magazine (i.e., the special
font) when it encountered the mathematical * character.  Ditroff doesn't do
this.  It puts out the sequence
	
	C**

which means to print the special character **.  But special characters exist
in the normal fonts too and I don't want to look up in a table to see if a
sequence is in a normal font or a special font since you can add new sequences
at whim to the DESC file and the table would have to be continually updated.
Am I missing some obvious concept?  Why doesn't ditroff switch fonts when
it encounters a sequence from a special font?  Any clean solutions are 
appreciated.
-- 
		Scott Simpson
		TRW Space and Defense
		...{decvax,ihnp4,ucbvax}!trwrb!simpson	(UUCP)
		trwrb!simpson@trwind.trw.com		(ARPA)

edmoy@opal.berkeley.edu (11/07/87)

In article <3601@trwrb.UUCP> simpson@trwrb.UUCP (Scott Simpson) writes:
>one problem: ditroff doesn't do an explicit switch to the special font when
>it uses a special font character.  For example, in old troff, the input
>
>	Hello\(**
>
>would cause troff to change to upper rail, upper magazine (i.e., the special
>font) when it encountered the mathematical * character.  Ditroff doesn't do
>this.  It puts out the sequence
>	
>	C**
>
>which means to print the special character **.

I assume ditroff doesn't do an explicit switch to the special font to
minimize the size of the intermediate ditroff output file.  Since the
driver is supposed to use the same description and width tables as
ditroff, then ditroff expects the driver to use the same algorithm to
locate a character, and so the driver should automatically switch to
the special font itself.

>But special characters exist
>in the normal fonts too and I don't want to look up in a table to see if a
>sequence is in a normal font or a special font since you can add new sequences
>at whim to the DESC file and the table would have to be continually updated.
>Am I missing some obvious concept?  Why doesn't ditroff switch fonts when
>it encounters a sequence from a special font?  Any clean solutions are 
>appreciated.

As far as I know, that's life (with ditroff :-).

Edward Moy
Academic Computing Services
University of California
Berkeley, CA  94720

edmoy@opal.Berkeley.EDU
ucbvax!opal!edmoy

patwood@unirot.UUCP (Patrick Wood) (11/08/87)

ditroff automatically searches the current font for a special character, if
it doesn't find it there, ditroff searches the special font(s) starting with
the one mounted on the lowest position.


Pat Wood