Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

glyphshow

40 views
Skip to first unread message

wg

unread,
Oct 31, 2012, 9:55:33 AM10/31/12
to
Greetings,

on linux I'm using enscript for document processing and manually insert
raw PostScript code to get the Eurosymbol printed.
I do this by replacing all \244 with ^@ps{/Euro glyphshow}
This works fine when using monospace fonts.
However, using varaible-width fonts, the Eurosign is placed in the wrong
horizontal position.

My questions are:
1) how do I set the current x position with ps so that I can use the
moveto/rmoveto command to place the Eurosign correctly?
2) how do I increment to current x position, so that the following text
does not overwrite the Eurosign.


Thanks for hints
Wolf

John Deubert

unread,
Oct 31, 2012, 12:09:27 PM10/31/12
to
You might consider a different approach to the problem; you could
modify the current font so that \244 actually prints the Euro sign.
Here's a snippet that defines an "AddEuro" procedure that adds the Euro
character to a font dictionary.

Note that you need to provide a name for the new, euro-fied font.

% ============= cut here ==============
/Helvetica findfont 30 scalefont setfont

/AddEuro % /newFName <<fontDict>> => <<fDictWithEuro>>
{
dup length dict copy % /newFName <<newfdict>>
begin
/Encoding Encoding % /newFName /Encoding [Enc]
dup length array copy % /newFName /Encoding [EncCopy]
dup 8#244 /Euro put % /newFName /Encoding [EncCopy]
def % /newFName
currentdict definefont
} bind def

/Helvetica findfont /HelvEuro exch AddEuro
30 scalefont
setfont

72 600 moveto
(It costs \244234.99) show

showpage
% ============= cut here ==============

You could call the AddEuro procedure before each setfont and then just
leave the \244 in place in the strings.

If you want to see how this does what it does, I refer you to the
November and December 2001 issues (#11 & 12) of the Acumen Journal,
which explains it all in detail. The journal is free for the
downloading at http://www.acumentraining.com/acumenjournal.html.

Hope this helps.

- John


--
========
John Deubert
Acumen Training
PostScript & PDF Engineering Classes & Consulting
www.acumentraining.com

Learn PostScript programming techniques
Read the free Acumen Journal
acumentraining.com/acumenjournal.html

wg

unread,
Nov 2, 2012, 5:13:09 AM11/2/12
to
John, thank you very much for your help, particulariy for the link!
Perhaps I'm gonna dig into ps a bit deeper than expected :-)

Wolf




0 new messages