[comp.lang.postscript] How to center a string with different fonts?

xiaofei@ACSU.BUFFALO.EDU (XiaoFei Wang) (06/18/91)

I know how to center a string.
Now the question is:

Since it is not possible to make a string of
different fonts, how do I center something like
``TlambdaNarrowup'' ? The question comes when I print
a graph lable. OK, this can be done by 
print ``T_N_'' first and then print ``_lambda_arrowup''
where ``_'' denotes space. But then how do you center
``T[sub]lambdaN[sup]arrowup''?

Thanks.

carl@sol1.gps.caltech.edu (Carl J Lydick) (06/19/91)

In article <9106180838.AA21008@autarch.acsu.buffalo.edu>, xiaofei@ACSU.BUFFALO.EDU (XiaoFei Wang) writes:
>I know how to center a string.
>Now the question is:
>
>Since it is not possible to make a string of
>different fonts, how do I center something like
>``TlambdaNarrowup'' ? The question comes when I print
>a graph lable. OK, this can be done by 
>print ``T_N_'' first and then print ``_lambda_arrowup''
>where ``_'' denotes space. But then how do you center
>``T[sub]lambdaN[sup]arrowup''?

You compute bounding boxes for each of the single-font strings, use these to
compute the overall bounding box, and use that information for centering.
--------------------------------------------------------------------------------
Carl J Lydick | INTERnet: CARL@SOL1.GPS.CALTECH.EDU | NSI/HEPnet: SOL1::CARL