beta-0.89.2
[luatex.git] / manual / luatex-modifications.tex
blobf0bbe2a260d68eda463d4bc652910c180dfecc13
1 \environment luatex-style
2 \environment luatex-logos
4 \startcomponent luatex-modifications
6 \startchapter[reference=modifications,title={Modifications}]
8 \startsection[title=The merged engines]
10 \startsubsection[title=The need for change]
12 The first version of \LUATEX\ only had a few extra primitives and it was largely
13 the same as \PDFTEX. Then we merged substantial parts of \ALEPH\ into the code
14 and got more primitives. When we got more stable teh decision was made to clean
15 up the rather hybrid nature of the program. This means that some primnitives have
16 been promoted to core primitives, often with a different name, and that others
17 were removed. This made it possible to start cleaning up the code base. We will
18 describe most in following paragraphs.
20 Besides the expected changes caused by new functionality, there are a number of
21 not|-|so|-|expected changes. These are sometimes a side|-|effect of a new
22 (conflicting) feature, or, more often than not, a change neccessary to clean up
23 the internal interfaces. These will also be mentioned.
25 \stopsubsection
27 \startsubsection[title=Changes from \TEX\ 3.1415926]
29 Of course it all starts with traditional \TEX. Even if we started with \PDFTEX,
30 most still comes from the original. But we divert a bit.
32 \startitemize
34 \startitem
35 The current code base is written in \CCODE, not \PASCAL. We use \CWEB\
36 when possible.
37 \stopitem
39 \startitem
40 See \in {chapter} [languages] for many small changes related to paragraph
41 building, language handling and hyphenation. The most important change is
42 that adding a brace group in the middle of a word (like in \type {of{}fice})
43 does not prevent ligature creation.
44 \stopitem
46 \startitem
47 There is no pool file, all strings are embedded during compilation.
48 \stopitem
50 \startitem
51 The specifier \type {plus 1 fillll} does not generate an error. The extra
52 \quote{l} is simply typeset.
53 \stopitem
55 \startitem
56 The upper limit to \type {\endlinechar} and \type {\newlinechar} is 127.
57 \stopitem
59 \startitem
60 The hz optimization code has been partially redone so that we no longer need
61 to create extra font instances. The front- and backend have been decoupled and
62 more efficient (\PDF) code is generated.
63 \stopitem
65 \stopitemize
67 \stopsubsection
69 \startsubsection[title=Changes from \ETEX\ 2.2]
71 Being the de factor standard extension of course we provide the \ETEX\
72 functionality, but with a few small adaptions.
74 \startitemize
76 \startitem
77 The \ETEX\ functionality is always present and enabled so the prepended
78 asterisk or \type {-etex} switch for \INITEX\ is not needed.
79 \stopitem
81 \startitem
82 The \TEXXET\ extension is not present, so the primitives \type
83 {\TeXXeTstate}, \type {\beginR}, \type {\beginL}, \type {\endR} and \type
84 {\endL} are missing.
85 \stopitem
87 \startitem
88 Some of the tracing information that is output by \ETEX's \type
89 {\tracingassigns} and \type {\tracingrestores} is not there.
90 \stopitem
92 \startitem
93 Register management in \LUATEX\ uses the \ALEPH\ model, so the maximum value
94 is 65535 and the implementation uses a flat array instead of the mixed
95 flat|\&|sparse model from \ETEX.
96 \stopitem
98 \startitem
99 When kpathsea is used to find files, \LUATEX\ uses the \type {ofm} file
100 format to search for font metrics. In turn, this means that \LUATEX\ looks at
101 the \type {OFMFONTS} configuration variable (like \OMEGA\ and \ALEPH) instead
102 of \type {TFMFONTS} (like \TEX\ and \PDFTEX). Likewise for virtual fonts
103 (\LUATEX\ uses the variable \type {OVFFONTS} instead of \type {VFFONTS}).
104 \stopitem
106 \stopitemize
108 \stopsubsection
110 \startsubsection[title=Changes from \PDFTEX\ 1.40]
112 Because we want to produce \PDF\ the most natural starting point was the popular
113 \PDFTEX\ program. We inherit the stable features, dropped most of the
114 experimental code and promoted some functionality to core \LUATEX\ functionality
115 which in turn triggered renaming primitives.
117 \startitemize
119 \startitem
120 The (experimental) support for snap nodes has been removed, because it is
121 much more natural to build this functionality on top of node processing and
122 attributes. The associated primitives that are now gone are: \type
123 {\pdfsnaprefpoint}, \type {\pdfsnapy}, and \type {\pdfsnapycomp}.
124 \stopitem
126 \startitem
127 The (experimental) support for specialized spacing around nodes has also been
128 removed. The associated primitives that are now gone are: \type
129 {\pdfadjustinterwordglue}, \type {\pdfprependkern}, and \type {\pdfappendkern}, as
130 well as the five supporting primitives \type {\knbscode}, \type {\stbscode}, \type
131 {\shbscode}, \type {\knbccode}, and \type {\knaccode}.
132 \stopitem
134 \startitem
135 A number of \quote {pdftex primitives} have been removed as they can be
136 implemented using \LUA:
138 \start \raggedright
139 \type {\pdfelapsedtime}, \type {\pdfescapehex}, \type {\pdfescapename}, \type
140 {\pdfescapestring}, \type {\pdffiledump}, \type {\pdffilemoddate}, \type
141 {\pdffilesize}, \type {\pdfforcepagebox}, \type {\pdflastmatch}, \type
142 {\pdfmatch}, \type {\pdfmdfivesum}, \type {\pdfmovechars}, \type
143 {\pdfoptionalwaysusepdfpagebox}, \type {\pdfoptionpdfinclusionerrorlevel},
144 \type {\pdfresettimer}, \type {\pdfshellescape}, \type {\pdfstrcmp} and \type
145 {\pdfunescapehex}
146 \par \stop
147 \stopitem
149 \startitem
150 The version related primitives \type {\pdftexbanner}, \type {\pdftexversion}
151 and \type {\pdftexrevision} are no longer present as there is no longer a
152 strict relationship with \PDFTEX\ development.
153 \stopitem
155 \startitem
156 The experimental snapper mechanism has been removed and therefore also the
157 primitives:
159 \start \raggedright
160 \type {\pdfignoreddimen}, \type {\pdffirstlineheight}, \type
161 {\pdfeachlineheight}, \type {\pdfeachlinedepth} and \type
162 {\pdflastlinedepth}
163 \par \stop
164 \stopitem
166 \startitem
167 The experimental primitives \type {\primitive}, \type {\ifprimitive}, \type
168 {\ifabsnum} and \type {\ifabsdim} are promoted to core primitives. The \type
169 {\pdf*} prefixed originals are not available.
170 \stopitem
172 \startitem
173 The \PNG\ transparency fix from 1.40.6 is not applied as high|-|level
174 support is pending.
175 \stopitem
177 \startitem
178 Two extra token lists are provides, \type {\pdfxformresources} and \type
179 {\pdfxformattr}, as an alternative to \type {\pdfxform} keywords.
180 \stopitem
182 \startitem
183 The current version of \LUATEX\ no longer replaces and|/|or merges fonts in
184 embedded pdf files with fonts of the enveloping \PDF\ document. This
185 regression may be temporary, depending on how the rewritten font backend will
186 look like.
187 \stopitem
189 \startitem
190 The primitives \type {\pdfpagewidth} and \type {\pdfpageheight} have been removed
191 because \type {\pagewidth} and \type {\pageheight} have that purpose.
192 \stopitem
194 \startitem
195 The primitives \type {\pdfnormaldeviate}, \type {\pdfuniformdeviate}, \type
196 {\pdfsetrandomseed} and \type {\pdfrandomseed} have been promoted to core
197 primitives without \type {pdf} prefix so the original commands are no longer
198 recognized.
199 \stopitem
201 \startitem
202 The primitives \type {\ifincsname}, \type {\expanded} and \type {\quitvmode} are now
203 core primitives.
204 \stopitem
206 \startitem
207 As the hz and protrusion mechanism are part of the core the related
208 primitives \type {\lpcode}, \type {\rpcode}, \type {\efcode}, \type
209 {\leftmarginkern}, \type {\rightmarginkern} are promoted to core primitives. The
210 two commands \type {\protrudechars} and \type {\adjustspacing} replace their
211 prefixed with \type {\pdf} originals.
212 \stopitem
214 \startitem
215 When \type {\adjustspacing} has value~2, hz optimization will be applied to
216 glyphs and kerns. When the valus is~3, only glyphs will be treated. A value
217 smaller than~2 disables this feature.
218 \stopitem
220 \startitem
221 The \type {\tagcode} primitive is promoted to core primitive.
222 \stopitem
224 \startitem
225 The \type {\letterspacefont} feature is now part of the core but will not be
226 changed (improved). We just provide it for legacy use.
227 \stopitem
229 \startitem
230 The \type {\pdfnoligatures} primitive is now \type {\ignoreligaturesinfont}.
231 \stopitem
233 \startitem
234 The \type {\pdfcopyfont} primitive is now \type {\copyfont}.
235 \stopitem
237 \startitem
238 The \type {\pdffontexpand} primitive is now \type {\expandglyphsinfont}.
239 \stopitem
241 \startitem
242 Because position tracking is also available in \DVI\ mode the
243 \type {\savepos}, \type {\lastxpos} and \type {\lastypos} commands now
244 replace their \type {pdf} prefixed originals.
245 \stopitem
247 \startitem
248 The introspective primitives \type {\pdflastximagecolordepth} and \type
249 {\pdfximagebbox} have been removed. One can use external applications to
250 determine these properties or use the built|-|in \type {img} library.
251 \stopitem
253 \startitem
254 The initializers \type {\pdfoutput} has been replaced by \type {\outputmode} and
255 \type {\pdfdraftmode} is now \type {\draftmode}.
256 \stopitem
258 \startitem
259 The pixel multiplier dimension \type {\pdfpxdimen} lots its prefix and is now calles
260 \type {\pxdimen}.
261 \stopitem
263 \startitem
264 An extra \type {\pdfimageaddfilename} option has been added that can be used to block
265 writing the filename to the \PDF\ file.
266 \stopitem
268 \stopitemize
270 One change involves the so called xforms and ximages. In \PDFTEX\ these are
271 implemented as so called whatsits. But contrary to other whatsits they have
272 dimensions that need to be taken into account when for instance calculating
273 optimal linebreaks. In \LUATEX\ these are now promoted to normal nodes, which
274 simplifies code that needs those dimensions.
276 Another reason for promotion is that these are useful concepts. Backends can
277 provide the ability to use content that has been rendered in several places,
278 and images are also common. For that reason we also changed the names:
280 \starttabulate[|l|l|]
281 \NC \bf new name \NC \bf old name \NC \NR
282 \NC \type {\saveboxresource} \NC \type {\pdfxform} \NC \NR
283 \NC \type {\saveimageresource} \NC \type {\pdfximage} \NC \NR
284 \NC \type {\useboxresource} \NC \type {\pdfrefxform} \NC \NR
285 \NC \type {\useimageresource} \NC \type {\pdfrefximage} \NC \NR
286 \NC \type {\lastsavedboxresourceindex} \NC \type {\pdflastxform} \NC \NR
287 \NC \type {\lastsavedimageresourceindex} \NC \type {\pdflastximage} \NC \NR
288 \NC \type {\lastsavedimageresourcepages} \NC \type {\pdflastximagepages} \NC \NR
289 \stoptabulate
291 There are a few \type {\pdf...} primitives that relate to this but these are
292 typical backend specific ones. The index that gets returned is to be considered
293 as \quote {just a number} and although it still has the same meaning (object
294 related) as before, you should not depend on that.
296 \stopsubsection
298 \startsubsection[title=Changes from \ALEPH\ RC4]
300 Because we wanted proper directional typesetting the \ALEPH\ mechanisms looked
301 most attractive. These are rather close to the ones provided by \OMEGA, so what
302 we say next applies to both these programs.
304 \startitemize
306 \startitem
307 The extended 16-bit math primitives (\type {\omathcode} etc.) have been
308 removed.
309 \stopitem
311 \startitem
312 The \OCP\ processing is no longer supported at all. As a consequence, the
313 following primitives have been removed:
315 \start \raggedright
316 \type {\ocp}, \type {\externalocp}, \type {\ocplist}, \type {\pushocplist},
317 \type {\popocplist}, \type {\clearocplists}, \type {\addbeforeocplist}, \type
318 {\addafterocplist}, \type {\removebeforeocplist}, \type {\removeafterocplist}
319 and \type {\ocptracelevel}
320 \par \stop
321 \stopitem
323 \startitem
324 \LUATEX\ only understands 4~of the 16~direction specifiers of \ALEPH: \type
325 {TLT} (latin), \type {TRT} (arabic), \type {RTT} (cjk), \type {LTL}
326 (mongolian). All other direction specifiers generate an error.
327 \stopitem
329 \startitem
330 The input translations from \ALEPH\ are not implemented, the related
331 primitives are not available:
333 \start \raggedright
334 \type {\DefaultInputMode}, \type {\noDefaultInputMode}, \type {\noInputMode},
335 \type {\InputMode}, \type {\DefaultOutputMode}, \type {\noDefaultOutputMode},
336 \type {\noOutputMode}, \type {\OutputMode}, \type {\DefaultInputTranslation},
337 \type {\noDefaultInputTranslation}, \type {\noInputTranslation}, \type
338 {\InputTranslation}, \type {\DefaultOutputTranslation}, \type
339 {\noDefaultOutputTranslation}, \type {\noOutputTranslation} and \type
340 {\OutputTranslation}
341 \par \stop
342 \stopitem
344 \startitem
345 Several bugs have been fixed. The \type {\hoffset} bug when \type {\pagedir TRT}
346 is gone, removing the need for an explicit fix to \type {\hoffset}. Also bug
347 causing \type {\fam} to fail for family numbers above 15 is fixed. A fair amount
348 of other minor bugs are fixed as well, most of these related to \type
349 {\tracingcommands} output.
350 \stopitem
352 \startitem
353 The scanner for direction specifications now allows an optional space after
354 the direction is completely parsed.
355 \stopitem
357 \startitem
358 The \type {^^} notation has been extended: after \type {^^^^} four hexadecimal
359 characters are expected and after \type {^^^^^^} six hexadecimal characters
360 have to be given. The original \TEX\ interpretation is still valid for the
361 \type {^^} case but the four and six variants do no backtracking, i.e.\ when
362 they are not followed by the right number of hexadecimal digits they issue an
363 error message. Because \type{^^^} is a normal \TEX\ case, we don't support the
364 odd number of \type {^^^^^} either.
365 \stopitem
367 \startitem
368 Glues {\it immediately after} direction change commands are not legal
369 breakpoints.
370 \stopitem
372 \startitem
373 Several mechanisms that need to be right|-|to|-|left aware have been
374 improved. For instance placement of formula numbers.
375 \stopitem
377 \startitem
378 The page dimension related primitives \type {\pagewidth} and \type
379 {\pageheight} have been promoted to core primitives.
380 \stopitem
382 \startitem
383 The primitives \type {\charwd}, \type {\charht}, \type {\chardp} and \type
384 {\charit} have been removes as we have the \ETEX\ variants \type
385 {\fontchar*}.
386 \stopitem
388 \startitem
389 The two dimension registers \type {\pagerightoffset} and \type
390 {\pagebottomoffset} are now core primitives.
391 \stopitem
393 \startitem
394 The direction related primitives \type {\pagedir}, \type {\bodydir}, \type
395 {\pardir}, \type {\textdir}, \type {\mathdir} and \type {\boxdir} are now
396 core primitives.
397 \stopitem
399 \startitem
400 The primitive \type {\pdftracingfonts} is now \type {\tracingfonts} as it
401 doesn't relate to the backend.
402 \stopitem
404 \startitem
405 The experimental primitive \type {\pdfinsertht} is kept as \type {\insertht}.
406 \stopitem
408 \startitem
409 The promotion of primitives to core primitives as well as the removed of all
410 others mean that the initialization namespace \type {aleph} is gone.
411 \stopitem
413 \stopitemize
415 \stopsubsection
417 \startsubsection[title=Changes from standard \WEBC]
419 The compilation framework is \WEBC\ and we keep using that but without the
420 \PASCAL\ to \CCODE\ step. This framework also provides some common features that
421 deal with reading bytes from files and locating files in \TDS. This is what we do
422 different:
424 \startitemize
426 \startitem
427 There is no mltex support.
428 \stopitem
430 \startitem
431 There is no enctex support.
432 \stopitem
434 \startitem
435 The following commandline switches are silently ignored, even in non|-|\LUA\
436 mode: \type {-8bit}, \type {-translate-file}, \type {-mltex}, \type {-enc}
437 and \type {-etex}.
438 \stopitem
440 \startitem
441 The \type {\openout} whatsits are not written to the log file.
442 \stopitem
444 \startitem
445 Some of the so|-|called web2c extensions are hard to set up in non|-|\KPSE\
446 mode because \type {texmf.cnf} is not read: \type {shell-escape} is off (but
447 that is not a problem because of \LUA's \type {os.execute}), and the paranoia
448 checks on \type {openin} and \type {openout} do not happen (however, it is
449 easy for a \LUA\ script to do this itself by overloading \type {io.open}).
450 \stopitem
452 \startitem
453 The \quote{E} option does not do anything useful.
454 \stopitem
456 \stopitemize
458 \stopsubsection
460 \startsubsection[title=The backend primitives \type {\pdf*}]
462 In a previous section we mentioned that some \PDFTEX\ primitives were removed and
463 others promoted to core \LUATEX\ primitives. That is only part of the story. In
464 order to separate the backend specific primitives in de code these commands are
465 now replaced by only a few. In traditional \TEX\ we only had the \DVI\ backend
466 but now we have two: \DVI\ and \PDF. Additional functionality is implemented as
467 \quote {extensions} in \TEX speak. By seperating more strickly we are able to
468 keep the core (fontend) clean and stable. If for some reason an extra backend
469 option is needed, it can be implemented without touching the core. The three
470 \PDF\ backend related primitives are
472 \starttyping
473 \pdfextension command [specification]
474 \pdfvariable name
475 \pdffeedback name
476 \stoptyping
478 An extension triggers further parsing, depending on the command given. A variable is
479 a (kind of) register and can be read and written, while a feedback is reporting
480 something (as it comes from the backend it's normally a sequence of tokens).
482 In order for \LUATEX\ to be more than just \TEX\ you need to enable primitives. That
483 has already be the case right from the start. If you want the traditional \PDFTEX\
484 primitives (for as far their functionality is still around) you now can do this:
486 \starttyping
487 \protected\def\pdfliteral {\pdfextension literal}
488 \protected\def\pdfcolorstack {\pdfextension colorstack}
489 \protected\def\pdfsetmatrix {\pdfextension setmatrix}
490 \protected\def\pdfsave {\pdfextension save\relax}
491 \protected\def\pdfrestore {\pdfextension restore\relax}
492 \protected\def\pdfobj {\pdfextension obj }
493 \protected\def\pdfrefobj {\pdfextension refobj }
494 \protected\def\pdfannot {\pdfextension annot }
495 \protected\def\pdfstartlink {\pdfextension startlink }
496 \protected\def\pdfendlink {\pdfextension endlink\relax}
497 \protected\def\pdfoutline {\pdfextension outline }
498 \protected\def\pdfdest {\pdfextension dest }
499 \protected\def\pdfthread {\pdfextension thread }
500 \protected\def\pdfstartthread {\pdfextension startthread }
501 \protected\def\pdfendthread {\pdfextension endthread\relax}
502 \protected\def\pdfinfo {\pdfextension info }
503 \protected\def\pdfcatalog {\pdfextension catalog }
504 \protected\def\pdfnames {\pdfextension names }
505 \protected\def\pdfincludechars {\pdfextension includechars }
506 \protected\def\pdffontattr {\pdfextension fontattr }
507 \protected\def\pdfmapfile {\pdfextension mapfile }
508 \protected\def\pdfmapline {\pdfextension mapline }
509 \protected\def\pdftrailer {\pdfextension trailer }
510 \protected\def\pdfglyphtounicode{\pdfextension glyphtounicode }
511 \stoptyping
513 The introspective primitives can bve defines as:
515 \starttyping
516 \def\pdftexversion {\numexpr\pdffeedback version\relax}
517 \def\pdftexrevision {\pdffeedback revision}
518 \def\pdflastlink {\numexpr\pdffeedback lastlink\relax}
519 \def\pdfretval {\numexpr\pdffeedback retval\relax}
520 \def\pdflastobj {\numexpr\pdffeedback lastobj\relax}
521 \def\pdflastannot {\numexpr\pdffeedback lastannot\relax}
522 \def\pdfxformname {\numexpr\pdffeedback xformname\relax}
523 \def\pdfcreationdate {\pdffeedback creationdate}
524 \def\pdffontname {\numexpr\pdffeedback fontname\relax}
525 \def\pdffontobjnum {\numexpr\pdffeedback fontobjnum\relax}
526 \def\pdffontsize {\dimexpr\pdffeedback fontsize\relax}
527 \def\pdfpageref {\numexpr\pdffeedback pageref\relax}
528 \def\pdfcolorstackinit {\pdffeedback colorstackinit}
529 \stoptyping
531 The configuration related registers have become:
533 \starttyping
534 \edef\pdfcompresslevel {\pdfvariable compresslevel}
535 \edef\pdfobjcompresslevel {\pdfvariable objcompresslevel}
536 \edef\pdfdecimaldigits {\pdfvariable decimaldigits}
537 \edef\pdfgamma {\pdfvariable gamma}
538 \edef\pdfimageresolution {\pdfvariable imageresolution}
539 \edef\pdfimageapplygamma {\pdfvariable imageapplygamma}
540 \edef\pdfimagegamma {\pdfvariable imagegamma}
541 \edef\pdfimagehicolor {\pdfvariable imagehicolor}
542 \edef\pdfimageaddfilename {\pdfvariable imageaddfilename}
543 \edef\pdfpkresolution {\pdfvariable pkresolution}
544 \edef\pdfpkfixeddpi {\pdfvariable pkfixeddpi}
545 \edef\pdfinclusioncopyfonts {\pdfvariable inclusioncopyfonts}
546 \edef\pdfinclusionerrorlevel {\pdfvariable inclusionerrorlevel}
547 \edef\pdfignoreunknownimages {\pdfvariable ignoreunknownimages}
548 \edef\pdfgentounicode {\pdfvariable gentounicode}
549 \edef\pdfpagebox {\pdfvariable pagebox}
550 \edef\pdfminorversion {\pdfvariable minorversion}
551 \edef\pdfuniqueresname {\pdfvariable uniqueresname}
553 \edef\pdfhorigin {\pdfvariable horigin}
554 \edef\pdfvorigin {\pdfvariable vorigin}
555 \edef\pdflinkmargin {\pdfvariable linkmargin}
556 \edef\pdfdestmargin {\pdfvariable destmargin}
557 \edef\pdfthreadmargin {\pdfvariable threadmargin}
558 \edef\pdfxformmargin {\pdfvariable xformmargin}
560 \edef\pdfpagesattr {\pdfvariable pagesattr}
561 \edef\pdfpageattr {\pdfvariable pageattr}
562 \edef\pdfpageresources {\pdfvariable pageresources}
563 \edef\pdfxformattr {\pdfvariable xformattr}
564 \edef\pdfxformresources {\pdfvariable xformresources}
565 \edef\pdfpkmode {\pdfvariable pkmode}
566 \stoptyping
568 The variables are internal ones, so they are anonymous. When you ask for the
569 meaning of a few previously defined ones:
571 \starttyping
572 \meaning\pdfhorigin
573 \meaning\pdfcompresslevel
574 \meaning\pdfpageattr
575 \stoptyping
577 you will get:
579 \starttyping
580 macro:->[internal backend dimension]
581 macro:->[internal backend integer]
582 macro:->[internal backend tokenlist]
583 \stoptyping
585 The \type {\edef} can also be an \type {\def} but it's a bit more efficient
586 to expand the lookup related register beforehand. After that you can adapt
587 the defaults; these are:
589 \starttyping
590 \pdfcompresslevel 9
591 \pdfobjcompresslevel 1 % used: (0,9)
592 \pdfdecimaldigits 4 % used: (3,6)
593 \pdfgamma 1000
594 \pdfimageresolution 71
595 \pdfimageapplygamma 0
596 \pdfimagegamma 2200
597 \pdfimagehicolor 1
598 \pdfimageaddfilename 1
599 \pdfpkresolution 72
600 \pdfpkfixeddpi 0
601 \pdfinclusioncopyfonts 0
602 \pdfinclusionerrorlevel 0
603 \pdfignoreunknownimages 0
604 \pdfgentounicode 0
605 \pdfpagebox 0
606 \pdfminorversion 4
607 \pdfuniqueresname 0
609 \pdfhorigin 1in
610 \pdfvorigin 1in
611 \pdflinkmargin 0pt
612 \pdfdestmargin 0pt
613 \pdfthreadmargin 0pt
614 \pdfxformmargin 0pt
615 \stoptyping
617 If you also want some backward compatibility, you can add:
619 \starttyping
620 \let\pdfpagewidth \pagewidth
621 \let\pdfpageheight \pageheight
623 \let\pdfadjustspacing \adjustspacing
624 \let\pdfprotrudechars \protrudechars
625 \let\pdfnoligatures \ignoreligaturesinfont
626 \let\pdffontexpand \expandglyphsinfont
627 \let\pdfcopyfont \copyfont
629 \let\pdfxform \saveboxresource
630 \let\pdflastxform \lastsavedboxresourceindex
631 \let\pdfrefxform \useboxresource
633 \let\pdfximage \saveimageresource
634 \let\pdflastximage \lastsavedimageresourceindex
635 \let\pdflastximagepages\lastsavedimageresourcepages
636 \let\pdfrefximage \useimageresource
638 \let\pdfsavepos \savepos
639 \let\pdflastxpos \lastxpos
640 \let\pdflastypos \lastypos
642 \let\pdfoutput \outputmode
643 \let\pdfdraftmode \draftmode
645 \let\pdfpxdimen \pxdimen
647 \let\pdfinsertht \insertht
649 \let\pdfnormaldeviate \normaldeviate
650 \let\pdfuniformdeviate \uniformdeviate
651 \let\pdfsetrandomseed \setrandomseed
652 \let\pdfrandomseed \randomseed
654 \let\pdfprimitive \primitive
655 \let\ifpdfprimitive \ifprimitive
657 \let\ifpdfabsnum \ifabsnum
658 \let\ifpdfabsdim \ifabsdim
659 \stoptyping
661 And even:
663 \starttyping
664 \newdimen\pdfeachlineheight
665 \newdimen\pdfeachlinedepth
666 \newdimen\pdflastlinedepth
667 \newdimen\pdffirstlineheight
668 \newdimen\pdfignoreddimen
669 \stoptyping
671 The backend is derived from \PDFTEX\ so the same syntax applies. However, the
672 \type {outline} command accepts a \type {objnum} followed by a number. No
673 checking takes place so when this is used it had better be a valid (flushed)
674 object.
676 \stopsubsection
678 \stopsection
680 \startsection[title=Implementation notes]
682 \startsubsection[title=Memory allocation]
684 The single internal memory heap that traditional \TEX\ used for tokens and nodes
685 is split into two separate arrays. Each of these will grow dynamically when
686 needed.
688 The \type {texmf.cnf} settings related to main memory are no longer used (these
689 are: \type {main_memory}, \type {mem_bot}, \type {extra_mem_top} and \type
690 {extra_mem_bot}). \quote {Out of main memory} errors can still occur, but the
691 limiting factor is now the amount of RAM in your system, not a predefined limit.
693 Also, the memory (de)allocation routines for nodes are completely rewritten. The
694 relevant code now lives in the C file \type {texnode.c}, and basically uses a
695 dozen or so \quote {avail} lists instead of a doubly|-|linked model. An extra
696 function layer is added so that the code can ask for nodes by type instead of
697 directly requisitioning a certain amount of memory words.
699 Because of the split into two arrays and the resulting differences in the data
700 structures, some of the macros have been duplicated. For instance, there are now
701 \type {vlink} and \type {vinfo} as well as \type {token_link} and \type
702 {token_info}. All access to the variable memory array is now hidden behind a
703 macro called \type {vmem}.
705 The implementation of the growth of two arrays (via reallocation) introduces a
706 potential pitfall: the memory arrays should never be used as the left hand side
707 of a statement that can modify the array in question.
709 The input line buffer and pool size are now also reallocated when needed, and the
710 \type {texmf.cnf} settings \type {buf_size} and \type {pool_size} are silently
711 ignored.
713 \stopsubsection
715 \startsubsection[title=Sparse arrays]
717 The \type {\mathcode}, \type {\delcode}, \type {\catcode}, \type {\sfcode}, \type {\lccode}
718 and \type {\uccode} tables are now sparse arrays that are implemented in~\CCODE.
719 They are no longer part of the \TEX\ \quote {equivalence table} and because each
720 had 1.1 million entries with a few memory words each, this makes a major
721 difference in memory usage.
723 The \type {\catcode}, \type {\sfcode}, \type {\lccode} and \type {\uccode} assignments do
724 not yet show up when using the etex tracing routines \type {\tracingassigns} and
725 \type {\tracingrestores} (code simply not written yet).
727 A side|-|effect of the current implementation is that \type {\global} is now more
728 expensive in terms of processing than non|-|global assignments.
730 See \type {mathcodes.c} and \type {textcodes.c} if you are interested in the
731 details.
733 Also, the glyph ids within a font are now managed by means of a sparse array and
734 glyph ids can go up to index $2^{21}-1$.
736 \stopsubsection
738 \startsubsection[title=Simple single-character csnames]
740 Single|-|character commands are no longer treated specially in the internals,
741 they are stored in the hash just like the multiletter csnames.
743 The code that displays control sequences explicitly checks if the length is one
744 when it has to decide whether or not to add a trailing space.
746 Active characters are internally implemented as a special type of multi|-|letter
747 control sequences that uses a prefix that is otherwise impossible to obtain.
749 \stopsubsection
751 \startsubsection[title=Compressed format]
753 The format is passed through zlib, allowing it to shrink to roughly half of the
754 size it would have had in uncompressed form. This takes a bit more \CPU\ cycles
755 but much less disk \IO, so it should still be faster.
757 \stopsubsection
759 \startsubsection[title=Binary file reading]
761 All of the internal code is changed in such a way that if one of the \type
762 {read_xxx_file} callbacks is not set, then the file is read by a C function using
763 basically the same convention as the callback: a single read into a buffer big
764 enough to hold the entire file contents. While this uses more memory than the
765 previous code (that mostly used \type {getc} calls), it can be quite a bit faster
766 (depending on your I/O subsystem).
768 \stopsubsection
770 \stopsection
772 \stopchapter
774 \stopcomponent