Newsgroups: comp.lang.postscript
From: luser- -droog <mijo...@yahoo.com>
Date: Mon, 13 Aug 2012 15:54:53 -0700 (PDT)
Local: Mon, Aug 13 2012 6:54 pm
Subject: Re: Is it possible to replace 1 custom character in a font??
On Monday, August 13, 2012 8:15:16 AM UTC-5, David Combs wrote:
I tested it with ghostscript. Gv, ghostview, and GSView > >I cooked-up an example. > >%!
> >%customchar.ps
> >%Example replaces the space char (using ASCII decimal code)
> >%with a big black 'em'-square
> >/q{0 0 moveto 1 0 lineto 1 1 lineto 0 1 lineto closepath}def
> >/X<</FontType 3/FontBBox[0 0 1 1]/FontMatrix[1 0 0 1 0 0]
> > /Encoding StandardEncoding
> > /BuildChar{ % font char(int)
> > exch pop
> > dup 32 eq { pop
> > 1 0 0 0 1 1 setcachedevice
> > q fill
> > }{
> > /Times-Roman 1 selectfont
> > (?) dup 0 4 3 roll put dup stringwidth %(?) Wx Wy
> > 0 0 1 1 setcachedevice
> > 0 0 moveto
> > show
> > }ifelse
> > }
> >>>definefont pop
> >/X 30 selectfont
> >100 300 moveto
> >(Modified Font?) show
> Thanks for saving people some programming.
> I will save this post for possible future use.
> But first a probably insulting question: you did TEST
> the code?
> (I ask only because so many cs textbooks include program
> after program (source) that won't even compile, perhaps
> even in the human brain!)
> David
should therefore have no problem. It looks like I forgot 'showpage' at the end. So you may need to add that line to convert to pdf or send it to a printer. I'd have tested it with xpost (my own interpreter), but it doesn't parse the Level-2 <<dictionary>> syntax yet. :( I could add more commentary, if that would be helpful.
The sections about Fonts and 'definefont' in particular
-- droog
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||