Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Is it possible to replace 1 custom character in a font??
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
luser- -droog  
View profile  
 More options Aug 13 2012, 6:54 pm
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 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

I tested it with ghostscript. Gv, ghostview, and GSView
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.
I usually aim for the Miltonic maxim: show, don't tell.
So I am quite prone to not providing essential
documentation.

The sections about Fonts and 'definefont' in particular
from the PLRM would be good background for understanding
this code.

-- 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.