On Fri, 2006-10-06 at 10:25 +0100, Peter B. West wrote:
> On Fri, 2006-10-06 at 08:51 +0100, Peter B. West wrote:
> > How are sub- and super-scripts handled by TextMeasurer and TextLayout?
> > My requirement is to use Java2D to perform layout, then to render in,
> > for example, PDF.
> >
> > The first question would be: is sub/super handling performed. Does
> > Java2D rely on the font to handle sub and super?
> >
> First answer - RTFM.
> <q>
> Description
> Requests that the font display the characters with glyphs at a
> particular superscript level: 0 = none, 1 = superscript, 2 = superscript
> of superscript,...-1 = subscript, -2 = subscript of subscript,...
> Requests that the font display text using default superscript (or
> subscript) glyphs and/or scaling.
>
> Fallback
> Use transform with translation of +/-1/2 and scale of 2/3, progressively
> for each level. That is, for the transform at level N (with N != 0):
> offset = sign(N)*1/2*(2/3)^(abs(N)-1)
> scale = (2/3)^abs(N)
> </q>
>
> This creates a problem of predictability. If I cannot find out what the
> layout process actually did, I cannot reproduce it in another rendering
> context.  Hmmm.
>
> Peter

Maybe the reason I didn't spot the above description details is that
they have been removed in the Java6 API docs. So it looks as though the
question stands with respect to Java6. In any case, some guidance here
would be very useful.

The approach I am investigating at the moment is to define my own
SUPERSCRIPT attribute, so that super/sub processing is not performed. I
can then layout the shifted text against its normal baseline, and make
my own calculation as to the impact of the shifted text on the vertical
metrics of the line.

My aim is to rely on Java2D for layout to the greatest extent possible,
but it looks as though this may be one of the situations in which I have
to roll my own.

Peter

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to