Monica:

These don't do much at present.  The idea is to support writing systems
that
use different baselines, and multiple such writing systems in the same line
of
text.  But at present all lines use the roman baseline no matter what their
text.  Many fonts make this assumption too, so this stuff is anticipating
typographic features that are not currently in widespread use, and may
never
be...

Roman text uses the baseline we're used to thinking of, the one that runs
under
the bottoms of the characters that don't have descenders (like 'g').
Chinese
text uses a centered baseline that runs through the centers of the
characters.
Typically in mixed chinese-roman text this means the bottoms of the chinese
characters are below the baseline of the roman text, for text of the same
point
size.  The center of the chinese text is typically at or near the x-height
(the
tops of the lower-case letters).  The hanging baseline is used for
languages,
like hindi, which generally align at the top.  I'm not sure where these
typically lie with respect to roman text, since hindi has vowels and other
marks that are above this line, it doesn't seem like the line would be at
the
top of the roman text.  It's probably just below it somewhere.

Baselines come from the font.  You can ask a font for the baselines for
some
run of text that it supports.  Fonts can support different sets of
baselines
and offsets for different character ranges, for example, a font that
supports
both roman and chinese text can provide one baseline and set of offsets for
the
roman characters, and another for the chinese characters.  (None does
currently, though.)

Anyway, every line has three baselines.  getBaseline returns the index of
the
'main' baseline for the line, the one most of the text is on.  For example,
for
a paragraph of chinese text, you'd expect getBaseline to return the
centered
baseline.  Ascent, descent, leading, and the baselines returned in
getBaselineOffsets are relative to this baseline.  So if a line returns the
chinese baseline for getBaseline, the corresponding offset returned from
getBaselineOffsets is zero, the hanging baseline is negative, and the roman
baseline is positive (most likely). (Again, this is for illustration, as
the
current implementation uses roman baselines exclusively.)

This main baseline is the one you'd use for aligning the line, for example,
if
you had two columns of text and wanted to align the lines in each column,
you'd
use the baseline returned by getBaseline.  If they're the same, this is
trivial, since you can just use the ascents of each line.  If they're
different, you'd pick one set of baselines as primary and align the other
line
to that.  For example, to align a chinese line and a roman line, using the
roman line as primary, you'd align the chinese baseline of the chinese line
to
the chinese offset of the roman line.  Using the chinese line as primary,
you'd
align the roman baseline of the roman line to the roman offset of the
chinese
line.  This really needs a picture.

When you have different point sizes in text the baseline matters.  For
example.
multiple sizes of chinese text should align all the chinese characters on
the
centered baseline, so they're all centered with respect to each other.
Multiple sizes of roman text align on the roman baseline, so the bases of
the
characters are all the same.  When you have mixed sizes and mixed
baselines,
generally you pick one point size of one writing system and align to that.
So
for a chinese line, you pick one point size of the chinese, and align all
the
other text to that.  Chinese text of all point sizes uses the chinese
baseline,
roman text of all point sizes uses the roman baseline, and so on.

At one point there was a text attribute for setting the baseline and
baseline
offsets on a paragraph.  I'm not sure if it still exists.

The Apple GX documentation has some graphics that illustrate baselines.  It
used to be online in html format, but now it's only available as a large
(5M)
Acrobat file.  If you want to look at it the url is
http://gemma.apple.com/techpubs/mac/GXTypography/GXTypography-2.html.

Doug

Please respond to Monica.Pawlan@Eng.Sun.COM
To: Doug Felt/Cupertino/IBM@ibmus
cc:
Subject: Another Question


getBaseline and getBaselineOffsets are a little unclear to me
It seems like there is more functionality built in that
just simple baseline. What is  a roman, centered, or hanging baseline
and how do they relate to baseline offsets?





