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

Removing Fonts From Files

    Date: Fri, 15 Jan 88 09:59:35 CST
    From: Daniel A Haug <aihaug@AUSTIN.LOCKHEED.COM>

    I am admittedly ignorant on a lot of these type of things, but surely there
    must be a way to remove font control characters from my ZMACS files.  We
    do code development on the symbolics, while this code must also run on the
    Sun (under Lucid).  I am preferential to using character styles, but find
    myself editing them right back out after transferring the files to the sun.

    What I would like to do is maintain my "pretty" version on the symbolics,
    and dump the "non-pretty" version to the sun when necessary, by simply
    executing m-X "Write File <filename> With Character Styles Removed", or
    something.  You get the idea.

    Does this capability exist already?

    dan haug

Here is a function that we use when necessary to remove fonts. This is
very basic.  It reads and writes a character at time and converts ones
that are not the default char-style-index of 0.  You could run this in a
batch mode when you have a bunch of files to move.

;;; -*- Mode: lisp; Syntax: common-lisp; Package: user; Base: 10 -*-

(defun 1SIMPLE-MINDED-FONT-STRIPPER0 (in-file out-file)
  (with-open-file (input-stream in-file :direction :input)
    (with-open-file (output-stream out-file :direction :output)
      (loop for ch = (read-char input-stream nil 'eof nil)
	    until (eql ch 'eof)
	    do (if (not (= 0 (si:char-style-index ch)))
		   (setf (si:char-style-index ch) 0))
	       (write-char ch output-stream)))))

  -- David D. Loeffler