[XeTeX] XeTeX vertical text layout support (for Linux & win32 users)
Jonathan Kew
jonathan_kew at sil.org
Sat Jun 17 22:55:04 CEST 2006
On 17 Jun 2006, at 6:25 pm, Jjgod Jiang wrote:
> Hi,
>
> 2006/6/17, Jonathan Kew <jonathan_kew at sil.org>:
>>
>> I've looked over your description briefly, and it's a promising
>> start, but as far as I understand it, there will be more work needed
>> before it's ready to use, and provides equivalent functionality to
>> the "vertical" attribute used with ATSUI fonts on OS X (which would
>> be my goal).
>>
>> It seems to me that your suggested changes so far will allow the
>> "vertical" attribute to be specified for OT fonts, and pass this to
>> xdvipdfmx via the font_def flags; but in addition, the actual layout
>> process in xetex needs to be aware of the vertical flag, and use the
>> vertical rather than horizontal glyph metrics.
>
> Definitely, the solution needs more careful consideration, since I
> don't
> have access to Mac, it's really hard for me to guess how ATSUI does.
> And I'm not fully understand the details in XeTeX's code. I'll be
> happy
> to try if you can point out where/how to change the code..
OK, motivated by your suggestions, I've checked in a patch to
XeTeX_ext.c so that it recognizes the "vertical" option on opentype
fonts, and sets the proper flag in the XDV font_def. (The actual code
is a little different than your suggestion, but as you'll see, it has
the same effect.)
The remaining (and harder) issue is that the actual measurement of
text will ignore this setting, and still use the horizontal metrics.
The ICU layout engine does not currently support vertical layout, or
the application of the opentype 'vert' feature in Han script, so
there's some groundwork to be done before this will actually work
properly. In brief:
- the Han layout engine needs an option to apply the 'vert' feature,
to select alternate glyphs where appropriate
- the font instance needs to return vertical instead of horizontal
glyph metrics, either via the usual APIs used for horizontal layout
(using a font instance created with a "vertical mode" flag), or by
providing a parallel API for vertical metrics, so that the layout
engine can call the appropriate methods according to the mode it's
using.
>> In addition, I'm guessing that xdvipdfmx will have problems if you
>> use the same font in both vertical and horizontal modes, because
>> you're storing the layout direction in the fontmap (in the form of
>> the encoding name), but the fontmap entries are keyed just on the
>> font name -- so the same entry will be used regardless of the writing
>> direction.
>
> Indeed. That's a problem. I'll try to fix it later.
I've also checked in a patch to xdvipdfmx to respect the vertical
flag in the native_font_def. I did this at the pdf_dev_locate_font
level, rather than the fontmap, to avoid the problem mentioned above;
so there's only a single fontmap entry for a font, whether used in H
or V mode or both; but dvi_locate_native_font passes the layout
direction to pdf_dev_locate_font, and it then overrides the Identity-
H mapping name if necessary.
So this is a start; but xetex (in particular, the layoutengine and
fontinstance) needs further work before it'll really be usable.
JK
More information about the XeTeX
mailing list