Character 15 gets changed to character 12: why? 
Author Message
 Character 15 gets changed to character 12: why?

G'day,

The following clumsy code is meant to create a file containing
a (mostly) eexec encoded dictionary. It works, in that the
resulting file can be read back into GhostScript (5.50) and the
dictionary is set up with a single key /Gamma. However,
mysteriously the value associated with /Gamma has become
(\012), not the intended (\15). Using values of (\14) or (\16) for
\Gamma doesn't produce this behaviour, just (\15).
Can anyone point me in the direction of an explanation?

Many thanks,

                David Wilson

%!
% put the stuff to be encoded into a string, with 4 chars of junk prepended
/STR (abcdTestDict begin /Gamma (\15) def end mark currentfile closefile )
def
% now dump to a file
/TestOut (c:/temp/test.ps) (w) file def
TestOut (/TestDict 20 dict def currentfile eexec \n) writestring
TestOut /ASCIIHexEncode filter dup 55665 /eexecEncode filter dup
STR writestring flushfile flushfile
8 {TestOut
(0000000000000000000000000000000000000000000000000000000000000000\n)
writestring} repeat
TestOut (cleartomark) writestring
TestOut closefile



Mon, 06 Aug 2001 03:00:00 GMT  
 Character 15 gets changed to character 12: why?
Quote:

> G'day,

> The following clumsy code is meant to create a file containing
> a (mostly) eexec encoded dictionary. It works, in that the
> resulting file can be read back into GhostScript (5.50) and the
> dictionary is set up with a single key /Gamma. However,
> mysteriously the value associated with /Gamma has become
> (\012), not the intended (\15). Using values of (\14) or (\16) for
> \Gamma doesn't produce this behaviour, just (\15).
> Can anyone point me in the direction of an explanation?

> Many thanks,

>                 David Wilson

> %!
> % put the stuff to be encoded into a string, with 4 chars of junk prepended
> /STR (abcdTestDict begin /Gamma (\15) def end mark currentfile closefile )
> def
> % now dump to a file
> /TestOut (c:/temp/test.ps) (w) file def
> TestOut (/TestDict 20 dict def currentfile eexec \n) writestring
> TestOut /ASCIIHexEncode filter dup 55665 /eexecEncode filter dup
> STR writestring flushfile flushfile
> 8 {TestOut
> (0000000000000000000000000000000000000000000000000000000000000000\n)
> writestring} repeat
> TestOut (cleartomark) writestring
> TestOut closefile

This is simply due to the fact that the postscript scanner treats CR,
NL, and CRNL as
"newline" character. Thus, the following strings are all equivalent:
(aaa\012bbb)
(aaa\015bbb)
(aaa\012\015bbb)
(aaa\nbbb)
if read-in by the interpreter's scanner.

See Adobe's Red Book, the chapter on Syntax.

Helge
--





Mon, 06 Aug 2001 03:00:00 GMT  
 Character 15 gets changed to character 12: why?

Quote:
>This is simply due to the fact that the PostScript scanner treats CR,
>NL, and CRNL as
>"newline" character. Thus, the following strings are all equivalent:
>(aaa\012bbb)
>(aaa\015bbb)
>(aaa\012\015bbb)
>(aaa\nbbb)
>if read-in by the interpreter's scanner.

>See Adobe's Red Book, the chapter on Syntax.

>Helge

Thanks for the tip. Changing the string to
/STR (abcdTestDict begin /Gamma \(\\15\) def end mark currentfile
closefile )
confuses the interpreter enough to get the (\15) through as I wanted it.

David Wilson



Tue, 07 Aug 2001 03:00:00 GMT  
 Character 15 gets changed to character 12: why?

Quote:



>>Thanks for the tip. Changing the string to
>>/STR (abcdTestDict begin /Gamma \(\\15\) def end mark currentfile
>>closefile )
>>confuses the interpreter enough to get the (\15) through as I wanted it.

>This is perfectly silly.
>You should not use any character below 32 (dec) for a graphic character.
>Choose a value between 33 and 255 (dec).

If searching for a reason, one is that they may be treated as white
space by many text handling utilities.
----------------------------------------

Visit http://www.*-*-*.com/ ,
PSAlter, psalters, tea, and small {*filter*} animals. And stuff.  


Wed, 08 Aug 2001 03:00:00 GMT  
 Character 15 gets changed to character 12: why?

Quote:




>>>Thanks for the tip. Changing the string to
>>>/STR (abcdTestDict begin /Gamma \(\\15\) def end mark currentfile
>>>closefile )
>>>confuses the interpreter enough to get the (\15) through as I wanted it.

>>This is perfectly silly.
>>You should not use any character below 32 (dec) for a graphic character.
>>Choose a value between 33 and 255 (dec).

>If searching for a reason, one is that they may be treated as white
>space by many text handling utilities.

Fair enough, but my intended use is with a symbol font (hence the name
of the key).

David Wilson



Thu, 09 Aug 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Convert UTF-8 characters to Latin (1 byte) characters

2. Why does Word 97 position each character separately?

3. getting right 2 characters from a string

4. Getting number of characters with Length ?

5. Getting/setting character position in an input field

6. getting the path representation of a character to server stdout

7. Getting at character outlines

8. a2ps : Scale a font only in 1 dimension - change CPI (Characters per Inch)

9. Behavior change: IE6 SP1 and SCRIPT SRC with high-bit characters

10. Changing a few characters in a font

11. Character change

12. changing font and character size with wscript

 

 
Powered by phpBB® Forum Software