Hi: WOW! This is very impressive! Thanks for your work.
So I think we can add vertical CJK typesetting feature to LuaTeX/MKIV next year? [Wolfgang is busy writing the wishlist for cjk typesetting, so i think he will be very interested in experimenting your results] Yue Wang On Tue, Dec 30, 2008 at 4:08 PM, Arthur Reutenauer <[email protected]> wrote: >> Can you show me an example of vertical typesetting in LuaTeX? > > Try the attached file. It demonstrates vertical typesetting with LuaTeX in > three steps; unfortunately it only works in DVI mode for the moment > because the PDF output is completely buggy, I discussed with Taco about > that. > > 1. At first, you simply need to switch to vertical directions, using the > primitives inherited from Omega. Here I used LTL as the general direction: > the > first letter indicates the first edge of the page is at the left (lines of > text > move globally from left to right); 'T' means the second edge of the page is at > the top (inside a single line, text moves from the top downwards). The last > letter defines the notion of "top" for individual letters, I chose left, more > or less randomly. It has some influence, as we will see later, but not as > much > as the first two letters. > > Then you can set English text vertically, with the columns running from left > to right. It's akward to use OpenType fonts in DVI mode, so I simply used > Computer Modern Typewriter, stacking the letters on top of each other. Of > course it's weird to set English text vertically without rotating the letters, > but it is possible. There is a problem, though, because the text looks > completely clumsy: the reason is the font's metrics are not designed for > vertical typesetting, so you need to change them. The way metrics work in > Omega's directional model is that width runs along the direction of the line, > here top-to-bottom; hence a glyph's width, in that example, is actually the > sum > of its height and its depth in the original font designed for horizontal > typesetting. Its height and depth, in turn, need to be chosen so that their > sum > is equal to the horizontal width, and I think it's a good choice to make them > equal to each other, so that each glyph is centered on the vertical base line. > > 2. On the second page I demonstrate a first way to do that, with Lua code: > you can use the define_font callback to redefine width, height and depth for > each glyph in the font, and LuaTeX will use these new metrics. > > Note that the vertical width should, actually, be a little bit more than > horizontal height + horizontal depth, because these dimensions are not meant > to > blend well with stacks of letters, unlike the horizontal width: the former are > really more like the dimensions of a bounding box, whereas the latter is the > distance by which you should advance the line of text in order for the text > not > to look to crowded. Thus, I cheated a bit, by stretching the vertical width > by > 30% (chosen, again, at random by trial and error). > > But that's still not enough: as you can see, letters with descender, like 'g' > in the first line, sticks into the next letter. That's because it has a > horizontal depth, and its origin is thus too low with respect to its enclosing > box: we need to raise those letters by their horizontal depth. > > 3. We could do this by editing the font and modify every glyph so that it > sits on the baseline, but we can do better by using virtual fonts. In LuaTeX, > there are two ways to use virtual fonts: you can use a .vf file, or you can > define it with Lua commands in the font data. Unfortunately, the latter > doesn't work in DVI mode because your Lua code is lost once the DVI file is > produced, and your DVI reader / driver doesn't know how to create the font, so > we have to stick to the traditional method and produce a .vf file. I wrote a > small script to that effect which you will find in the attached zip, but the > .vf and .tfm files are also attached anyway. Now the text looks quite nice, > in > my opinion. It's still hard to read, but that's of course because English is > not supposed to be typeset that way. > > The (figurative) bottom line of all this is that you need to typeset vertical > text with fonts that have vertical metrics. Once the problems with PDF mode > are fixed, I can try and do that with Chinese or Japanese fonts; I expect it > would be quite straightforward. > > Arthur > _______________________________________________ dev-luatex mailing list [email protected] http://www.ntg.nl/mailman/listinfo/dev-luatex
