×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

how to code a non-0 baseline

how to code a non-0 baseline

how to code a non-0 baseline

(OP)
i generate from the code EPS file with 1 line
"Hello World!"

I need a letter "W" to change a baseline by request.
In AI there is a baseline shift, u can move a letter in a line up and down on 1, 2, 3... points

However when i save AI file as EPS it doesn't show anything in a PS code.

Is it possible to code a baseline? or it is internal non-PS-able AI feature?

thx for advices

RE: how to code a non-0 baseline

I can't speak to Adobe Illustrator. In PostScript, everything is programmatically positioned.

There are a lot of variations on the "show" operator, including a version that will make adjustments for particular letters in your string.

I think "widthshow" would work for you:

10 650 moveto 0 -10 87 (Widthshow!) widthshow

The "10 650 moveto" sets the currentpoint, the spot at which the string will begin.

"0 -10" are the x and y offets for a particular character, and "87" is the ASCII code for that target character. In this case, it's "W".

So the "W" will be adjusted 0 additional points in the x dimension, and -10 additional points in the y dimension.

Thomas D. Greer

Providing PostScript & PDF
Training, Development & Consulting

RE: how to code a non-0 baseline

...of course, the code above will LOWER the baseline for all subsequent characters, just to be clear. The point is, there are a number of ways to accomplish this in PostScript, so if AI-produced PostScript isn't doing it, the fault is in AI.

Thomas D. Greer

Providing PostScript & PDF
Training, Development & Consulting

RE: how to code a non-0 baseline

(OP)
thx
it seems to work with a minor corrections

there is an example in the PS reference

50 50 moveto 0 5 8#040 (Wi 123 456) widthshow

040 is written with #
its code of a space char

(btw i didn't understand a sense of 8 before #
PS reference is one of the most unfriendly ref's i have seen)

what does this command is getting upper or lower (+/-) ALL the substring followed a chosen char

in this sample it gets first space upper on 5 points and then continues to type 123 on the same UPPER level, than again one more time prints a 2nd space upper on 5 points (10 points from the baseline) and the rest "456" on the same 10-point level

what i need to do is - to print ONE char only upper and than to return on the baseline
how to do that?

is there a command that returns a current (x, y)?

if yes, than i will use "plus 5 up widthshow" command until the char to be printed upper.. and calculate current (x, y)
and use "minus 5 widthshow" to get back on the baseline for the rest of the line

thx in advance for help

RE: how to code a non-0 baseline

8#000 format is a "radix" number. That is, a number in a particular base, in this case, base-8, or octal. So octal 40 is the same as hex 20, 16#20, or decimal 32. Those are all the same numbers, and represent the ascii code for the "space" character.

The "widthshow" operator is usually used to define extra horizontal spacing between words. For example, to perform justification by padding extra space after each "space" character (or, conversely, subtracting it).

To return the current xy, use "currentpoint".

For your example, I would use "search". It returns three substrings, if the search is sucessful: post, match, pre. If the search fails, it will return the original string.

So something like this:

CODE

%!PS

% show the capital "W" 2 points higher

/myString (This Should Work) def

/x 72 def
/y 600 def

/Courier 24 selectfont

myString (W) search
{
  x y moveto show
  currentpoint 2 add moveto show
  currentpoint 2 sub moveto show
}
{
  x y moveto show
} ifelse

showpage

To code for all capital W's, you'll need to incorporate "search" into a loop:

CODE

%!PS

% show the capital "W" 2 points higher

/myString (This Should Work As Well!) def

/x 72 def
/y 600 def

/Courier 24 selectfont
myString
{
  (W) search
  {
    x y moveto show
    currentpoint 2 add moveto show
    currentpoint 2 sub
    /y exch def
    /x exch def
  }
  {
    x y moveto show
    exit
  } ifelse
} loop

showpage

None of the above code has been tested, it's all written "off-the-cuff", but looks right!

Thomas D. Greer

Providing PostScript & PDF
Training, Development & Consulting

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close