More on. . . Whats new in LuaT EX 0.43 Hartmut Henkel, Oftersheim, - - PowerPoint PPT Presentation

more on what s new in luat ex 0 43
SMART_READER_LITE
LIVE PREVIEW

More on. . . Whats new in LuaT EX 0.43 Hartmut Henkel, Oftersheim, - - PowerPoint PPT Presentation

More on. . . Whats new in LuaT EX 0.43 Hartmut Henkel, Oftersheim, Germany N 49 22 . 275 E 008 35 . 553 EuroT EX 2009, NDC, The Hague, The Netherlands N 52 1 . 762 E 004 21 . 897 Thursday, 3 September 2009,


slide-1
SLIDE 1

More on. . . What’s new in LuaT EX 0.43

Hartmut Henkel, Oftersheim, Germany N 49◦22.275′ E 008◦35.553′ EuroT EX 2009, NDC, The Hague, The Netherlands N 52◦1.762′ E 004◦21.897′ Thursday, 3 September 2009, 09:45

slide-2
SLIDE 2

Overview

◮ What means TRT? — the aleph direction model in LuaT

EX

◮ Global leaders — by LuaT

EX

◮ Using \latelua within \leaders

slide-3
SLIDE 3

Multidirectional Positioning

Lua T EX knows many writing directions (inherited from Omega/aleph)

# Dir Box dir Glyph dir

  • TLT = 010

dir_TL_ = 0 dir__LT = 1 TLL = 011 dir_TL_ = 0 dir__LL = 1 2 TLB = 012 dir_TL_ = 0 dir__LB = 2 3 TLR = 013 dir_TL_ = 0 dir__LR = 3 4 TRT = 030 dir_TR_ = 1 dir__RT = 4 5 TRL = 031 dir_TR_ = 1 dir__RL = 5 6 TRB = 032 dir_TR_ = 1 dir__RB = 6 7 TRR = 033 dir_TR_ = 1 dir__RR = 7 . LTT, LTL, LTB, LTR, LBT, LBL, LBB, LBR, . BLT, BLL, BLB, BLR, BRT, BRL, BRB, BRR, . RTT, RTL, RTB, RTR, RBT, RBL, 30 RBB = 322 dir_RB_ = 7 dir__BB = 14 31 RBR = 323 dir_RB_ = 7 dir__BR = 15

slide-4
SLIDE 4

Multidirectional Positioning

What TLT means. . .

T L T

h d g

pos−tlt1.fig

Next line Line of text \textdir TLT \pardir TLT

slide-5
SLIDE 5

Multidirectional Positioning

What means TRT, anyway?

TLT − →

slide-6
SLIDE 6

Multidirectional Positioning

What means TRT, anyway?

TLT − → ← − TRT

slide-7
SLIDE 7

Multidirectional Positioning

There are in principle also many glyph directions. . .

*LB *RT *RB *RR *RL *TL *BL *BR *TR *TT *TB *BT *BB *LR *LL

fontdir.fig

*LT

. . . but most available fonts are just *LT. LuaT EX uses standard *LT fonts also e. g. for TRT typesetting.

slide-8
SLIDE 8

Multidirectional Positioning

Page offsets in Lua T EX depend on \pagedir — There are new offset parameters

\pageleftoffset \hoffset + 1in \pagetopoffset \voffset + 1in \hoffset + 1in \pageleftoffset \pagebottomoffset \pagerightoffset \pagetopoffset \voffset + 1in

  • ffsets−luatex1.fig

\pagerightoffset \pagebottomoffset LB* BL* LT* TL* RB* BR* RT* TR* \pageheight \pagewidth

  • Pos. origin = page origin

Page border

For most directions \pagewidth and \pageheight are needed as well.

slide-9
SLIDE 9

Multidirectional Positioning

Why \bodydir should match \pagedir. . .

\pageleftoffset \hoffset + 1in \pagetopoffset \voffset + 1in

  • ffsets−luatex2.fig

\pagedir TLT \bodydir TRT Off−Page!

...txeT emoS

  • Pos. origin = page origin

Page border

slide-10
SLIDE 10

Multidirectional Positioning

Available direction setting commands

◮ \pagedir *** ◮ \bodydir *** ◮ \pardir *** ◮ \textdir *** ◮ \mathdir *** ◮ \hbox dir *** {...} ◮ \vbox dir *** {...}

There are also commands for querying directions.

slide-11
SLIDE 11

Multidirectional Positioning

What the output routine sees (simplified) — Node lists. . . Box dimensions (width, height, depth) Width info taken from font

nodes1.fig

"hlist" Node "character" Node "glue" Node Glue spec. (line distance) + Box direction

72 101 108 108 111

H e l l

  • 84

101 88 105 115 33

T e X i e s !

101

slide-12
SLIDE 12

Multidirectional Positioning

Positioning in Original T EX

Two pairs of global position variables (TLT coordinates only):

◮ cur_h, cur_v — where the output routine is ◮ dvi_h, dvi_v — what goes into the DVI file cur_h Some Text 1 in 1 in DVI Origin cur_v

pos−tex1.fig

Page border

Before typesetting some item, dvi_h/v is synchronized to cur_h/v.

slide-13
SLIDE 13

Multidirectional Positioning

New: Local box coordinates, global page coordiates

cur coordinates are local to box, in box coordinate system.

= Page origin

  • Pos. origin

cur.h refpos refpos refpos cur.v RTR box cur.h RTR box RTR page box \pagetopoffset \pagerightoffset pos.v

pos−luatex1.fig

Page border pos.h \pagedir RTR \bodydir RTR

pos coordinates are in output page coordinate system. The output routine keeps track of refpos and calculates pos from (cur.h, cur.v) and local box direction.

slide-14
SLIDE 14

Multidirectional Positioning

News from the Lua T EX back-end

◮ New scaledpos structure (e. g., cur.h, cur.v). ◮ PDF page positioning calculations re-written (new design). ◮ Combined dvi_ship_out() and pdf_ship_out() into one. ◮ Combined dvi_*list_out() and pdf_*list_out() in one. ◮ Switching between DVI and PDF now by function pointers for

back-end (node/whatsit) output functions. − → Multidir positioning in the back-end is same for PDF & DVI.

◮ PDF and DVI positioning behaves identical. ◮ Less code to manage. ◮ Possibility to add other back-ends (e. g., Lua), while keeping

multidir functionality consistent.

slide-15
SLIDE 15

Global Leaders

What are \leaders?

Leaders are . . . . . . . . . . . . . . . . . . . . . this. Leaders are\leaders\hbox to 1em{\hfil.\hfil}\hfil this.

slide-16
SLIDE 16

Global Leaders

What are \leaders?

Leaders are . . . . . . . . . . . . . . . . . . . . . this. Leaders are\leaders\hbox to 1em{\hfil.\hfil}\hfil this.

1 em ... ...

. . . . . . . .

\leaders anchor

. . . . . . . . . . . . . . . . . .

leaders1.fig

. this. Leaders are

\hbox origin \leaders box enclosing \hbox

slide-17
SLIDE 17

Global Leaders

What are \leaders?

Leaders are . . . . . . . . . . . . . . . . . . . . . this. Leaders are\leaders\hbox to 1em{\hfil.\hfil}\hfil this.

1 em ... ...

. . . . . . . .

\leaders anchor

. . . . . . . . . . . . . . . . . .

leaders1.fig

. this. Leaders are

\hbox origin \leaders box enclosing \hbox

In tex82.bug, DEK, 1983:

  • 152. \leaders to align by the smallest enclosing box. (April 1)
slide-18
SLIDE 18

Global Leaders

Where \leaders get difficult. . .

(Contrived) Example: Some table: a . . . . bc . . . . abcde . . fghijklmnop Two cols . . . . . . more text . . . . . . Another line . . . . . . . . . . . . . . . . . with leaders − → \leaders don’t align (different enclosing boxes).

slide-19
SLIDE 19

Global Leaders

Experimental Lua T EX primitive \gleaders — Leaders anchored at the page box

Same example, just replace \leaders by \gleaders: Some table: a . . . bc . . . abcde . fghijklmnop Two cols . . . . . . more text . . . . . . Another line . . . . . . . . . . . . . . . . . with leaders

slide-20
SLIDE 20

Global Leaders

Experimental Lua T EX primitive \gleaders — Leaders anchored at the page box

Same example, just replace \leaders by \gleaders: Some table: a . . . bc . . . abcde . fghijklmnop Two cols . . . . . . more text . . . . . . Another line . . . . . . . . . . . . . . . . . with leaders

1 em ... .

. . . . . . . . . . . . . . . . this. Leaders are

\hbox origin enclosing \hbox Page box

. . . . . . . . .

\gleaders box

gleaders1.fig

...

. . . . .

\gleaders anchor = Page box origin

\gleaders align by the largest enclosing box.

slide-21
SLIDE 21

Global Leaders

Discussion

◮ \gleaders are an experimental primitive in LuaT

EX.

◮ They don’t use any LuaT

EX-exclusive functions.

◮ The \gleaders mechanism could have been in T

EX already.

◮ In LuaT

EX \gleaders work multidir (hopefully).

◮ Useful? Drawbacks? Bugs?

slide-22
SLIDE 22

Leaders and \latelua

Lua T EX opens \latelua to \leaders

Example: \directlua{ rgbrand = function() pdf.print(" " .. math.random() .. " " .. math.random() .. " " .. math.random() .. " " .. " rg " ) end } Colored leaders\leaders \hbox to 2pt{\latelua{rgbrand()}\hfil.\hfil}\hfill \latelua{pdf.print(" 0 g ")}like this.

Colored leaders........................................................................................like this.

slide-23
SLIDE 23

Thank you for your attention!