The history of luaTEX 2006–2009 / v 0.50 - Pragma ADE
The history of luaTEX 2006–2009 / v 0.50 - Pragma ADE The history of luaTEX 2006–2009 / v 0.50 - Pragma ADE
124 Chinese, Japanese and Korean, aka CJK
XVI Optimization quality of code How good is the MkIV code? Well, as good as I can make it. When you browse the code you will probably notice differences in coding style and this is a related to the learning curve. For instance the luat-inp module needs some cleanup, for instance hiding local function from users. Since benchmarking has been done right from the start there is probably not that much to gain, but who knows. When coding in Lua you should be careful with dening global variables, since they may override something. In MkIV we don't guarantee that the name you use for variable will not be used at some point. Therefore, best operate in a dedicated Lua instance, or operate in userspace. do end -- your code If you want to use your data later on, think of working this way (the example is somewhat silly): userdata['your.name'] = userdata['your.name'] or { } do local mydata = userdata['your.name'] mydata.data = {} local function foo() return 'bar' end function mydata.dothis() mydata[foo] = foo() end end In this case you can always access your user data while temporary variables are hidden. The userdata table is predened. As is thirddata for modules that you may write. Of course this assumes that you create a namespace within these global tables. A nice test for checking global cluttering is the following: Optimization 125
- Page 76 and 77: Let's end with an observation. Attr
- Page 78 and 79: end end tex.sprint("\\setbox0=\\hbo
- Page 80 and 81: 78 Dirty tricks
- Page 82 and 83: Those who read the previous chapter
- Page 84 and 85: In a similar way support for xml wi
- Page 86 and 87: Undoubtely this will have a huge im
- Page 88 and 89: 86 Going beta
- Page 90 and 91: We like testing LuaTEX's open type
- Page 92 and 93: k a el--rie am, ld p n th re, l ak
- Page 94 and 95: his or her font). As said, it also
- Page 96 and 97: ["tag"]="calt", } }, ["name"]="ks_l
- Page 98 and 99: When testing the implementation we
- Page 100 and 101: Mr. rmn p Of course we have to test
- Page 102 and 103: ه مَ ه لِ دْ
- Page 104 and 105: لاۤئِهٰٖا لاۤئِه
- Page 106 and 107: َ غْتَرِفٌُم عْتَر
- Page 108 and 109: وَْر وةَ، ٰ ي كَ
- Page 110 and 111: white black t-green a=1.000 t=0.500
- Page 112 and 113: Palets work with names: \definepale
- Page 114 and 115: • support mechanism are under con
- Page 116 and 117: So, effectively we set a box, and e
- Page 118 and 119: 116 Colors redone
- Page 120 and 121: • Spaces at the end of the line (
- Page 122 and 123: 兡 也 包 因 沘 氓 侷 柵 苗
- Page 124 and 125: 〉 + 々 = 〉々 〉々 〉々
- Page 128 and 129: for k, v in pairs(_G) do print(k, v
- Page 130 and 131: } [4] = 200 I mistakingly assumed t
- Page 132 and 133: 130 Optimization
- Page 134 and 135: xetex metapost We can also
- Page 136 and 137: \startluacode xml.sprint(xml.first(
- Page 138 and 139: a[position()=5] maybe a[first()] ma
- Page 140 and 141: Now we have: okay okay okay Repla
- Page 142 and 143: \startxmlsetups xml:mysetups \xmlse
- Page 144 and 145: c1d1 c2d2 d3 d4 d5 Here com
- Page 146 and 147: c2 d3 b/c[1] c1 c2 a/c[1] d3 a/c[-1
- Page 148 and 149: The code in traditional TEX that de
- Page 150 and 151: and this is where MkIV hooks in ist
- Page 152 and 153: con-text == [c][o](pre=n-,post=,rep
- Page 154 and 155: luastate_bytes min:37009927, max:87
- Page 156 and 157: dyn_used min:478158, max:554800, pa
- Page 158 and 159: str_ptr min:2131299, max:2136226, p
- Page 160 and 161: if_stack min:0, max:13, pages:326 k
- Page 162 and 163: pdf_refximage min:0, max:7, pages:3
- Page 164 and 165: 162 Collecting garbage
- Page 166 and 167: \definefontfeature[coward] [kern=ye
- Page 168 and 169: We do our tests of a variant of Con
- Page 170 and 171: --make or --ini --run or --fmt= --l
- Page 172 and 173: mtxrun --script font --list --patte
- Page 174 and 175: Opening up TEX started with rewriti
124 Chinese, Japanese and Korean, aka CJK