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
glyphpath
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  10 messages - Collapse all  -  Translate all to Translated (View all originals)
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
 
jdaw1  
View profile  
 More options May 25 2006, 10:23 pm
Newsgroups: comp.lang.postscript
From: "jdaw1" <jdawise...@gmail.com>
Date: 25 May 2006 19:23:35 -0700
Local: Thurs, May 25 2006 10:23 pm
Subject: glyphpath
Please, what is the easiest way to do a charpath type thing to a glyph
(in the current font)?

 
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.
Aandi Inston  
View profile  
 More options May 26 2006, 2:59 am
Newsgroups: comp.lang.postscript
From: qu...@dial.pipex.con (Aandi Inston)
Date: Fri, 26 May 2006 06:59:53 GMT
Local: Fri, May 26 2006 2:59 am
Subject: Re: glyphpath

"jdaw1" <jdawise...@gmail.com> wrote:
>Please, what is the easiest way to do a charpath type thing to a glyph
>(in the current font)?

If you have the glyph name but not the encoding point, you need to
re-encode the font. Since you should always re-encode fonts this
should be pretty easy.
----------------------------------------
Aandi Inston  qu...@dial.pipex.com http://www.quite.com
Please support usenet! Post replies and follow-ups, don't e-mail them.

 
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.
jdaw1  
View profile  
 More options May 26 2006, 8:01 am
Newsgroups: comp.lang.postscript
From: "jdaw1" <jdawise...@gmail.com>
Date: 26 May 2006 05:01:01 -0700
Local: Fri, May 26 2006 8:01 am
Subject: Re: glyphpath
Oh. I never re-encode fonts, and don't know how. Please, with (say)
/quotedblleft on the stack, how do I append its outline to the current
path.

(FYI, I'm writing a version of show, and associated bounding-box
functions StringWidth and StringHeight, that will accept an array
containing strings, names of glyphs, of further arrays containing same.
I need glyphpath for the StringHeight function.)


 
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.
jdaw1  
View profile  
 More options May 26 2006, 1:47 pm
Newsgroups: comp.lang.postscript
From: "jdaw1" <jdawise...@gmail.com>
Date: 26 May 2006 10:47:53 -0700
Local: Fri, May 26 2006 1:47 pm
Subject: Re: glyphpath
I've tried the following, but it produces a blank page. Please, what's
wrong? (And this creates a whole new font, so GlyphPath will need to
know its size: I'm hoping to use the currentfont, at whatever size it
is, rather than a new font. Please, how might that be done?)

%!PS-Adobe-2.1

/GlyphPath
{
        /glyphname exch def
        currentfont length dict begin
        currentfont {1 index /FID ne {def} {pop pop} ifelse} forall
        /Encoding 256 array def
        0 1 255 {Encoding exch /.notdef put} for
        Encoding 97 glyphname put  % ASCII a = 97
        currentdict
        end
        /TemporaryFont exch definefont pop
        /TemporaryFont 48 selectfont
        (abcd) false charpath

} def

/TimesNewRomanPS-BoldMT 128 selectfont
50 500 moveto
0 setgray 1.2 setlinewidth 1 setlinecap 1 setlinejoin

/dagger GlyphPath gsave 0.75 setgray fill grestore stroke

showpage
(pstack start) ==
pstack
(pstack done) ==


 
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.
Aandi Inston  
View profile  
 More options May 26 2006, 2:17 pm
Newsgroups: comp.lang.postscript
From: qu...@dial.pipex.con (Aandi Inston)
Date: Fri, 26 May 2006 18:17:19 GMT
Local: Fri, May 26 2006 2:17 pm
Subject: Re: glyphpath

"jdaw1" <jdawise...@gmail.com> wrote:
>Oh. I never re-encode fonts, and don't know how. Please, with (say)
>/quotedblleft on the stack, how do I append its outline to the current
>path.

1. Re-encode the font to a new encoding vector that includes
/quotedblleft (or, if the current encoding array includes
/quotedblleft, look up its index).

Re-encoding fonts is fundamental and should be covered in any
PostScript book that talks about working with fonts. It should always
be done, except in the case where you only use glyphshow, because you
do not know what the original encoding is.

2. Use charpath with a suitable character index into the new encoding.

>(FYI, I'm writing a version of show, and associated bounding-box
>functions StringWidth and StringHeight, that will accept an array
>containing strings, names of glyphs, of further arrays containing same.
>I need glyphpath for the StringHeight function.)

Then re-encoding is going to be pretty important to you!
----------------------------------------
Aandi Inston  qu...@dial.pipex.com http://www.quite.com
Please support usenet! Post replies and follow-ups, don't e-mail them.

 
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.
Aandi Inston  
View profile  
 More options May 26 2006, 2:31 pm
Newsgroups: comp.lang.postscript
From: qu...@dial.pipex.con (Aandi Inston)
Date: Fri, 26 May 2006 18:31:00 GMT
Subject: Re: glyphpath

"jdaw1" <jdawise...@gmail.com> wrote:
>Please, how might that be done?)

glyphshow is a convenience operator, but it is only a convenience in
the simple case. Otherwise you have a lot to do, and I think you have
created a scenario that is too complex for the benefits it gives.

>%!PS-Adobe-2.1

Please use

%!

The line you have used says that your file is DSC compliant, and it is
not; this could cause errors.

>    /TemporaryFont exch definefont pop
>    /TemporaryFont 48 selectfont
>    (abcd) false charpath

In the implementation I tested with, the modified font retained the
original font scaling. This was then further scaled by another factor
of 48. When replaced by 1 it worked as expected.

>} def

>/TimesNewRomanPS-BoldMT 128 selectfont

If it matters to you, Times-Roman is a more portable choice.
>50 500 moveto
>0 setgray 1.2 setlinewidth 1 setlinecap 1 setlinejoin

>/dagger GlyphPath gsave 0.75 setgray fill grestore stroke

>showpage

----------------------------------------
Aandi Inston  qu...@dial.pipex.com http://www.quite.com
Please support usenet! Post replies and follow-ups, don't e-mail them.

 
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.
jdaw1  
View profile  
 More options May 26 2006, 3:03 pm
Newsgroups: comp.lang.postscript
From: "jdaw1" <jdawise...@gmail.com>
Date: 26 May 2006 12:03:55 -0700
Local: Fri, May 26 2006 3:03 pm
Subject: Re: glyphpath
Fantastic; thank you for your expert and quick help. For the benefit of
others googling the same problem, I'll post the lastest version of my
code, but after I get GlyphPath to do the sensible thing with the
currentpoint.

Other issues outstanding:
-- Distiller 6.0.1 on a PC didn't recognise /Times-Roman; nor any
versions I could invent that might be bold;
-- Is "a" guaranteed to be 97?

Thanks again.


 
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.
Aandi Inston  
View profile  
 More options May 26 2006, 5:06 pm
Newsgroups: comp.lang.postscript
From: qu...@dial.pipex.con (Aandi Inston)
Date: Fri, 26 May 2006 21:06:01 GMT
Local: Fri, May 26 2006 5:06 pm
Subject: Re: glyphpath

"jdaw1" <jdawise...@gmail.com> wrote:
>-- Distiller 6.0.1 on a PC didn't recognise /Times-Roman

It should do, though it won't be able to embed it if you don't own it.
Nevetheless, this is the standard Times font name

>. nor any
>versions I could invent that might be bold;

Times-Bold.

>-- Is "a" guaranteed to be 97?

That's up to you.  If you mean in the string (a), then you can check
in a binary editor what the value you code is; likely to be the same
on all systems.  You can set specific codes into a string using "put".
----------------------------------------
Aandi Inston  qu...@dial.pipex.com http://www.quite.com
Please support usenet! Post replies and follow-ups, don't e-mail them.

 
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.
jdaw1  
View profile  
 More options May 27 2006, 12:09 am
Newsgroups: comp.lang.postscript
From: "jdaw1" <jdawise...@gmail.com>
Date: 26 May 2006 21:09:17 -0700
Local: Sat, May 27 2006 12:09 am
Subject: Re: glyphpath
Excellent: thank you again. Code, for others to criticise or re-use:

/BaseHeight {
        gsave
                newpath 0 0 moveto
                [ 0 0 0 0 0 0 ] defaultmatrix setmatrix
                (ABCFJ1hli^"/) true charpath flattenpath pathbbox exch pop sub neg
exch pop
        grestore

} def

/StringHeight {
        gsave
                newpath 0 0 moveto
                [ 0 0 0 0 0 0 ] defaultmatrix setmatrix
                true CharPathRecursive flattenpath pathbbox exch pop sub neg exch pop
        grestore

} def

% A valid parameter is a glyph name, a string, or an array of valid
paramters.
% Computes the total width.
/StringWidthRecursive
{
        dup type /stringtype eq
        {stringwidth pop}
        {
        dup type /nametype eq
        {matrix currentmatrix gsave newpath nulldevice setmatrix 0 0 moveto
glyphshow currentpoint grestore pop} %
http://groups.google.com/group/comp.lang.postscript/browse_thread/thr...
        {
        dup type /arraytype eq
        {0 exch {StringWidthRecursive add} forall}
        {
                pop (Error: StringWidthRecursive parameter neither string nor name
nor array) =
        } ifelse  % arraytype
        } ifelse  % nametype
        } ifelse  % stringtype

} def

% A valid parameter is a glyph name, a string, or an array of valid
paramters.
% ShowRecursive shows the sequences of entities in the natural manner.
/ShowRecursive
{
        1 dict begin
        /param exch def
        param type /stringtype eq {param show}
        {
        param type /nametype eq {param glyphshow}
        {
        param type /arraytype eq
        {
                param {ShowRecursive} forall
        }
        {
                (Error: ShowRecursive parameter neither string nor name nor array) =
        } ifelse  % arraytype
        } ifelse  % nametype
        } ifelse  % stringtype
        end

} def

% Computes the path of a glyph, with the charpath-style boolean flag,
destroying the currentpoint.
/GlyphPath
{
        2 dict begin
        /bln exch def
        /glyphname exch def
        currentfont
        currentfont length dict begin
        currentfont {1 index /FID ne {def} {pop pop} ifelse} forall
        /Encoding [ 256 {/.notdef} repeat ] def
        Encoding 97 glyphname put  % ASCII a = 97
        currentdict
        end
        /TemporaryFont exch definefont pop
        /TemporaryFont 1 selectfont
        (a) bln charpath
         setfont
        /TemporaryFont undefinefont
        end

} def

% Computes the path of a glyph, with the charpath-style boolean flag,
moving the currentpoint as if after a show.
/GlyphPathMoveto
{
        2 dict begin
        /bln exch def
        /glyphname exch def
        currentfont
        currentfont length dict begin
        currentfont {1 index /FID ne {def} {pop pop} ifelse} forall
        /Encoding [ 256 {/.notdef} repeat ] def
        Encoding 97 glyphname put  % ASCII a = 97
        currentdict
        end
        /TemporaryFont exch definefont pop
        /TemporaryFont 1 selectfont
        currentpoint exch (a) stringwidth pop add exch
        (a) bln charpath
        moveto
        setfont
        /TemporaryFont undefinefont
        end

} def

% A valid first parameter is a glyph name, a string, or an array of
valid paramters.
% CharPathRecursiveMoveto computes the path, destroying the
currentpoint.
/CharPathRecursive
{
        2 dict begin
        /bln exch def
        /param exch def
        param type /stringtype eq {param bln charpath}
        {
        param type /nametype eq {param bln GlyphPath}
        {
        param type /arraytype eq
        {
                0 1 param length 2 sub
                {
                        param exch get bln CharPathRecursiveMoveto
                } for
                param  param length 1 sub  get   bln CharPathRecursive
        }
        {
                (Error: CharPathRecursive parameter neither string nor name nor array
) =
        } ifelse  % arraytype
        } ifelse  % nametype
        } ifelse  % stringtype
        end

} def

% A valid first parameter is a glyph name, a string, or an array of
valid paramters.
% CharPathRecursiveMoveto computes the path, moving the currentpoint as
if after a show.
/CharPathRecursiveMoveto
{
        2 dict begin
        /bln exch def
        /param exch def
        param type /stringtype eq
        {
                currentpoint exch param stringwidth pop add exch
                param bln charpath
                moveto
        }
        {
        param type /nametype eq {param bln GlyphPathMoveto}
        {
        param type /arraytype eq
        {
                param {bln CharPathRecursiveMoveto} forall
        }
        {
                (Error: CharPathRecursiveMoveto parameter neither string nor name nor
array ) =
        } ifelse  % arraytype
        } ifelse  % nametype
        } ifelse  % stringtype
        end

} def

% A valid first parameter is a glyph name, a string, or an array of
valid paramters.
% DeGlyphRecursive computes a concatenated string, with glyphs replaced
by the first character of their name (which typically copes with
accents).
/DeGlyphRecursive
{
        1 dict begin
        /param exch def
        param type /stringtype eq {param}
        {
        param type /nametype eq {param 127 string cvs 0 1 getinterval}
        {
        param type /arraytype eq
        {
                () param {DeGlyphRecursive Concatenate} forall
        }
        {
                (Error: DeGlyphRecursive parameter neither string nor name nor array
) =
                ()
        } ifelse  % arraytype
        } ifelse  % nametype
        } ifelse  % stringtype
        end


 
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.
jdaw1  
View profile  
 More options May 28 2006, 10:52 am
Newsgroups: comp.lang.postscript
From: "jdaw1" <jdawise...@gmail.com>
Date: 28 May 2006 07:52:43 -0700
Local: Sun, May 28 2006 10:52 am
Subject: Re: glyphpath
Thank you again for your help. The latest version of
http://www.jdawiseman.com/papers/trivia/glasses.html is now working.
Share and enjoy.

 
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.
End of messages
« Back to Discussions « Newer topic     Older topic »