🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #1006

Font tweaking

#1006
From: Karl Heuer
Date: Mon, 04 Sep 1989 16:00
36 lines
2560 bytes
I need to be able to print text containing certain accented letters which are
not present in the builtin fonts.  I've read through some back issues of c.l.p
that I was foresighted enough to save, and studied the appropriate sections in
the red and blue books.  It appears that there are several solutions, none of
which I find entirely satisfactory.  Perhaps someone (Glenn?) could suggest
the "right" way to do this.

The books talk about two kinds of font tweaking.  Remapping the Encoding
vector isn't useful for this purpose, because the composite characters I need
aren't already defined.  So it seems I have to create a user-defined font.

(a) I can make a font containing *only* the new characters, and just switch
fonts whenever I print an accented letter.  This seems less elegant than
building a single font with the complete alphabet.  But this is how the blue
book example does it (the font containing box and bullets), so maybe it's the
approved solution.

(b) I can easily add my accented characters by extending BuildChar, *if* I can
first create a user-defined font which is functionally identical to the
original builtin font.  One way to do this is to let my new font defer to the
existing font to do the dirty work; i.e. I can have my BuildChar do a setfont
and a show.  Wilfried Soeker used this approach in his article last February.

(c) I can attempt to construct what BuildChar would look like it it existed in
a builtin font.  Except for the missing setcachedevice, I think that would be
	{ exch begin   Encoding exch get   CharStrings exch get   end exec }
, right?  Is it legal to directly execute the procedure from CharStrings?

Now in cases (b) and (c), to get full benefit of font cacheing I should call
setcachedevice with the width and bbox information.  How should I go about
obtaining those values?  Are they stored in some user-visible place from which
I can copy them, or would I have to use `charpath flattenpath pathbbox' and
`stringwidth'?  If the latter, should I put this code right into BuildChar, or
preconstruct a table?

Karl Heuer   karl@haddock.ima.isc.com   rutgers!harvard!ima!haddock!karl
Technical Details
Message-ID: <14510@haddock.ima.isc.com>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!ico!ism780c!haddock!karl

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!ico!ism780c!haddock!karl
From: karl@haddock.ima.isc.com (Karl Heuer)
Newsgroups: comp.lang.postscript
Subject: Font tweaking
Message-ID: <14510@haddock.ima.isc.com>
Date: 4 Sep 89 16:00:37 GMT
Reply-To: karl@haddock.ima.isc.com (Karl Heuer)
Organization: Interactive Systems, Cambridge, MA 02138-5302
Lines: 36