Fellow fops,

This is to update you on what I am doing with alt-design layout.

The central Java text layout class is java.awt.font.TextLayout. The following description is edited from the API.
TextLayout is an immutable graphical representation of styled character data.

It provides the following capabilities:

* implicit bidirectional analysis and reordering, (1)
* cursor positioning and movement, including split cursors for mixed directional text,
* highlighting, including both logical and visual highlighting for mixed directional text,
* multiple baselines (roman, hanging, and centered), (2)
* hit testing,
* justification, (3)
* default font substitution, (4)
* metric information such as ascent, descent, and advance, (5) and
* rendering

The aspects of particular interest are numbered.

TextLayouts are graphical objects whose origin is at the intersection between the layout's baseline and its left edge. This is irrespective of the text direction. For the purposes of layout, then, the graphical boxes into which flows are laid out exist in an absolute t-b-l-r context, rather than a relative bpd-ipd one. The upshot of this is that all layout can be performed using the absolute orientation, rather than the relative, and bidi text, e.g., will be have the correct orientation, even though horizontal alignment of line-areas will have to take account of the text direction.

Reference-orientation introduces new considerations, but not as far as the relationship between absolute and relative edges is concerned. The Rec spells out that, '"reference-orientation" is a rotation and does not influence the correspondence mapping.' Rotation can be accommodated by applying an Affine Transform when mapping the content-rectangle of a reference-area into its allocation-rectangle.

The case of vertical writing modes is unclear. Even though java.awt.ComponentOrientation discusses four orientations - LT (left2right, top2bottom, e.g. English), RT (right2left, top2bottom, e.g. Hebrew), TL (top2bottom, left2right, e.g. Mongolian) and TR (top2bottom, right2left, e.g. Japanese), and has isHorizontal() and isLeftToRight() methods, only LEFT_TO_RIGHT and RIGHT_TO_LEFT static fields are defined. When a ComponentOrientation is created for Locale.JAPAN, it returns true for both methods in 1.4.2. It remains to be seem whether vertical mode TextLayouts will have an origin at the intersection of the baseline and the top edge, which I would expect.

These notes are, as I said, to keep you in touch with what I am doing in alt-design, and also to run these ideas past you to see if I am missing anything.

Peter B. West <http://www.powerup.com.au/~pbwest/resume.html>

Reply via email to