Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to code a non-0 baseline

Status
Not open for further replies.

bvahan5

Programmer
Jun 11, 2005
63
RU
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
 
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
 
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

 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top