diff options
-rw-r--r-- | tex/context/base/cont-new.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/font-con.lua | 23 | ||||
-rw-r--r-- | tex/context/base/font-ctx.lua | 3 | ||||
-rw-r--r-- | tex/context/base/font-ext.lua | 16 | ||||
-rw-r--r-- | tex/context/base/node-fnt.lua | 38 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 23564 -> 23563 bytes | |||
-rw-r--r-- | tex/context/base/x-ldx.ctx | 23 | ||||
-rw-r--r-- | tex/context/base/x-ldx.lua (renamed from scripts/context/lua/x-ldx.lua) | 0 | ||||
-rw-r--r-- | tex/context/base/x-ldx.mkiv | 186 | ||||
-rw-r--r-- | tex/generic/context/luatex-fonts-merged.lua | 25 |
13 files changed, 274 insertions, 48 deletions
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index e6239cf11..c0af3ec21 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2011.03.26 11:35} +\newcontextversion{2011.03.26 12:41} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 8a87d5d6d..8aed059b9 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2011.03.26 11:35} +\newcontextversion{2011.03.26 12:41} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index 87de9a1ae..f96fa884e 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.03.26 11:35} +\edef\contextversion{2011.03.26 12:41} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index da17e89a1..97a319cf4 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.03.26 11:35} +\edef\contextversion{2011.03.26 12:41} %D For those who want to use this: diff --git a/tex/context/base/font-con.lua b/tex/context/base/font-con.lua index 230136929..434f64215 100644 --- a/tex/context/base/font-con.lua +++ b/tex/context/base/font-con.lua @@ -1046,16 +1046,14 @@ a helper function.</p> function constructors.checkedfeatures(what,features) if features and next(features) then - local done = false for key, value in next, handlers[what].features.defaults do if features[key] == nil then features[key] = value - done = true end end - return features, done -- done signals a change + return features else - return fastcopy(defaults), true + return fastcopy(defaults) end end @@ -1068,9 +1066,11 @@ function constructors.initializefeatures(what,tfmdata,features,trace,report) local whatfeatures = whathandler.features local whatinitializers = whatfeatures.initializers local whatmodechecker = whatfeatures.modechecker - local mode = properties.mode or (whatmodechecker and whatmodechecker(tfmdata,features)) or features.mode or "base" - properties.mode = mode -- also status - local done = { } + -- properties.mode can be enforces (for instance in font-otd) + local mode = properties.mode or (whatmodechecker and whatmodechecker(tfmdata,features,features.mode)) or features.mode or "base" + properties.mode = mode -- also status + -- + local done = { } while true do local redo = false local initializers = whatfeatures.initializers[mode] @@ -1091,8 +1091,13 @@ function constructors.initializefeatures(what,tfmdata,features,trace,report) end action(tfmdata,value,features) -- can set mode (e.g. goodies) so it can trigger a restart if mode ~= properties.mode then - mode = properties.mode - redo = true + if whatmodechecker then + properties.mode = whatmodechecker(tfmdata,features,properties.mode) -- force checking + end + if mode ~= properties.mode then + mode = properties.mode + redo = true + end end done[feature] = true end diff --git a/tex/context/base/font-ctx.lua b/tex/context/base/font-ctx.lua index f425b79de..d3886eee8 100644 --- a/tex/context/base/font-ctx.lua +++ b/tex/context/base/font-ctx.lua @@ -130,8 +130,7 @@ end) -- this cannot be a feature initializer as there is no auto namespace -- so we never enter the loop then -local function modechecker(tfmdata,features) -- we cannot adapt features as they are shared! - local mode = features.mode +local function modechecker(tfmdata,features,mode) -- we cannot adapt features as they are shared! if mode == "auto" then local script = features.script local language = features.language diff --git a/tex/context/base/font-ext.lua b/tex/context/base/font-ext.lua index acabdb465..97bee4d67 100644 --- a/tex/context/base/font-ext.lua +++ b/tex/context/base/font-ext.lua @@ -27,8 +27,6 @@ of neutral.</p> --ldx]]-- local fonts = fonts -local handlers = fonts.handlers -local otf = handlers.otf local otffeatures = fonts.constructors.newfeatures("otf") local registerotffeature = otffeatures.register @@ -42,7 +40,7 @@ local registerafmfeature = afmfeatures.register local function get_class_and_vector(tfmdata,value,where) -- "expansions" local g_where = tfmdata.goodies and tfmdata.goodies[where] - local f_where = handlers[where] + local f_where = fonts[where] local g_classes = g_where and g_where.classes local f_classes = f_where and f_where.classes local class = (g_classes and g_classes[value]) or (f_classes and f_classes[value]) @@ -380,7 +378,9 @@ local function map_opbd_onto_protrusion(tfmdata,value,opbd) end end end - tfmdata.auto_protrude = done + tfmdata.parameters.protrusion { + auto = true + } end -- The opbd test is just there because it was discussed on the @@ -453,8 +453,8 @@ local function initializeprotrusion(tfmdata,value) end registerotffeature { - name = "protrusion", - description = "shift characters into the left and or right margin", + name = "protrusion", + description = "shift characters into the left and or right margin", initializers = { base = initializeprotrusion, node = initializeprotrusion, @@ -462,8 +462,8 @@ registerotffeature { } registerafmfeature { - name = "protrusion", - description = "shift characters into the left and or right margin", + name = "protrusion", + description = "shift characters into the left and or right margin", initializers = { base = initializeprotrusion, node = initializeprotrusion, diff --git a/tex/context/base/node-fnt.lua b/tex/context/base/node-fnt.lua index 23cf0c04d..77aa79396 100644 --- a/tex/context/base/node-fnt.lua +++ b/tex/context/base/node-fnt.lua @@ -171,21 +171,9 @@ function handlers.characters(head) local font, dynamics = next(attrfonts) for attribute, processors in next, dynamics do -- attr can switch in between local n = #processors - local h, d = processors[1](head,font,attribute) - head = h or head - done = done or d - if n > 1 then - for i=2,n do - local h, d = processors[i](head,font,attribute) - head = h or head - done = done or d - end - end - end - elseif a > 0 then - for font, dynamics in next, attrfonts do - for attribute, processors in next, dynamics do -- attr can switch in between - local n = #processors + if n == 0 then + report_fonts("no processors associated with dynamic %s",attribute) + else local h, d = processors[1](head,font,attribute) head = h or head done = done or d @@ -198,6 +186,26 @@ function handlers.characters(head) end end end + elseif a > 0 then + for font, dynamics in next, attrfonts do + for attribute, processors in next, dynamics do -- attr can switch in between + local n = #processors + if n == 0 then + report_fonts("no processors associated with dynamic %s",attribute) + else + local h, d = processors[1](head,font,attribute) + head = h or head + done = done or d + if n > 1 then + for i=2,n do + local h, d = processors[i](head,font,attribute) + head = h or head + done = done or d + end + end + end + end + end end stoptiming(nodes) if trace_characters then diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 453aa9d08..9b377e8a1 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/x-ldx.ctx b/tex/context/base/x-ldx.ctx new file mode 100644 index 000000000..0dddc9734 --- /dev/null +++ b/tex/context/base/x-ldx.ctx @@ -0,0 +1,23 @@ +<?xml version='1.0' standalone='yes'?> + +<ctx:job> + <ctx:message>Lua Documentation Generator</ctx:message> + <ctx:preprocess> + <ctx:processors> + <ctx:processor name='ldx'>mtxrun --internal x-ldx.lua <ctx:value name='old'/> <ctx:value name='new'/></ctx:processor> + </ctx:processors> + <ctx:files> + <ctx:file processor='ldx'><ctx:value name='old'/></ctx:file> + </ctx:files> + </ctx:preprocess> + <ctx:flags> + <ctx:flag>purge</ctx:flag> + <ctx:flag>forcexml</ctx:flag> + </ctx:flags> + <ctx:process> + <ctx:resources> + <ctx:module>ldx</ctx:module> + </ctx:resources> + </ctx:process> +</ctx:job> + diff --git a/scripts/context/lua/x-ldx.lua b/tex/context/base/x-ldx.lua index 18e7b9b38..18e7b9b38 100644 --- a/scripts/context/lua/x-ldx.lua +++ b/tex/context/base/x-ldx.lua diff --git a/tex/context/base/x-ldx.mkiv b/tex/context/base/x-ldx.mkiv new file mode 100644 index 000000000..bf9bdf71a --- /dev/null +++ b/tex/context/base/x-ldx.mkiv @@ -0,0 +1,186 @@ +\setupxml[default=hidden] + +\usemodule[x][mathml] +\usemodule[abr-02] + +\xmlregisterdocumentsetup{ldx}{xml:mml:define} +\xmlregisterdocumentsetup{ldx}{xml:ldx:define} + +\xmlregisterns{ldx}{ldx} + +\startxmlsetups xml:ldx:define +% \xmlgrab {\xmldocument} {ldx:*} {*} + \xmlsetsetup {#1} {ldx:*} {ldx:*} +\stopxmlsetups + +% % % + +\startxmlsetups ldx:p + \xmlflush{#1}\par +\stopxmlsetups + +\startxmlsetups ldx:source + \source{\xmlflush{#1}} +\stopxmlsetups + +\startxmlsetups ldx:key + \dontleavehmode{\bf\xmlflush{#1}} +\stopxmlsetups + +\startxmlsetups ldx:variable + \xmlflush{#1} +% \expanded{\variable{\xmlflush{#1}}} +\stopxmlsetups + +\startxmlsetups ldx:function + \dontleavehmode{\bf function}\space\xmlflush{#1} +% \expanded{\function{\xmlflush{#1}}} +\stopxmlsetups + +\startxmlsetups ldx:com + \dontleavehmode{\tt--\xmlflush{#1}} +\stopxmlsetups + +\startxmlsetups ldx:document + \page + \xmlflush{#1} + \determineregistercharacteristics[function] + \startmode[*register] + \testpage[4] + \extra{Functions} + \placeregister[function] + \stopmode + \determineregistercharacteristics[variable] + \startmode[*register] + \testpage[4] + \extra{Variables} + \placeregister[variable] + \stopmode +\stopxmlsetups + +\newcounter\CommentCounter + +\startxmlsetups ldx:comment + \blank + \doglobal\increment\CommentCounter + \margintitle{\bf\CommentCounter} + \xmlflush{#1} + \blank +\stopxmlsetups + +\startxmlsetups ldx:dqs + \dontleavehmode\bgroup\tt"\xmlflush{#1}"\egroup +\stopxmlsetups + +\startxmlsetups ldx:sqs + \dontleavehmode\bgroup\tt'\xmlflush{#1}'\egroup +\stopxmlsetups + +\startxmlsetups ldx:code + \startpacked + \xmlflush{#1}\relax + \stoppacked +\stopxmlsetups + +\startxmlsetups ldx:lines + \startpacked + \xmlflush{#1} + \stoppacked +\stopxmlsetups + +\startxmlsetups ldx:line + \doifelsenothing {\xmlflush{#1}} { + \xmlflush{#1}\crlf + } { + \dontleavehmode \hbox to \hsize \bgroup + \strut + \hskip.25\dimexpr\xmlattdef{#1}{n}{0}em\relax\relax % extra relax needed ! + \doif {\xmlatt{#1}{comment}} {yes} {\tt} + \xmlflush{#1} + \hss + \egroup + \endgraf + } +\stopxmlsetups + +\startxmlsetups ldx:logo + \uppercasestring\xmlatt{#1}{label}\xmlatt{#1}{name}\to\ascii + \ifx\ascii\empty\else\getvalue{\ascii}\fi +\stopxmlsetups + +\startxmlsetups ldx:l + \uppercasestring\xmlatt{#1}{l}\xmlatt{#1}{n}\to\ascii + \ifx\ascii\empty\else\getvalue{\ascii}\fi +\stopxmlsetups + +\startxmlsetups ldx:typing + \blank + \startpacked \tt + \xmlverbatim{#1} + \stoppacked + \blank +\stopxmlsetups + +\startxmlsetups ldx:type + \dontleavehmode{\tt\xmlflush{#1}} +\stopxmlsetups + +\startxmlsetups ldx:t + \dontleavehmode{\tt\xmlflush{#1}} +\stopxmlsetups + +% + +\def\xmldocument{ldx} + +% key -> kw +% dqs -> dq +% sqs -> sq +% line -> ln +% code -> cd +% comment -> tx (text) + +\definetypeface[mainfacenormal] [ss][sans] [iwona] [default] +\definetypeface[mainfacenormal] [rm][serif][palatino] [default] +\definetypeface[mainfacenormal] [tt][mono] [modern] [default][rscale=1] % 1.1 +\definetypeface[mainfacenormal] [mm][math] [iwona] [default][encoding=default] + +\definetypeface[mainfacemedium] [ss][sans] [iwona-medium][default] +\definetypeface[mainfacenormal] [rm][serif][palatino] [default] +\definetypeface[mainfacemedium] [tt][mono] [modern] [default][rscale=1] % 1.1 +\definetypeface[mainfacemedium] [mm][math] [iwona-medium][default][encoding=default] + +\definetypeface[mainfacenarrowtt][tt][mono] [modern-cond] [default][rscale=1] % 1.1 + +\setupbodyfont + [mainfacenormal,11pt] + +\setupwhitespace + [big] + +\defineregister[function][functions] +\defineregister[variable][variables] + +\definehead[source][subject] +\definehead[extra] [subsubject] +\definehead[topic] [subsubsubject] + +\setuphead + [source] + [style=\bfb] + +\setuphead + [extra] + [style=\bfa] + +\setuphead + [topic] + [style=\bf] + +\setuplayout + [width=middle, + height=middle, + backspace=2cm, + topspace=2cm] + +\endinput diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 840e64e4a..dbd25af37 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 03/26/11 11:35:06 +-- merge date : 03/26/11 12:41:29 do -- begin closure to overcome local limits and interference @@ -3920,16 +3920,14 @@ a helper function.</p> function constructors.checkedfeatures(what,features) if features and next(features) then - local done = false for key, value in next, handlers[what].features.defaults do if features[key] == nil then features[key] = value - done = true end end - return features, done -- done signals a change + return features else - return fastcopy(defaults), true + return fastcopy(defaults) end end @@ -3942,9 +3940,11 @@ function constructors.initializefeatures(what,tfmdata,features,trace,report) local whatfeatures = whathandler.features local whatinitializers = whatfeatures.initializers local whatmodechecker = whatfeatures.modechecker - local mode = properties.mode or (whatmodechecker and whatmodechecker(tfmdata,features)) or features.mode or "base" - properties.mode = mode -- also status - local done = { } + -- properties.mode can be enforces (for instance in font-otd) + local mode = properties.mode or (whatmodechecker and whatmodechecker(tfmdata,features,features.mode)) or features.mode or "base" + properties.mode = mode -- also status + -- + local done = { } while true do local redo = false local initializers = whatfeatures.initializers[mode] @@ -3965,8 +3965,13 @@ function constructors.initializefeatures(what,tfmdata,features,trace,report) end action(tfmdata,value,features) -- can set mode (e.g. goodies) so it can trigger a restart if mode ~= properties.mode then - mode = properties.mode - redo = true + if whatmodechecker then + properties.mode = whatmodechecker(tfmdata,features,properties.mode) -- force checking + end + if mode ~= properties.mode then + mode = properties.mode + redo = true + end end done[feature] = true end |