Article View: comp.lang.postscript
Article #4901Re: font lookup problem
From: Dick Dunn
Date: Tue, 05 Mar 1991 21:33
Date: Tue, 05 Mar 1991 21:33
38 lines
2482 bytes
2482 bytes
bcockburn@acorn.co.uk (Bruce Cockburn) writes:
> An added bonus of a new font lookup might be a different substitution for
> unknown fonts (rather than Courier). For example if the font name requested
> is not found AND ends with "-Roman" then default to Times-Roman etc.
While my first reaction was "replace invalidfont to catch the error", this
obviously doesn't work because the font name isn't handy. But you could
easily replace findfont with an operator to do your substitution.
If all your fonts are in the font directory, you can replace findfont
completely...it would go something like (caution! untested code, for
illustration only!:-):
FontDirectory
dup 2 index known {
exch get % it's there; just return it
} {
pop % discard FontDirectory
--have a look and wander around to find a substitute--
} ifelse
If findfont does something more elaborate (e.g., if you've got fonts in
more than one place), you probably want to hold on to the old findfont, and
invoke it from your redefinition of findfont, then check to see if it gave
you a Courier result; if so, attempt your own substitutions by modifying
the font name and repeating the findfont attempt. This is sort of a sticky
problem given the plethora of names used for related concepts in
typography. For example, the "slanted version" in a family may be called
Italic, Cursive, Oblique, or Slanted.
The original posting involved a slightly different problem: Jeff Hinsch was
trying to get the search order redefined so that a printer would find fonts
downloaded to a printer's disk in preference to ROM fonts. This seems
rather harder, because presumably the fonts on disk are not in
FontDirectory (else, by the definition of findfont, they would take
precedence). Jeff, or someone who's fighting that particular printer:
Is findfont a procedure that you can unravel to find the separate steps?
--
Dick Dunn rcd@ico.isc.com -or- ico!rcd Boulder, CO (303)449-2870
...But is it art?
Technical Details
Message-ID:
<1991Mar5.213334.29175@ico.isc.com>Path:
arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!elroy.jpl.nasa.gov!ncar!ico!rcdReferences:
<71017@microsoft.UUCP> <5568@acorn.co.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!elroy.jpl.nasa.gov!ncar!ico!rcd From: rcd@ico.isc.com (Dick Dunn) Newsgroups: comp.lang.postscript Subject: Re: font lookup problem Summary: easy change Message-ID: <1991Mar5.213334.29175@ico.isc.com> Date: 5 Mar 91 21:33:34 GMT References: <71017@microsoft.UUCP> <5568@acorn.co.uk> Distribution: comp Organization: Interactive Systems Corporation, Boulder, CO Lines: 38