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
<arthur.reutenauer@normalesup.org> wrote:Can you show me an example of vertical typesetting in LuaTeX?Try the attached file. It demonstrates vertical typesetting with LuaTeX inthree steps; unfortunately it only works in DVI mode for the momentbecause the PDF output is completely buggy, I discussed with Taco aboutthat.1. At first, you simply need to switch to vertical directions, using theprimitives inherited from Omega. Here I used LTL as the general direction: thefirst letter indicates the first edge of the page is at the left (lines of textmove globally from left to right); 'T' means the second edge of the page is atthe top (inside a single line, text moves from the top downwards). The lastletter defines the notion of "top" for individual letters, I chose left, moreor less randomly. It has some influence, as we will see later, but not as muchas the first two letters.Then you can set English text vertically, with the columns running from leftto right. It's akward to use OpenType fonts in DVI mode, so I simply usedComputer Modern Typewriter, stacking the letters on top of each other. Ofcourse it's weird to set English text vertically without rotating the letters,but it is possible. There is a problem, though, because the text lookscompletely clumsy: the reason is the font's metrics are not designed forvertical typesetting, so you need to change them. The way metrics work inOmega'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 sumof its height and its depth in the original font designed for horizontaltypesetting. Its height and depth, in turn, need to be chosen so that their sumis equal to the horizontal width, and I think it's a good choice to make themequal 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 foreach glyph in the font, and LuaTeX will use these new metrics.Note that the vertical width should, actually, be a little bit more thanhorizontal height + horizontal depth, because these dimensions are not meant toblend well with stacks of letters, unlike the horizontal width: the former arereally more like the dimensions of a bounding box, whereas the latter is thedistance by which you should advance the line of text in order for the text notto look to crowded. Thus, I cheated a bit, by stretching the vertical width by30% (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 ahorizontal depth, and its origin is thus too low with respect to its enclosingbox: 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 itsits 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 candefine it with Lua commands in the font data. Unfortunately, the latterdoesn't work in DVI mode because your Lua code is lost once the DVI file isproduced, and your DVI reader / driver doesn't know how to create the font, sowe have to stick to the traditional method and produce a .vf file. I wrote asmall 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, inmy opinion. It's still hard to read, but that's of course because English isnot supposed to be typeset that way.The (figurative) bottom line of all this is that you need to typeset verticaltext with fonts that have vertical metrics. Once the problems with PDF modeare fixed, I can try and do that with Chinese or Japanese fonts; I expect itwould be quite straightforward.Arthur_______________________________________________
dev-luatex mailing list
dev-luatex@ntg.nl
http://www.ntg.nl/mailman/listinfo/dev-luatex