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


Groups > comp.lang.postscript > #2568

Re: wanted: kcharpath ...

Newsgroups comp.lang.postscript
From Peter Billam <peter@www.pjb.com.au>
Subject Re: wanted: kcharpath ...
References <slrnnjfrfs.2bk.peter@box8.pjb.com.au> <6c745d14-747c-4cda-884d-b86509a3f455@googlegroups.com>
Message-ID <slrnnjirg5.3au.peter@box8.pjb.com.au> (permalink)
Date 2016-05-16 06:51 +0000
Organization Unlimited download news at news.astraweb.com

Show all headers | View raw


On 2016-05-15, luser- -droog <mijoryx@yahoo.com> wrote:
> Here's a first-draft. Remember the proc gets passed the
> previous char and next char, so usually need to `pop pop`.

Ah... indeed.  Thanks :-)
People do always say you have to read the small print...

> Oddly, charpath seems to destroy the currentpoint,
> requiring the extra juggling with stringwidth.
> % proc string bool  .  -
> /kcharpath {
>     {bool str proc}{exch def}forall
>     str length 0 gt {
>         currentpoint
>         str 0 1 getinterval dup 
>             bool charpath
>             stringwidth
>         4 2 roll moveto rmoveto
>         1 1 str length 1 sub { /idx exch def 
>             str idx 1 sub get 
>             str idx get 
>             proc
>             currentpoint
>             str idx 1 getinterval dup 
>                 bool charpath
>                 stringwidth
>             4 2 roll moveto rmoveto
>         } for 
>     } if
> } def 
> /Times-Roman 20 selectfont
> 100 500 moveto
> {pop pop -2 0 rmoveto} (a string) true kcharpath
> stroke

That works very well for me :-)  Neat.
I think I even understand it; once I'd got the
  currentpoint ... stringwidth 4 2 roll moveto rmoveto
it wasn't so scary.

Again: Thanks,
Peter

-- 

Peter Billam    www.pjb.com.au    www.pjb.com.au/comp/contact.html

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


Thread

wanted: kcharpath ... Peter Billam <peter@www.pjb.com.au> - 2016-05-15 03:33 +0000
  Re: wanted: kcharpath ... luser- -droog <mijoryx@yahoo.com> - 2016-05-15 14:16 -0700
    Re: wanted: kcharpath ... Peter Billam <peter@www.pjb.com.au> - 2016-05-16 06:51 +0000
      Re: wanted: kcharpath ... Peter Billam <peter@www.pjb.com.au> - 2016-05-18 02:01 +0000
        Re: wanted: kcharpath ... luser- -droog <mijoryx@yahoo.com> - 2016-05-17 20:41 -0700
          Re: wanted: kcharpath ... luser- -droog <mijoryx@yahoo.com> - 2016-05-17 20:44 -0700
            Re: wanted: kcharpath ... Peter Billam <peter@www.pjb.com.au> - 2016-05-18 06:59 +0000
      Re: wanted: kcharpath ... luser- -droog <mijoryx@yahoo.com> - 2016-05-18 22:29 -0700
  Re: wanted: kcharpath ... Carlos <angus@quovadis.com.ar> - 2016-05-18 23:00 +0200
    Re: wanted: kcharpath ... Peter Billam <peter@www.pjb.com.au> - 2016-05-21 02:09 +0000
      Re: wanted: kcharpath ... Peter Billam <peter@www.pjb.com.au> - 2016-05-21 03:13 +0000
      Re: wanted: kcharpath ... Carlos <angus@quovadis.com.ar> - 2016-05-22 14:20 +0200
        Re: wanted: kcharpath ... Peter Billam <peter@www.pjb.com.au> - 2016-05-29 06:24 +0000
          Re: wanted: kcharpath ... luser- -droog <mijoryx@yahoo.com> - 2016-05-28 23:43 -0700
          Re: wanted: kcharpath ... luser- -droog <mijoryx@yahoo.com> - 2016-05-29 01:10 -0700
            from image to imagemask Peter Billam <peter@www.pjb.com.au> - 2016-05-31 08:51 +0000
              Re: from image to imagemask luser- -droog <mijoryx@yahoo.com> - 2016-06-01 00:53 -0700
                Re: from image to imagemask luser- -droog <mijoryx@yahoo.com> - 2016-06-01 01:10 -0700
                Re: from image to imagemask Peter Billam <peter@www.pjb.com.au> - 2016-06-02 01:26 +0000
                Re: from image to imagemask Peter Billam <peter@www.pjb.com.au> - 2016-06-03 07:53 +0000
          Re: wanted: kcharpath ... Carlos <angus@quovadis.com.ar> - 2016-06-03 14:38 +0200
            Re: wanted: kcharpath ... Peter Billam <peter@www.pjb.com.au> - 2016-06-06 02:43 +0000
              Re: wanted: kcharpath ... Carlos <angus@quovadis.com.ar> - 2016-06-06 07:53 +0200

csiph-web