Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.postscript > #1642 > unrolled thread
| Started by | buddymash67@gmail.com |
|---|---|
| First post | 2013-09-23 12:58 -0700 |
| Last post | 2013-09-26 00:18 -0700 |
| Articles | 6 — 3 participants |
Back to article view | Back to comp.lang.postscript
Showing text along a path buddymash67@gmail.com - 2013-09-23 12:58 -0700
Re: Showing text along a path luser- -droog <mijoryx@yahoo.com> - 2013-09-23 21:50 -0700
Re: Showing text along a path Mark Carroll <mtbc@bcs.org> - 2013-09-24 09:02 +0100
Re: Showing text along a path luser- -droog <mijoryx@yahoo.com> - 2013-09-24 01:59 -0700
Re: Showing text along a path buddymash67@gmail.com - 2013-09-25 11:49 -0700
Re: Showing text along a path luser- -droog <mijoryx@yahoo.com> - 2013-09-26 00:18 -0700
| From | buddymash67@gmail.com |
|---|---|
| Date | 2013-09-23 12:58 -0700 |
| Subject | Showing text along a path |
| Message-ID | <f759025c-7e4a-42e0-a907-df0f73510733@googlegroups.com> |
Hi, New to the group and have not done any Postscript programming since 1989! I'm experimenting with running text along a path using the following classic example from the Blue Book: http://www.science.uva.nl/~robbert/ps/bluebook/program_11.html I'm trying to figure out how to run the text along the path so that the path is in the middle of the text, not underneath. This is the exercise left to the reader. I'm at a loss on how to do it so could someone help? /Warren
[toc] | [next] | [standalone]
| From | luser- -droog <mijoryx@yahoo.com> |
|---|---|
| Date | 2013-09-23 21:50 -0700 |
| Message-ID | <322836da-5d55-4454-800b-c1d85da13b4d@googlegroups.com> |
| In reply to | #1642 |
On Monday, September 23, 2013 2:58:44 PM UTC-5, buddy...@gmail.com wrote:
> Hi,
>
> New to the group and have not done any Postscript programming since 1989!
>
> I'm experimenting with running text along a path using the following classic example from the Blue Book:
>
> http://www.science.uva.nl/~robbert/ps/bluebook/program_11.html
>
> I'm trying to figure out how to run the text along the path so that the path is in the middle of the text, not underneath. This is the exercise left to the reader. I'm at a loss on how to do it so could someone help?
>
OTOH, you're going to need to be able to determine the height
of a character, whereas for the baseline, you can get by with
just determining widths.
To get the height of a string, do something like:
/Courier 10 selectfont %... must have a font set
(str) false charpath
flattenpath pathbbox % left bottom right top
3 2 roll sub % left right top-bottom
3 1 roll exch sub % top-bottom right-left
exch % width height
[toc] | [prev] | [next] | [standalone]
| From | Mark Carroll <mtbc@bcs.org> |
|---|---|
| Date | 2013-09-24 09:02 +0100 |
| Message-ID | <87ppryprz8.fsf@ixod.org> |
| In reply to | #1644 |
luser- -droog <mijoryx@yahoo.com> writes: > /Courier 10 selectfont %... must have a font set > (str) false charpath > flattenpath pathbbox % left bottom right top > 3 2 roll sub % left right top-bottom > 3 1 roll exch sub % top-bottom right-left > exch % width height Out of curiosity, can you also ask for the font metrics and find out the height without actually processing the path? (It's been a while since I looked at font stuff.) -- Mark
[toc] | [prev] | [next] | [standalone]
| From | luser- -droog <mijoryx@yahoo.com> |
|---|---|
| Date | 2013-09-24 01:59 -0700 |
| Message-ID | <abf9cc9e-f8e3-4c08-9125-d22c0424e79d@googlegroups.com> |
| In reply to | #1645 |
On Tuesday, September 24, 2013 3:02:35 AM UTC-5, Mark Carroll wrote: > luser- -droog <mijoryx@yahoo.com> writes: > > > /Courier 10 selectfont %... must have a font set > > (str) false charpath > > flattenpath pathbbox % left bottom right top > > 3 2 roll sub % left right top-bottom > > 3 1 roll exch sub % top-bottom right-left > > exch % width height > > Out of curiosity, can you also ask for the font metrics and find out the > height without actually processing the path? (It's been a while since I > looked at font stuff.) > I posted some results here: http://stackoverflow.com/a/8302254/733077 One problem with peeking at font structures is the info is likely to vary depending on the font type. Actually executing it will work for any font you are able to use!
[toc] | [prev] | [next] | [standalone]
| From | buddymash67@gmail.com |
|---|---|
| Date | 2013-09-25 11:49 -0700 |
| Message-ID | <532e1fbd-4143-470a-b122-6099a8f75a40@googlegroups.com> |
| In reply to | #1642 |
On Monday, September 23, 2013 8:58:44 PM UTC+1, buddy...@gmail.com wrote: > Hi, > > > > New to the group and have not done any Postscript programming since 1989! > > > > I'm experimenting with running text along a path using the following classic example from the Blue Book: > > http://www.science.uva.nl/~robbert/ps/bluebook/program_11.html > > > > I'm trying to figure out how to run the text along the path so that the path is in the middle of the text, not underneath. This is the exercise left to the reader. I'm at a loss on how to do it so could someone help? > > > > /Warren Many thanks for the replies. I understand the process of getting the font metrics and extracting the height. However, I'm having difficulty figuring out how to drop it into my Blue Book - Program 11 (link above) based example. I've been messing around trying to introduced a fixed offset into the /setchar definition but with no luck. Any suggestions? /W
[toc] | [prev] | [next] | [standalone]
| From | luser- -droog <mijoryx@yahoo.com> |
|---|---|
| Date | 2013-09-26 00:18 -0700 |
| Message-ID | <74c8a2c0-afbd-4c81-8296-27fdb7e19649@googlegroups.com> |
| In reply to | #1650 |
On Wednesday, September 25, 2013 1:49:58 PM UTC-5, buddy...@gmail.com wrote:
> On Monday, September 23, 2013 8:58:44 PM UTC+1, buddy...@gmail.com wrote:
>
> > Hi,
> >
> > New to the group and have not done any Postscript programming since 1989!
> >
> > I'm experimenting with running text along a path using the following classic example from the Blue Book:
> >
> > http://www.science.uva.nl/~robbert/ps/bluebook/program_11.html
> >
> > I'm trying to figure out how to run the text along the path so that the path is in the middle of the text, not underneath. This is the exercise left to the reader. I'm at a loss on how to do it so could someone help?
> >
> > /Warren
>
>
>
> Many thanks for the replies. I understand the process of getting the font metrics and extracting the height. However, I'm having difficulty figuring out how to drop it into my Blue Book - Program 11 (link above) based example. I've been messing around trying to introduced a fixed offset into the /setchar definition but with no luck. Any suggestions?
>
Oh. I completely misunderstood what you were talking about. I thought you were trying to modify the circular arc text program, not the arbitrary-path one. Actually looking at the link (finally), I think you've misunderstood as well. It says to try modifying to place characters by the center of their /width/ only. This is much simpler.
And the code already calculates the width for us. It looks to me like all you need to do is ....SPOILER....
.... SPOILER ....
change this line:
0 0 moveto char show
to something like
charwidth -0.5 mul 0 moveto char show
charwidth .5 mul 0 rmoveto
The extra `rmoveto` is to leave the currentpoint in the same place that the rest of the loop expects.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.postscript
csiph-web