Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #1022

Re: glyphshow

From John Deubert <john@acumentraining.com>
Organization Acumen Training
Newsgroups comp.lang.postscript
Date 2012-10-31 09:09 -0700
Message-ID <2012103109092788173-john@acumentrainingcom> (permalink)
References <k6rakq$22s$1@newsreader2.utanet.at>
Subject Re: glyphshow

Show all headers | View raw


On 2012-10-31 13:55:33 +0000, wg said:

> 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

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

Back to comp.lang.postscript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

glyphshow wg <wg1@gmx.net> - 2012-10-31 14:55 +0100
  Re: glyphshow John Deubert <john@acumentraining.com> - 2012-10-31 09:09 -0700
    Re: glyphshow wg <wg1@gmx.net> - 2012-11-02 10:13 +0100

csiph-web