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


Groups > comp.lang.postscript > #1021 > unrolled thread

glyphshow

Started bywg <wg1@gmx.net>
First post2012-10-31 14:55 +0100
Last post2012-11-02 10:13 +0100
Articles 3 — 2 participants

Back to article view | Back to comp.lang.postscript


Contents

  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

#1021 — glyphshow

Fromwg <wg1@gmx.net>
Date2012-10-31 14:55 +0100
Subjectglyphshow
Message-ID<k6rakq$22s$1@newsreader2.utanet.at>
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

[toc] | [next] | [standalone]


#1022

FromJohn Deubert <john@acumentraining.com>
Date2012-10-31 09:09 -0700
Message-ID<2012103109092788173-john@acumentrainingcom>
In reply to#1021
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

[toc] | [prev] | [next] | [standalone]


#1028

Fromwg <wg1@gmx.net>
Date2012-11-02 10:13 +0100
Message-ID<k702re$jmo$1@newsreader2.utanet.at>
In reply to#1022
On 31.10.2012 17:09, John Deubert wrote:
> 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, thank you very much for your help, particulariy for the link!
Perhaps I'm gonna dig into ps a bit deeper than expected :-)

Wolf



[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.postscript


csiph-web