[Dev-luatex] Modifying the LuaTeX Engine

Yannis Haralambous yannis.haralambous at telecom-bretagne.eu
Tue Dec 30 20:06:57 CET 2008


Since you are interested in vertical typesetting by Omega, here are  
ten pages from a book published in Greece: the translation of 90 haiku  
poems. The name of the author is written in Japanese with furigana.

The book is: <http://www.bibliopolio.gr/ιαπωνικά-ποιήματα-p-95636.html?osCsid=6971e3a0dbd790ac 
8014e83491cf4c11> (ISBN 960-7360-60-5)

Le 30 déc. 08 à 18:57, Yue Wang a écrit :

> 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 at normalesup.org> 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
> dev-luatex at ntg.nl
> http://www.ntg.nl/mailman/listinfo/dev-luatex
>

--
+ 
-----------------------------------------------------------------------+
| Yannis Haralambous, Ph.D.      yannis.haralambous at telecom- 
bretagne.eu |
| Directeur d'Études                      http://omega.enstb.org/ 
yannis |
|                                             Tel. +33  
(0)2.29.00.14.27 |
|                                             Fax  +33  
(0)2.29.00.12.82 |
| Département  
Informatique                                              |
| TELECOM  
Bretagne                                                      |
| Technopôle de Brest Iroise, CS 83818, 29238 Brest CEDEX 3,  
France     |
| Coordonnées Google-Earth : 48°21'31.57"N  
4°34'16.76"W                 |
+ 
-----------------------------------------------------------------------+
                             ...pour distinguer l'extérieur d'un  
aquarium,
                                            mieux vaut n'être pas  
poisson

                            ...the ball I threw while playing in the  
park
                                           has not yet reached the  
ground

               Es gab eine Zeit, wo ich nur ungern über Schubert  
sprechen,
            nur Nächtens den Bäumen und Sternen von ihm vorerzählen  
mögen.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ntg.nl/mailman/private/dev-luatex/attachments/20081230/feca0a8f/attachment-0003.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: haiku.pdf
Type: application/pdf
Size: 119393 bytes
Desc: not available
URL: <http://www.ntg.nl/mailman/private/dev-luatex/attachments/20081230/feca0a8f/attachment-0001.pdf>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ntg.nl/mailman/private/dev-luatex/attachments/20081230/feca0a8f/attachment-0004.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Yannis Haralambous.vcf
Type: text/directory
Size: 508 bytes
Desc: not available
URL: <http://www.ntg.nl/mailman/private/dev-luatex/attachments/20081230/feca0a8f/attachment-0001.bin>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ntg.nl/mailman/private/dev-luatex/attachments/20081230/feca0a8f/attachment-0005.html>


More information about the dev-luatex mailing list