[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

defontifying program



    Date: Fri, 3 Aug 90 14:06:16 EDT
    From: cstacy@ai.mit.edu (Christopher C. Stacy)

    I guess you could make a trivial pipe something like this:


    /* ff - flush fonts
      Copies standard input to standard output removing Genera font information. */

    #include <stdio.h>
    #define FONT_START ''

    main ()
    { int c;
      int flag = 0;
      while ((c = getchar()) != EOF) {
	      if ((c == FONT_START) || flag) flag = !flag;
	      else putchar(c);
      }
     }
WHOA! Your talking Release 6 fonts there!
In those days, the list of fonts appeared in the attribute line and the
file body contained # to switch to the #-th font.

Nowadays, character styles are used and its a bit more involved.

The 1st occurrence an  `turns on' the font machinery and defines a font
association. Such as:
   D,#TD1PsT[Begin using 006 escapes](1 0 (NIL 0) (:SWISS :ROMAN :SMALLER) "HL8") 
which turns on fonts and sets font # 1 to be swiss.roman.smaller.  
The next use of font # 1 would just use 1, as before.
0 switches back to the `default font'.

The first use of font # 2 might be something like
     (2 0 (NIL 0) (:SWISS :ITALIC NIL) "HL12I")
And so on...

So, the loop body needs to be something like the following (unfinished and untested!)

     if (c == FONT_START) {
       switch(getchar()) {
        '': while(getchar() != ']'); break;          /* Eat font initialization */
        '(': while(getchar() != balancing ')'); break; /* Write it yourself! */
		/* eg, some sort of increment on '(', decrement on ')', done when 0 */
        default: getchar(); break;}
     else putchar(c);

bruce
miller@cam.nist.gov
National Institute of Standards and Technology.

BTW: Somebody posted a request for us to include Signatures in our mail
messages (but neglected to include a return address :>).  I'm all for
that, but does anybody know how to get such things Automagically stuck
in?  I mean, you dont really expect me to THINK everytime I mail a
message, do you????