diff options
Diffstat (limited to 'tex')
28 files changed, 784 insertions, 580 deletions
diff --git a/tex/context/base/cldf-ini.lua b/tex/context/base/cldf-ini.lua index ad5f14855..84ae7314e 100644 --- a/tex/context/base/cldf-ini.lua +++ b/tex/context/base/cldf-ini.lua @@ -454,16 +454,20 @@ end local generics = { } context.generics = generics local function indexer(parent,k) - local c = "\\" .. tostring(generics[k] or k) - local f = function(first,...) - if first == nil then - flush(currentcatcodes,c) - else - return writer(parent,c,first,...) + if type(k) == "string" then + local c = "\\" .. tostring(generics[k] or k) + local f = function(first,...) + if first == nil then + flush(currentcatcodes,c) + else + return writer(parent,c,first,...) + end end + parent[k] = f + return f + else + return context -- catch end - parent[k] = f - return f end -- Potential optimization: after the first call we know if there will be an @@ -961,18 +965,6 @@ setmetatable(delayed, { __index = indexer, __call = caller } ) -- helpers: --- we could have faster calls here - -function context.concat(t,separator) - local done = false - for i=1,#t do - local ti = t[i] - if ti ~= "" then - if done then - context(separator) - end - context(ti) - done = true - end - end +function context.concat(...) + context(concat(...)) end diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 5df023d60..55a20ddcd 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{2012.11.08 12:14} +\newcontextversion{2012.11.12 17:10} %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 4defa804f..a5fb2b741 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{2012.11.08 12:14} +\newcontextversion{2012.11.12 17:10} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 0a36a7401..9cf5a7f51 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png Binary files differindex 60c95e28a..0eaf7b69f 100644 --- a/tex/context/base/context-version.png +++ b/tex/context/base/context-version.png diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index 497656624..2da64623f 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{2012.11.08 12:14} +\edef\contextversion{2012.11.12 17:10} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 77d30f666..7477fe0ae 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2012.11.08 12:14} +\edef\contextversion{2012.11.12 17:10} %D For those who want to use this: diff --git a/tex/context/base/core-con.lua b/tex/context/base/core-con.lua index 641aea4ba..9fc449809 100644 --- a/tex/context/base/core-con.lua +++ b/tex/context/base/core-con.lua @@ -719,6 +719,113 @@ function commands.ordinal(n,language) end end +local verbose = { } + +local words = { + [0] = "zero", + [1] = "one", + [2] = "two", + [3] = "three", + [4] = "four", + [5] = "five", + [6] = "six", + [7] = "seven", + [8] = "eight", + [9] = "nine", + [10] = "ten", + [11] = "eleven", + [12] = "twelve", + [13] = "thirteen", + [14] = "fourteen", + [15] = "fifteen", + [16] = "sixteen", + [17] = "seventeen", + [18] = "eighteen", + [19] = "nineteen", + [20] = "twenty", + [30] = "thirty", + [40] = "forty", + [50] = "fifty", + [60] = "sixty", + [70] = "seventy", + [80] = "eighty", + [90] = "ninety", + [100] = "hundred", + [1000] = "thousand", + [1000^2] = "million", + [1000^3] = "billion", + [1000^4] = "trillion", +} + +function verbose.english(n) + local w = words[n] + if w then + return w + end + local t = { } + local function compose_one(n) + local w = words[n] + if w then + t[#t+1] = w + return + end + local a, b = floor(n/100), n % 100 + if a == 10 then + t[#t+1] = words[1] + t[#t+1] = words[1000] + elseif a > 0 then + t[#t+1] = words[a] + t[#t+1] = words[100] + end + if words[b] then + t[#t+1] = words[b] + else + a, b = floor(b/10), n % 10 + t[#t+1] = words[a*10] + t[#t+1] = words[b] + end + end + local function compose_two(n,m) + if n > (m-1) then + local a, b = floor(n/m), n % m + if a > 0 then + compose_one(a) + end + t[#t+1] = words[m] + n = b + end + return n + end + n = compose_two(n,1000^4) + n = compose_two(n,1000^3) + n = compose_two(n,1000^2) + n = compose_two(n,1000^1) + if n > 0 then + compose_one(n) + end + return #t > 0 and concat(t," ") or tostring(n) +end + +verbose.en = verbose.english + +-- print(verbose.english(11111111)) +-- print(verbose.english(2221101)) +-- print(verbose.english(1111)) +-- print(verbose.english(1218)) +-- print(verbose.english(1234)) +-- print(verbose.english(12345)) +-- print(verbose.english(12345678900000)) + +function converters.verbose(n,language) + local t = language and verbose[language] + return t and t(n) or n +end + +function commands.verbose(n,language) + local t = language and verbose[language] + context(t and t(n) or n) +end + -- -- local v_day = variables.day @@ -741,18 +848,18 @@ local days = { -- not variables.sunday } local months = { -- not variables.januari - "january", - "february", - "march", - "april", - "may", - "june", - "july", - "august", - "september", - "october", - "november", - "december", + "january", + "february", + "march", + "april", + "may", + "june", + "july", + "august", + "september", + "october", + "november", + "december", } function commands.dayname(n) diff --git a/tex/context/base/core-con.mkiv b/tex/context/base/core-con.mkiv index cdc51eb23..7febdcf39 100644 --- a/tex/context/base/core-con.mkiv +++ b/tex/context/base/core-con.mkiv @@ -201,7 +201,7 @@ %D %D Anyhow, the conversion looks like: -\def\monthlong #1{\ctxcommand{month(#1)}} +\def\monthlong #1{\ctxcommand{monthname(#1)}} \def\monthshort#1{\ctxcommand{monthmnem(#1)}} \let\convertmonth\monthlong % for old times sake @@ -592,6 +592,9 @@ \def\ordinalstr #1{\notsmallcapped{#1}} \def\ordinaldaynumber #1{\ctxcommand{ordinal(#1,"\currentlanguage")}} +\def\verbosenumber #1{\ctxcommand{verbose(#1,"\currentlanguage")}} +\def\VerboseNumber #1{\Words{\ctxcommand{verbose(#1,"\currentlanguage")}}} + %D As longs as symbols are linked to levels or numbers, we can also use the %D conversion mechanism, but in for instance the itemization macros, we prefer %D symbols because they can more easier be (partially) redefined. Symbols are @@ -624,6 +627,12 @@ \defineconversion [\v!Numbers] [\Numbers] \defineconversion [\v!mediaeval] [\mediaeval] +\defineconversion [\v!word] [\verbosenumber] +\defineconversion [\v!words] [\verbosenumber] + +\defineconversion [\v!Word] [\VerboseNumber] +\defineconversion [\v!Words] [\VerboseNumber] + \defineconversion [n] [\numbers] \defineconversion [N] [\Numbers] \defineconversion [m] [\mediaeval] diff --git a/tex/context/base/data-pre.lua b/tex/context/base/data-pre.lua index 40b430bf2..8067355d3 100644 --- a/tex/context/base/data-pre.lua +++ b/tex/context/base/data-pre.lua @@ -91,6 +91,10 @@ prefixes.home = function(str) end local function toppath() + local inputstack = resolvers.inputstack -- dependency, actually the code should move but it's + if not inputstack then -- more convenient to keep it here + return "." + end local pathname = dirname(inputstack[#inputstack] or "") if pathname == "" then return "." diff --git a/tex/context/base/font-syn.lua b/tex/context/base/font-syn.lua index d99114998..9be307099 100644 --- a/tex/context/base/font-syn.lua +++ b/tex/context/base/font-syn.lua @@ -10,7 +10,7 @@ if not modules then modules = { } end modules ['font-syn'] = { local utf = unicode.utf8 local next, tonumber = next, tonumber -local gsub, lower, match, find, lower, upper = string.gsub, string.lower, string.match, string.find, string.lower, string.upper +local sub, gsub, lower, match, find, lower, upper = string.sub, string.gsub, string.lower, string.match, string.find, string.lower, string.upper local find, gmatch = string.find, string.gmatch local concat, sort, format = table.concat, table.sort, string.format local serialize = table.serialize @@ -120,6 +120,50 @@ local variants = Cs( -- fax casual local normalized_variants = sparse() +names.knownweights = { + "black", + "bold", + "demi", + "demibold", + "extrabold", + "heavy", + "light", + "medium", + "mediumbold", + "normal", + "regular", + "semi", + "semibold", + "ultra", + "ultrabold", + "ultralight", +} + +names.knownstyles = { + "italic", + "normal", + "oblique", + "regular", + "reverseitalic", + "reverseoblique", + "roman", + "slanted", +} + +names.knownwidths = { + "book", + "condensed", + "expanded", + "normal", + "thin", +} + +names.knownvariants = { + "normal", + "oldstyle", + "smallcaps", +} + local any = P(1) local analyzed_table @@ -495,22 +539,20 @@ local function collecthashes() if fontname and not mf[fontname] then mf[fontname], nofmappings = index, nofmappings + 1 end - if familyname and weight then + if familyname and weight and weight ~= sub(familyname,#familyname-#weight+1,#familyname) then local madename = familyname .. weight if not mf[madename] and not ff[madename] then ff[madename], noffallbacks = index, noffallbacks + 1 end end - if familyname and subfamily then + if familyname and subfamily and subfamily ~= sub(familyname,#familyname-#subfamily+1,#familyname) then local extraname = familyname .. subfamily if not mf[extraname] and not ff[extraname] then ff[extraname], noffallbacks = index, noffallbacks + 1 end end - if familyname then - if not mf[familyname] and not ff[familyname] then - ff[familyname], noffallbacks = index, noffallbacks + 1 - end + if familyname and not mf[familyname] and not ff[familyname] then + ff[familyname], noffallbacks = index, noffallbacks + 1 end end end diff --git a/tex/context/base/grph-epd.mkiv b/tex/context/base/grph-epd.mkiv index 26c07e731..58526fd44 100644 --- a/tex/context/base/grph-epd.mkiv +++ b/tex/context/base/grph-epd.mkiv @@ -17,7 +17,7 @@ \registerctxluafile{grph-epd}{1.001} -\def\figurereference{\ctxlua{figures.tprint("status","reference")}} % might become private +\def\figurereference{\ctxcommand{figurestatus("reference")}} % might become private \defineoverlay[system:graphics:epdf][\directsetup{system:graphics:epdf}] diff --git a/tex/context/base/grph-inc.lua b/tex/context/base/grph-inc.lua index f8c9a5134..57b726909 100644 --- a/tex/context/base/grph-inc.lua +++ b/tex/context/base/grph-inc.lua @@ -6,20 +6,15 @@ if not modules then modules = { } end modules ['grph-inc'] = { license = "see context related readme files" } --- figures -> managers.figures - -- todo: empty filename or only suffix always false (not found) - -- lowercase types -- mps tex tmp svg -- partly qualified -- dimensions --- consult rlx -- use metatables - -- figures.boxnumber can go as we now can use names - -- avoid push +-- move some to command namespace --[[ The ConTeXt figure inclusion mechanisms are among the oldest code @@ -47,8 +42,9 @@ local texbox = tex.box local contains = table.contains local concat, insert, remove = table.concat, table.insert, table.remove local todimen = string.todimen +local collapsepath = file.collapsepath -local P = lpeg.P +local P, lpegmatch = lpeg.P, lpeg.match local settings_to_array = utilities.parsers.settings_to_array local settings_to_hash = utilities.parsers.settings_to_hash @@ -103,7 +99,7 @@ local validtypes = table.tohash(img.types()) function img.checksize(size) if size then size = gsub(size,"box","") - return (validsizes[size] and size) or "crop" + return validsizes[size] and size or "crop" else return "crop" end @@ -117,49 +113,52 @@ end --- we can consider an grph-ini file -figures = figures or { } -local figures = figures - -figures.loaded = allocate() -figures.used = allocate() -figures.found = allocate() -figures.suffixes = allocate() -figures.patterns = allocate() -figures.resources = allocate() - - -figures.boxnumber = figures.boxnumber or 0 -figures.defaultsearch = true -figures.defaultwidth = 0 -figures.defaultheight = 0 -figures.defaultdepth = 0 -figures.nofprocessed = 0 -figures.preferquality = true -- quality over location - -local existers = allocate() figures.existers = existers -local checkers = allocate() figures.checkers = checkers -local includers = allocate() figures.includers = includers -local converters = allocate() figures.converters = converters -local identifiers = allocate() figures.identifiers = identifiers -local programs = allocate() figures.programs = programs +figures = figures or { } +local figures = figures + +figures.boxnumber = figures.boxnumber or 0 +figures.defaultsearch = true +figures.defaultwidth = 0 +figures.defaultheight = 0 +figures.defaultdepth = 0 +figures.nofprocessed = 0 +figures.preferquality = true -- quality over location + +local figures_loaded = allocate() figures.loaded = figures_loaded +local figures_used = allocate() figures.used = figures_used +local figures_found = allocate() figures.found = figures_found +local figures_suffixes = allocate() figures.suffixes = figures_suffixes +local figures_patterns = allocate() figures.patterns = figures_patterns +local figures_resources = allocate() figures.resources = figures_resources + +local existers = allocate() figures.existers = existers +local checkers = allocate() figures.checkers = checkers +local includers = allocate() figures.includers = includers +local converters = allocate() figures.converters = converters +local identifiers = allocate() figures.identifiers = identifiers +local programs = allocate() figures.programs = programs + +local defaultformat = "pdf" +local defaultprefix = "m_k_i_v_" figures.localpaths = allocate { ".", "..", "../.." } figures.cachepaths = allocate { - prefix = "", - path = ".", + prefix = "", + path = ".", subpath = ".", } -figures.paths = allocate(table.copy(figures.localpaths)) +local figure_paths = allocate(table.copy(figures.localpaths)) +figures.paths = figure_paths -local lookuporder = allocate { +local figures_order = allocate { "pdf", "mps", "jpg", "png", "jp2", "jbig", "svg", "eps", "tif", "gif", "mov", "buffer", "tex", "cld", "auto", } -local formats = allocate { -- magic and order will move here +local figures_formats = allocate { -- magic and order will move here ["pdf"] = { list = { "pdf" } }, ["mps"] = { patterns = { "mps", "%d+" } }, ["jpg"] = { list = { "jpg", "jpeg" } }, @@ -177,7 +176,7 @@ local formats = allocate { -- magic and order will move here ["auto"] = { list = { "auto" } }, } -local magics = allocate { +local figures_magics = allocate { { format = "png", pattern = P("\137PNG\013\010\026\010") }, -- 89 50 4E 47 0D 0A 1A 0A, { format = "jpg", pattern = P("\255\216\255") }, -- FF D8 FF { format = "jp2", pattern = P("\000\000\000\012\106\080\032\032\013\010"), }, -- 00 00 00 0C 6A 50 20 20 0D 0A }, @@ -185,8 +184,9 @@ local magics = allocate { { format = "pdf", pattern = (1 - P("%PDF"))^0 * P("%PDF") }, } -figures.formats = formats -- frozen -figures.magics = magics -- frozen +figures.formats = figures_formats -- frozen +figures.magics = figures_magics -- frozen +figures.order = figures_order -- frozen -- We can set the order but only indirectly so that we can check for support. @@ -195,17 +195,17 @@ function figures.setorder(list) -- can be table or string list = settings_to_array(list) end if list and #list > 0 then - lookuporder = allocate() - figures.order = lookuporder + figures_order = allocate() + figures.order = figures_order local done = { } -- just to be sure in case the list is generated for i=1,#list do local l = lower(list[i]) - if formats[l] and not done[l] then - lookuporder[#lookuporder+1] = l + if figures_formats[l] and not done[l] then + figures_order[#figures_order+1] = l done[l] = true end end - report_inclusion("lookup order: %s",concat(lookuporder," ")) + report_inclusion("lookup order: %s",concat(figures_order," ")) else -- invalid list end @@ -217,9 +217,9 @@ function figures.guess(filename) local str = f:read(100) f:close() if str then - for i=1,#magics do - local pattern = magics[i] - if pattern.pattern:match(str) then + for i=1,#figures_magics do + local pattern = figures_magics[i] + if lpegmatch(pattern.pattern,str) then local format = pattern.format if trace_figures then report_inclusion("file %q has format %s",filename,format) @@ -231,41 +231,45 @@ function figures.guess(filename) end end -function figures.setlookups() -- tobe redone .. just set locals - local fs, fp = allocate(), allocate() - figures.suffixes, figures.patterns = fs, fp - for _, format in next, lookuporder do - local data = formats[format] +local function setlookups() -- tobe redone .. just set locals + figures_suffixes = allocate() + figures_patterns = allocate() + for _, format in next, figures_order do + local data = figures_formats[format] local list = data.list if list then for i=1,#list do - fs[list[i]] = format -- hash + figures_suffixes[list[i]] = format -- hash end else - fs[format] = format + figures_suffixes[format] = format end local patterns = data.patterns if patterns then for i=1,#patterns do - fp[#fp+1] = { patterns[i], format } -- array + figures_patterns[#figures_patterns+1] = { patterns[i], format } -- array end end end + figures.suffixes = figures_suffixes + figures.patterns = figures_patterns end -figures.setlookups() +setlookups() + +figures.setlookups = setlookups function figures.registerresource(t) - local n = #figures.resources + 1 - figures.resources[n] = t + local n = #figures_resources + 1 + figures_resources[n] = t return n end local function register(tag,target,what) - local data = formats[target] -- resolver etc + local data = figures_formats[target] -- resolver etc if not data then data = { } - formats[target] = data + figures_formats[target] = data end local d = data[tag] -- list or pattern if d and not contains(d,what) then @@ -273,23 +277,24 @@ local function register(tag,target,what) else data[tag] = { what } end - if not contains(lookuporder,target) then - lookuporder[#lookuporder+1] = target + if not contains(figures_order,target) then + figures_order[#figures_order+1] = target end - figures.setlookups() + setlookups() end function figures.registersuffix (suffix, target) register('list', target,suffix ) end function figures.registerpattern(pattern,target) register('pattern',target,pattern) end -local last_locationset, last_pathlist = last_locationset or nil, last_pathlist or nil +local last_locationset = last_locationset or nil +local last_pathlist = last_pathlist or nil function figures.setpaths(locationset,pathlist) if last_locationset == locationset and last_pathlist == pathlist then -- this function can be called each graphic so we provide this optimization return end - local iv, t, h = interfaces.variables, figures.paths, settings_to_hash(locationset) + local iv, t, h = interfaces.variables, figure_paths, settings_to_hash(locationset) if last_locationset ~= locationset then -- change == reset (actually, a 'reset' would indeed reset if h[iv["local"]] then @@ -309,18 +314,20 @@ function figures.setpaths(locationset,pathlist) end end end - figures.paths, last_pathlist = t, pathlist + figure_paths = t + last_pathlist = pathlist + figures.paths = figure_paths if trace_figures then report_inclusion("locations: %s",last_locationset) - report_inclusion("path list: %s",concat(figures.paths, " ")) + report_inclusion("path list: %s",concat(figure_paths, " ")) end end -- check conversions and handle it here function figures.hash(data) - return data.status.hash or tostring(data.status.private) -- the <img object> --- return data.status.fullname .. "+".. (data.status.page or data.request.page or 1) -- img is still not perfect + local status = data and data.status + return (status and status.hash or tostring(status.private)) or "nohash" -- the <img object> end -- interfacing to tex @@ -382,16 +389,16 @@ function figures.initialize(request) -- request.width/height are strings and are only used when no natural dimensions -- can be determined; at some point the handlers might set them to numbers instead -- local w, h = tonumber(request.width), tonumber(request.height) - request.page = math.max(tonumber(request.page) or 1,1) - request.size = img.checksize(request.size) - request.object = request.object == variables.yes - request["repeat"] = request["repeat"] == variables.yes - request.preview = request.preview == variables.yes - request.cache = request.cache ~= "" and request.cache - request.prefix = request.prefix ~= "" and request.prefix - request.format = request.format ~= "" and request.format - -- request.width = (w and w > 0) or false - -- request.height = (h and h > 0) or false + request.page = math.max(tonumber(request.page) or 1,1) + request.size = img.checksize(request.size) + request.object = request.object == variables.yes + request["repeat"] = request["repeat"] == variables.yes + request.preview = request.preview == variables.yes + request.cache = request.cache ~= "" and request.cache + request.prefix = request.prefix ~= "" and request.prefix + request.format = request.format ~= "" and request.format + -- request.width = (w and w > 0) or false + -- request.height = (h and h > 0) or false table.merge(figuredata.request,request) end return figuredata @@ -414,7 +421,7 @@ function figures.current() return callstack[#callstack] or lastfiguredata end -function figures.get(category,tag,default) +local function get(category,tag,default) local value = lastfiguredata and lastfiguredata[category] value = value and value[tag] if not value or value == "" or value == true then @@ -424,14 +431,19 @@ function figures.get(category,tag,default) end end --- +figures.get = get -function figures.tprint(category,tag,default) - context(figures.get(category,tag,default)) +function commands.figurevariable(category,tag,default) + context(get(category,tag,default)) end -local defaultformat = "pdf" -local defaultprefix = "m_k_i_v_" +function commands.figurestatus (tag,default) context(get("status", tag,default)) end +function commands.figurerequest(tag,default) context(get("request",tag,default)) end +function commands.figureused (tag,default) context(get("used", tag,default)) end + +function commands.figurefilepath() context(file.dirname (get("used","fullname"))) end +function commands.figurefilename() context(file.nameonly(get("used","fullname"))) end +function commands.figurefiletype() context(file.extname (get("used","fullname"))) end -- todo: local path or cache path @@ -439,13 +451,13 @@ local function forbiddenname(filename) if not filename or filename == "" then return false end - local expandedfullname = file.collapsepath(filename,true) - local expandedinputname = file.collapsepath(file.addsuffix(environment.jobfilename,environment.jobfilesuffix),true) + local expandedfullname = collapsepath(filename,true) + local expandedinputname = collapsepath(file.addsuffix(environment.jobfilename,environment.jobfilesuffix),true) if expandedfullname == expandedinputname then report_inclusion("skipping graphic with same name as input filename (%s), enforce suffix",expandedinputname) return true end - local expandedoutputname = file.collapsepath(codeinjections.getoutputfilename(),true) + local expandedoutputname = collapsepath(codeinjections.getoutputfilename(),true) if expandedfullname == expandedoutputname then report_inclusion("skipping graphic with same name as output filename (%s), enforce suffix",expandedoutputname) return true @@ -453,158 +465,157 @@ local function forbiddenname(filename) end local function register(askedname,specification) - if specification then - if forbiddenname(specification.fullname) then - specification = { } - else - local format = specification.format - if format then - local conversion = specification.conversion - local resolution = specification.resolution - if conversion == "" then - conversion = nil - end - if resolution == "" then - resolution = nil - end - local newformat = conversion - if not newformat or newformat == "" then + if not specification then + specification = { } + elseif forbiddenname(specification.fullname) then + specification = { } + else + local format = specification.format + if format then + local conversion = specification.conversion + local resolution = specification.resolution + if conversion == "" then + conversion = nil + end + if resolution == "" then + resolution = nil + end + local newformat = conversion + if not newformat or newformat == "" then + newformat = defaultformat + end + if trace_conversion then + report_inclusion("checking conversion of '%s' (%s): old format '%s', new format '%s', conversion '%s', resolution '%s'", + askedname,specification.fullname,format,newformat,conversion or "default",resolution or "default") + end + -- quick hack + -- local converter = (newformat ~= format) and converters[format] + local converter = (newformat ~= format or resolution) and converters[format] + if converter then + if converter[newformat] then + converter = converter[newformat] + else newformat = defaultformat - end - if trace_conversion then - report_inclusion("checking conversion of '%s' (%s): old format '%s', new format '%s', conversion '%s', resolution '%s'", - askedname,specification.fullname,format,newformat,conversion or "default",resolution or "default") - end - -- quick hack - -- local converter = (newformat ~= format) and converters[format] - local converter = (newformat ~= format or resolution) and converters[format] - if converter then if converter[newformat] then converter = converter[newformat] else + converter = nil newformat = defaultformat - if converter[newformat] then - converter = converter[newformat] - else - converter = nil - newformat = defaultformat - end end - elseif trace_conversion then - report_inclusion("no converter for '%s' -> '%s'",format,newformat) end - if converter then - local oldname = specification.fullname - local newpath = file.dirname(oldname) - local oldbase = file.basename(oldname) - -- - -- problem: we can have weird filenames, like a.b.c (no suffix) and a.b.c.gif - -- so we cannot safely remove a suffix (unless we do that for known suffixes) - -- - -- local newbase = file.removesuffix(oldbase) -- assumes a known suffix - -- - -- so we now have (also see *): - -- - local newbase = oldbase - -- - local fc = specification.cache or figures.cachepaths.path - if fc and fc ~= "" and fc ~= "." then - newpath = fc - else - newbase = defaultprefix .. newbase - end - if not file.is_writable(newpath) then - if trace_conversion then - report_inclusion("path '%s'is not writable, forcing conversion path '.' ",newpath) - end - newpath = "." - end - local subpath = specification.subpath or figures.cachepaths.subpath - if subpath and subpath ~= "" and subpath ~= "." then - newpath = newpath .. "/" .. subpath + elseif trace_conversion then + report_inclusion("no converter for '%s' -> '%s'",format,newformat) + end + if converter then + local oldname = specification.fullname + local newpath = file.dirname(oldname) + local oldbase = file.basename(oldname) + -- + -- problem: we can have weird filenames, like a.b.c (no suffix) and a.b.c.gif + -- so we cannot safely remove a suffix (unless we do that for known suffixes) + -- + -- local newbase = file.removesuffix(oldbase) -- assumes a known suffix + -- + -- so we now have (also see *): + -- + local newbase = oldbase + -- + local fc = specification.cache or figures.cachepaths.path + if fc and fc ~= "" and fc ~= "." then + newpath = fc + else + newbase = defaultprefix .. newbase + end + if not file.is_writable(newpath) then + if trace_conversion then + report_inclusion("path '%s'is not writable, forcing conversion path '.' ",newpath) end - local prefix = specification.prefix or figures.cachepaths.prefix - if prefix and prefix ~= "" then - newbase = prefix .. newbase + newpath = "." + end + local subpath = specification.subpath or figures.cachepaths.subpath + if subpath and subpath ~= "" and subpath ~= "." then + newpath = newpath .. "/" .. subpath + end + local prefix = specification.prefix or figures.cachepaths.prefix + if prefix and prefix ~= "" then + newbase = prefix .. newbase + end + if resolution and resolution ~= "" then -- the order might change + newbase = newbase .. "_" .. resolution + end + -- + -- see *, we had: + -- + -- local newbase = file.addsuffix(newbase,newformat) + -- + -- but now have (result of Aditya's web image testing): + -- + -- as a side effect we can now have multiple fetches with different + -- original figures_formats, not that it matters much (apart from older conversions + -- sticking around) + -- + local newbase = newbase .. "." .. newformat + -- + local newname = file.join(newpath,newbase) + dir.makedirs(newpath) + oldname = collapsepath(oldname) + newname = collapsepath(newname) + local oldtime = lfs.attributes(oldname,'modification') or 0 + local newtime = lfs.attributes(newname,'modification') or 0 + if newtime == 0 or oldtime > newtime then + if trace_conversion then + report_inclusion("converting '%s' (%s) from '%s' to '%s'",askedname,oldname,format,newformat) end - if resolution and resolution ~= "" then -- the order might change - newbase = newbase .. "_" .. resolution + converter(oldname,newname,resolution or "") + else + if trace_conversion then + report_inclusion("no need to convert '%s' (%s) from '%s' to '%s'",askedname,oldname,format,newformat) end - -- - -- see *, we had: - -- - -- local newbase = file.addsuffix(newbase,newformat) - -- - -- but now have (result of Aditya's web image testing): - -- - -- as a side effect we can now have multiple fetches with different - -- original formats, not that it matters much (apart from older conversions - -- sticking around) - -- - local newbase = newbase .. "." .. newformat - -- - local newname = file.join(newpath,newbase) - dir.makedirs(newpath) - oldname = file.collapsepath(oldname) - newname = file.collapsepath(newname) - local oldtime = lfs.attributes(oldname,'modification') or 0 - local newtime = lfs.attributes(newname,'modification') or 0 - if newtime == 0 or oldtime > newtime then - if trace_conversion then - report_inclusion("converting '%s' (%s) from '%s' to '%s'",askedname,oldname,format,newformat) - end - converter(oldname,newname,resolution or "") - else - if trace_conversion then - report_inclusion("no need to convert '%s' (%s) from '%s' to '%s'",askedname,oldname,format,newformat) - end - end - if io.exists(newname) and io.size(newname) > 0 then - specification.foundname = oldname - specification.fullname = newname - specification.prefix = prefix - specification.subpath = subpath - specification.converted = true - format = newformat - if not figures.suffixes[format] then - -- maybe the new format is lowres.png (saves entry in suffixes) - -- so let's do thsi extra check - local suffix = file.suffix(newformat) - if figures.suffixes[suffix] then - if trace_figures then - report_inclusion("using suffix '%s' as format for '%s'",suffix,format) - end - format = suffix + end + if io.exists(newname) and io.size(newname) > 0 then + specification.foundname = oldname + specification.fullname = newname + specification.prefix = prefix + specification.subpath = subpath + specification.converted = true + format = newformat + if not figures_suffixes[format] then + -- maybe the new format is lowres.png (saves entry in suffixes) + -- so let's do thsi extra check + local suffix = file.suffix(newformat) + if figures_suffixes[suffix] then + if trace_figures then + report_inclusion("using suffix '%s' as format for '%s'",suffix,format) end + format = suffix end - elseif io.exists(oldname) then - specification.fullname = oldname -- was newname - specification.converted = false end + elseif io.exists(oldname) then + specification.fullname = oldname -- was newname + specification.converted = false end end - local found = figures.suffixes[format] -- validtypes[format] - if not found then - specification.found = false - if trace_figures then - report_inclusion("format not supported: %s",format) - end - else - specification.found = true - if trace_figures then - if validtypes[format] then -- format? - report_inclusion("format natively supported by backend: %s",format) - else - report_inclusion("format supported by output file format: %s",format) - end + end + local found = figures_suffixes[format] -- validtypes[format] + if not found then + specification.found = false + if trace_figures then + report_inclusion("format not supported: %s",format) + end + else + specification.found = true + if trace_figures then + if validtypes[format] then -- format? + report_inclusion("format natively supported by backend: %s",format) + else + report_inclusion("format supported by output file format: %s",format) end end end - else - specification = { } end specification.foundname = specification.foundname or specification.fullname - figures.found[askedname .. "->" .. (specification.conversion or "default") .. "->" .. (specification.resolution or "default")] = specification + local askedhash = format("%s->%s->%s",askedname,specification.conversion or "default",specification.resolution or "default") + figures_found[askedhash] = specification return specification end @@ -614,7 +625,8 @@ local function locate(request) -- name, format, cache -- not resolvers.cleanpath(request.name) as it fails on a!b.pdf and b~c.pdf -- todo: more restricted cleanpath local askedname = request.name - local foundname = figures.found[askedname .. "->" .. (request.conversion or "default") .. "->" .. (request.resolution or "default")] + local askedhash = format("%s->%s->%s",askedname,request.conversion or "default",request.resolution or "default") + local foundname = figures_found[askedhash] if foundname then return foundname end @@ -636,7 +648,7 @@ local function locate(request) -- name, format, cache -- we could use the hashed data instead local askedpath= file.is_rootbased_path(askedname) local askedbase = file.basename(askedname) - local askedformat = (request.format ~= "" and request.format ~= "unknown" and request.format) or file.suffix(askedname) or "" + local askedformat = request.format ~= "" and request.format ~= "unknown" and request.format or file.suffix(askedname) or "" local askedcache = request.cache local askedconversion = request.conversion local askedresolution = request.resolution @@ -645,11 +657,10 @@ local function locate(request) -- name, format, cache if trace_figures then report_inclusion("strategy: forced format %s",askedformat) end - local format = figures.suffixes[askedformat] + local format = figures_suffixes[askedformat] if not format then - local figurepatterns = figures.patterns - for i=1,#figurepatterns do - local pattern = figurepatterns[i] + for i=1,#figures_patterns do + local pattern = figures_patterns[i] if find(askedformat,pattern[1]) then format = pattern[2] break @@ -689,9 +700,8 @@ local function locate(request) -- name, format, cache end else -- type given - local figurepaths = figures.paths - for i=1,#figurepaths do - local path = figurepaths[i] + for i=1,#figure_paths do + local path = figure_paths[i] local check = path .. "/" .. askedname -- we pass 'true' as it can be an url as well, as the type -- is given we don't waste much time @@ -725,9 +735,9 @@ local function locate(request) -- name, format, cache if trace_figures then report_inclusion("strategy: rootbased path") end - for i=1,#lookuporder do - local format = lookuporder[i] - local list = formats[format].list or { format } + for i=1,#figures_order do + local format = figures_order[i] + local list = figures_formats[format].list or { format } for j=1,#list do local suffix = list[j] local check = file.addsuffix(askedname,suffix) @@ -749,16 +759,15 @@ local function locate(request) -- name, format, cache if trace_figures then report_inclusion("strategy: unknown format, prefer quality") end - local figurepaths = figures.paths - for j=1,#lookuporder do - local format = lookuporder[j] - local list = formats[format].list or { format } + for j=1,#figures_order do + local format = figures_order[j] + local list = figures_formats[format].list or { format } for k=1,#list do local suffix = list[k] -- local name = file.replacesuffix(askedbase,suffix) local name = file.replacesuffix(askedname,suffix) - for i=1,#figurepaths do - local path = figurepaths[i] + for i=1,#figure_paths do + local path = figure_paths[i] local check = path .. "/" .. name local isfile = url.hashed(check).scheme == "file" if not isfile then @@ -785,12 +794,11 @@ local function locate(request) -- name, format, cache if trace_figures then report_inclusion("strategy: unknown format, prefer path") end - local figurepaths = figures.paths - for i=1,#figurepaths do - local path = figurepaths[i] - for j=1,#lookuporder do - local format = lookuporder[j] - local list = formats[format].list or { format } + for i=1,#figure_paths do + local path = figure_paths[i] + for j=1,#figures_order do + local format = figures_order[j] + local list = figures_formats[format].list or { format } for k=1,#list do local suffix = list[k] local check = path .. "/" .. file.replacesuffix(askedbase,suffix) @@ -813,9 +821,9 @@ local function locate(request) -- name, format, cache if trace_figures then report_inclusion("strategy: default tex path") end - for j=1,#lookuporder do - local format = lookuporder[j] - local list = formats[format].list or { format } + for j=1,#figures_order do + local format = figures_order[j] + local list = figures_formats[format].list or { format } for k=1,#list do local suffix = list[k] local check = resolvers.findfile(file.replacesuffix(askedname,suffix)) @@ -857,7 +865,7 @@ function identifiers.default(data) end function figures.identify(data) - data = data or figures.current() + data = data or callstack[#callstack] or lastfiguredata local list = identifiers.list -- defined at the end for i=1,#list do local identifier = list[i] @@ -874,12 +882,12 @@ function figures.exists(askedname,format,resolve) end function figures.check(data) - data = data or figures.current() + data = data or callstack[#callstack] or lastfiguredata return (checkers[data.status.format] or checkers.generic)(data) end function figures.include(data) - data = data or figures.current() + data = data or callstack[#callstack] or lastfiguredata return (includers[data.status.format] or includers.generic)(data) end @@ -890,8 +898,7 @@ end function figures.done(data) figures.nofprocessed = figures.nofprocessed + 1 - data = data or figures.current() ---~ print(table.serialize(figures.current())) + data = data or callstack[#callstack] or lastfiguredata local dr, du, ds, nr = data.request, data.used, data.status, figures.boxnumber local box = texbox[nr] ds.width = box.width @@ -899,18 +906,17 @@ function figures.done(data) ds.xscale = ds.width /(du.width or 1) ds.yscale = ds.height/(du.height or 1) ds.page = ds.page or du.page or dr.page -- sort of redundant but can be limited ---~ print(table.serialize(figures.current())) return data end function figures.dummy(data) - data = data or figures.current() + data = data or callstack[#callstack] or lastfiguredata local dr, du, nr = data.request, data.used, figures.boxnumber - local box = node.hpack(node.new("hlist")) -- we need to set the dir (luatex 0.60 buglet) - du.width = du.width or figures.defaultwidth - du.height = du.height or figures.defaultheight - du.depth = du.depth or figures.defaultdepth - -- box.dir = "TLT" + local box = node.hpack(node.new("hlist")) -- we need to set the dir (luatex 0.60 buglet) + du.width = du.width or figures.defaultwidth + du.height = du.height or figures.defaultheight + du.depth = du.depth or figures.defaultdepth + -- box.dir = "TLT" box.width = du.width box.height = du.height box.depth = du.depth @@ -953,8 +959,8 @@ function checkers.generic(data) if not resolution or resolution == "" then resolution = "unknown" end - local hash = name .. "->" .. page .. "->" .. size .. "->" .. color .. "->" .. conversion .. "->" .. resolution .. "->" .. mask - local figure = figures.loaded[hash] + local hash = format("%s->%s->%s->%s->%s->%s->%s",name,page,size,color,conversion,resolution,mask) + local figure = figures_loaded[hash] if figure == nil then figure = img.new { filename = name, @@ -964,10 +970,10 @@ function checkers.generic(data) } codeinjections.setfigurecolorspace(data,figure) codeinjections.setfiguremask(data,figure) - figure = (figure and img.scan(figure)) or false + figure = figure and img.scan(figure) or false local f, d = codeinjections.setfigurealternative(data,figure) figure, data = f or figure, d or data - figures.loaded[hash] = figure + figures_loaded[hash] = figure if trace_conversion then report_inclusion("new graphic, hash: %s",hash) end @@ -977,17 +983,17 @@ function checkers.generic(data) end end if figure then - du.width = figure.width - du.height = figure.height - du.pages = figure.pages - du.depth = figure.depth or 0 - du.colordepth = figure.colordepth or 0 + du.width = figure.width + du.height = figure.height + du.pages = figure.pages + du.depth = figure.depth or 0 + du.colordepth = figure.colordepth or 0 du.xresolution = figure.xres or 0 du.yresolution = figure.yres or 0 - du.xsize = figure.xsize or 0 - du.ysize = figure.ysize or 0 - ds.private = figure - ds.hash = hash + du.xsize = figure.xsize or 0 + du.ysize = figure.ysize or 0 + ds.private = figure + ds.hash = hash end return data end @@ -998,19 +1004,19 @@ function includers.generic(data) dr.width = du.width dr.height = du.height local hash = figures.hash(data) - local figure = figures.used[hash] ---~ figures.registerresource { ---~ filename = du.fullname, ---~ width = dr.width, ---~ height = dr.height, ---~ } + local figure = figures_used[hash] + -- figures.registerresource { + -- filename = du.fullname, + -- width = dr.width, + -- height = dr.height, + -- } if figure == nil then figure = ds.private if figure then figure = img.copy(figure) - figure = (figure and img.clone(figure,data.request)) or false + figure = figure and img.clone(figure,data.request) or false end - figures.used[hash] = figure + figures_used[hash] = figure end if figure then local nr = figures.boxnumber @@ -1027,7 +1033,7 @@ end -- -- -- nongeneric -- -- -- -function checkers.nongeneric(data,command) -- todo: macros and context.* +local function checkers_nongeneric(data,command) -- todo: macros and context.* local dr, du, ds = data.request, data.used, data.status local name = du.fullname or "unknown nongeneric" local hash = name @@ -1046,10 +1052,13 @@ function checkers.nongeneric(data,command) -- todo: macros and context.* return data end -function includers.nongeneric(data) +local function includers_nongeneric(data) return data end +checkers.nongeneric = checkers_nongeneric +includers.nongeneric = includers_nongeneric + -- -- -- mov -- -- -- function checkers.mov(data) @@ -1105,9 +1114,9 @@ end function checkers.mps(data) local mprun, mpnum = internal(data.used.fullname) if mpnum then - return checkers.nongeneric(data,function() context.docheckfiguremprun(mprun,mpnum) end) + return checkers_nongeneric(data,function() context.docheckfiguremprun(mprun,mpnum) end) else - return checkers.nongeneric(data,function() context.docheckfiguremps(data.used.fullname) end) + return checkers_nongeneric(data,function() context.docheckfiguremps(data.used.fullname) end) end end @@ -1117,11 +1126,11 @@ includers.mps = includers.nongeneric function existers.tex(askedname) askedname = resolvers.findfile(askedname) - return (askedname ~= "" and askedname) or false + return askedname ~= "" and askedname or false end function checkers.tex(data) - return checkers.nongeneric(data,function() context.docheckfiguretex(data.used.fullname) end) + return checkers_nongeneric(data,function() context.docheckfiguretex(data.used.fullname) end) end includers.tex = includers.nongeneric @@ -1135,7 +1144,7 @@ function existers.buffer(askedname) end function checkers.buffer(data) - return checkers.nongeneric(data,function() context.docheckfigurebuffer(file.nameonly(data.used.fullname)) end) + return checkers_nongeneric(data,function() context.docheckfigurebuffer(file.nameonly(data.used.fullname)) end) end includers.buffers = includers.nongeneric @@ -1161,7 +1170,7 @@ includers.auto = includers.generic existers.cld = existers.tex function checkers.cld(data) - return checkers.nongeneric(data,function() context.docheckfigurecld(data.used.fullname) end) + return checkers_nongeneric(data,function() context.docheckfigurecld(data.used.fullname) end) end includers.cld = includers.nongeneric @@ -1190,9 +1199,9 @@ end -- -- -- eps -- -- -- -local epsconverter = { } -converters.eps = epsconverter -converters.ps = epsconverter +local epsconverter = { } +converters.eps = epsconverter +converters.ps = epsconverter programs.gs = { resolutions = { @@ -1223,9 +1232,9 @@ epsconverter.default = epsconverter.pdf -- -- -- svg -- -- -- -local svgconverter = { } -converters.svg = svgconverter -converters.svgz = svgconverter +local svgconverter = { } +converters.svg = svgconverter +converters.svgz = svgconverter -- inkscape on windows only works with complete paths @@ -1259,7 +1268,7 @@ svgconverter.default = svgconverter.pdf -- -- -- gif -- -- -- local gifconverter = { } -converters.gif = gifconverter +converters.gif = gifconverter programs.convert = { command = "gm convert" -- graphicmagick @@ -1280,21 +1289,17 @@ gifconverter.default = gifconverter.pdf -- http://sourceforge.net/projects/gnuwin32/files/tiff/3.8.2-1/tiff-3.8.2-1-bin.zip/download local tifconverter = { } -converters.tif = tifconverter +converters.tif = tifconverter programs.convert = { ---~ command = "convert" -- imagemagick command = "gm convert" -- graphicmagick ---~ command = "tiff2pdf" } function tifconverter.pdf(oldname,newname) local convert = programs.convert runprogram ( - "%s %s %s %s", + "%s %s %s %s", -- "%s %s -z -o %s %s" convert.command, makeoptions(convert.options), oldname, newname ---~ "%s %s -z -o %s %s", ---~ convert.command, makeoptions(convert.options), newname, oldname ) end @@ -1304,25 +1309,36 @@ tifconverter.default = tifconverter.pdf -- -- -- bases -- -- -- -figures.bases = { } -figures.bases.list = { } -- index => { basename, fullname, xmlroot } -figures.bases.used = { } -- [basename] => { basename, fullname, xmlroot } -- pointer to list -figures.bases.found = { } -figures.bases.enabled = false +local bases = { } + +local bases_list = nil -- index => { basename, fullname, xmlroot } +local bases_used = nil -- [basename] => { basename, fullname, xmlroot } -- pointer to list +local bases_found = nil +local bases_enabled = false + +local function reset() + bases_list = allocate() + bases_used = allocate() + bases_found = allocate() + bases_enabled = false + bases.list = bases_list + bases.used = bases_used + bases.found = bases_found +end -local bases = figures.bases +reset() function bases.use(basename) if basename == "reset" then - bases.list, bases.used, bases.found, bases.enabled = { }, { }, { }, false + reset() else basename = file.addsuffix(basename,"xml") - if not bases.used[basename] then + if not bases_used[basename] then local t = { basename, nil, nil } - bases.used[basename] = t - bases.list[#bases.list+1] = t - if not bases.enabled then - bases.enabled = true + bases_used[basename] = t + bases_list[#bases_list+1] = t + if not bases_enabled then + bases_enabled = true xml.registerns("rlx","http://www.pragma-ade.com/schemas/rlx") -- we should be able to do this per xml file end if trace_bases then @@ -1332,20 +1348,19 @@ function bases.use(basename) end end -function bases.find(basename,askedlabel) +local function bases_find(basename,askedlabel) if trace_bases then report_inclusion("checking for '%s' in base '%s'",askedlabel,basename) end basename = file.addsuffix(basename,"xml") - local t = bases.found[askedlabel] + local t = bases_found[askedlabel] if t == nil then - local base = bases.used[basename] + local base = bases_used[basename] local page = 0 if base[2] == nil then -- no yet located - local figurepaths = figures.paths - for i=1,#figurepaths do - local path = figurepaths[i] + for i=1,#figure_paths do + local path = figure_paths[i] local xmlfile = path .. "/" .. basename if io.exists(xmlfile) then base[2] = xmlfile @@ -1368,7 +1383,7 @@ function bases.find(basename,askedlabel) name = xml.text(e,"../*:file"), -- to be checked page = page, } - bases.found[askedlabel] = t + bases_found[askedlabel] = t if trace_bases then report_inclusion("figure '%s' found in base '%s'",askedlabel,base[2]) end @@ -1385,11 +1400,10 @@ end -- we can access sequential or by name -function bases.locate(askedlabel) - local list = bases.list - for i=1,#list do - local entry = list[i] - local t = bases.find(entry[1],askedlabel) +local function bases_locate(askedlabel) + for i=1,#bases_list do + local entry = bases_list[i] + local t = bases_find(entry[1],askedlabel) if t then return t end @@ -1398,9 +1412,9 @@ function bases.locate(askedlabel) end function identifiers.base(data) - if bases.enabled then + if bases_enabled then local dr, du, ds = data.request, data.used, data.status - local fbl = bases.locate(dr.name or dr.label) + local fbl = bases_locate(dr.name or dr.label) if fbl then du.page = fbl.page du.format = fbl.format @@ -1414,6 +1428,9 @@ function identifiers.base(data) return data end +bases.locate = bases_locate +bases.find = bases_find + identifiers.list = { identifiers.base, identifiers.default diff --git a/tex/context/base/grph-inc.mkiv b/tex/context/base/grph-inc.mkiv index f96812d26..70b7f8df2 100644 --- a/tex/context/base/grph-inc.mkiv +++ b/tex/context/base/grph-inc.mkiv @@ -93,6 +93,7 @@ \c!frames =\v!off, \c!ymax =24, \c!xmax =, + \c!align =\v!none, % New, for Tacos extremely large graphics. ] %D Defining figures. @@ -422,36 +423,36 @@ \def\defaultfigurewidth {8\lineheight} \def\defaultfigureheight {6\lineheight} -\def\figurestatus {\numexpr\ctxlua{figures.tprint("status","status",0)}\relax} % number: 0 = not found -\def\figurewidth {\ctxlua{figures.tprint("status","width",0)}sp} -\def\figureheight {\ctxlua{figures.tprint("status","height",0)}sp} -\def\figurexscale {\ctxlua{figures.tprint("status","xscale",1)}} -\def\figureyscale {\ctxlua{figures.tprint("status","yscale",1)}} - -\def\figuresize {\ctxlua{figures.tprint("request","size")}} -\def\figurelabel {\ctxlua{figures.tprint("request","label")}} -\def\figurefileoriginal {\ctxlua{figures.tprint("request","name")}} -\def\figurefilepage {\ctxlua{figures.tprint("request","page",1)}} -\def\figurefileoptions {\ctxlua{figures.tprint("request","options")}} -\def\figurefileconversion{\ctxlua{figures.tprint("request","conversion")}} -\def\figurefilecache {\ctxlua{figures.tprint("request","cache")}} -\def\figurefileprefix {\ctxlua{figures.tprint("request","prefix")}} - -\def\figurenaturalwidth {\ctxlua{figures.tprint("used","width", \number\dimexpr\defaultfigurewidth \relax)}sp} -\def\figurenaturalheight {\ctxlua{figures.tprint("used","height",\number\dimexpr\defaultfigureheight\relax)}sp} -\def\figurexresolution {\ctxlua{figures.tprint("used","xresolution",0)}} -\def\figureyresolution {\ctxlua{figures.tprint("used","yresolution",0)}} -\def\figurexsize {\ctxlua{figures.tprint("used","xsize",0)}} -\def\figureysize {\ctxlua{figures.tprint("used","ysize",0)}} -\def\figurecolordepth {\ctxlua{figures.tprint("used","colordepth",0)}} -\def\figuredepth {\ctxlua{figures.tprint("used","depth",0)}} - -\def\figurefullname {\ctxlua{figures.tprint("used","fullname")}} -\def\noffigurepages {\ctxlua{figures.tprint("used","pages",0)}} - -\def\figurefilepath {\cldcontext{file.dirname (figures.get("used","fullname"))}} -\def\figurefilename {\cldcontext{file.nameonly(figures.get("used","fullname"))}} -\def\figurefiletype {\cldcontext{file.extname (figures.get("used","fullname"))}} +\def\figurestatus {\numexpr\ctxcommand{figurestatus("status",0)}\relax} % number: 0 = not found +\def\figurewidth {\ctxcommand{figurestatus("width",0)}sp} +\def\figureheight {\ctxcommand{figurestatus("height",0)}sp} +\def\figurexscale {\ctxcommand{figurestatus("xscale",1)}} +\def\figureyscale {\ctxcommand{figurestatus("yscale",1)}} + +\def\figuresize {\ctxcommand{figurerequest("size")}} +\def\figurelabel {\ctxcommand{figurerequest("label")}} +\def\figurefileoriginal {\ctxcommand{figurerequest("name")}} +\def\figurefilepage {\ctxcommand{figurerequest("page",1)}} +\def\figurefileoptions {\ctxcommand{figurerequest("options")}} +\def\figurefileconversion{\ctxcommand{figurerequest("conversion")}} +\def\figurefilecache {\ctxcommand{figurerequest("cache")}} +\def\figurefileprefix {\ctxcommand{figurerequest("prefix")}} + +\def\figurenaturalwidth {\ctxcommand{figureused("width", \number\dimexpr\defaultfigurewidth \relax)}sp} +\def\figurenaturalheight {\ctxcommand{figureused("height",\number\dimexpr\defaultfigureheight\relax)}sp} +\def\figurexresolution {\ctxcommand{figureused("xresolution",0)}} +\def\figureyresolution {\ctxcommand{figureused("yresolution",0)}} +\def\figurexsize {\ctxcommand{figureused("xsize",0)}} +\def\figureysize {\ctxcommand{figureused("ysize",0)}} +\def\figurecolordepth {\ctxcommand{figureused("colordepth",0)}} +\def\figuredepth {\ctxcommand{figureused("depth",0)}} + +\def\figurefullname {\ctxcommand{figureused("fullname")}} +\def\noffigurepages {\ctxcommand{figureused("pages",0)}} + +\def\figurefilepath {\ctxcommand{figurefilepath()}} +\def\figurefilename {\ctxcommand{figurefilename()}} +\def\figurefiletype {\ctxcommand{figurefiletype()}} \let\naturalfigurewidth \figurenaturalwidth \let\naturalfigureheight \figurenaturalheight @@ -667,6 +668,7 @@ \letexternalfigureparameter\c!height\figureheight \letexternalfigureparameter\c!background\v!color \setexternalfigureparameter\c!backgroundcolor{missingfigurecolor}% + \setexternalfigureparameter\c!align{\v!middle,\v!lohi}% we default to \v!none \inheritedexternalfigureframed {\tt\tfxx \nohyphens name: \expanded{\verbatimstring{#1}}\\% diff --git a/tex/context/base/l-table.lua b/tex/context/base/l-table.lua index 9d5bf0904..c95696553 100644 --- a/tex/context/base/l-table.lua +++ b/tex/context/base/l-table.lua @@ -1000,7 +1000,8 @@ function table.unique(old) return new end --- function table.sorted(t,...) --- table.sort(t,...) --- return t -- still sorts in-place --- end +function table.sorted(t,...) + sort(t,...) + return t -- still sorts in-place +end + diff --git a/tex/context/base/lang-lab.lua b/tex/context/base/lang-lab.lua index 8d48a4988..755f236cf 100644 --- a/tex/context/base/lang-lab.lua +++ b/tex/context/base/lang-lab.lua @@ -163,21 +163,35 @@ commands.definelabels = labels.define -- context(string.strip(str)) -- end -function commands.concatcommalist(settings) -- it's too easy to forget that this one is there - local list = settings_to_array(settings.text or "") +-- list : { "a", "b", "c" } +-- separator : ", " +-- last : " and " + +-- text : "a,b,c" +-- separators : "{, },{ and }" + +function commands.concat(settings) -- it's too easy to forget that this one is there + local list = settings.list or settings_to_array(settings.text or "") local size = #list + local command = settings.command and context[settings.command] or context if size > 1 then - local set = settings_to_array(settings.separators or "") - local one = set[1] or settings.first or " " - local two = set[2] or settings.second or " " + local separator, last = " ", " " + if settings.separators then + local set = settings_to_array(settings.separators) + separator = set[1] or settings.separator or separator + last = set[2] or settings.last or last + else + separator = settings.separator or separator + last = settings.last or last + end context(list[1]) for i=2,size-1 do - context(one) - context(list[i]) + context(separator) + command(list[i]) end - context(two) + context(last) end if size > 0 then - context(list[size]) + command(list[size]) end end diff --git a/tex/context/base/meta-ini.mkiv b/tex/context/base/meta-ini.mkiv index cd4e03bd6..536621c97 100644 --- a/tex/context/base/meta-ini.mkiv +++ b/tex/context/base/meta-ini.mkiv @@ -149,10 +149,22 @@ \def\MPaskedfigure{false} \def\meta_flush_current_initializations - {\ifconditional\c_meta_include_initializations\the\t_meta_initializations;\fi\theMPrandomseed;} + {\ifconditional\c_meta_include_initializations + \the\t_meta_initializations;% + \fi + \theMPrandomseed;} \def\meta_flush_current_preamble - {\ifconditional\c_meta_include_extensions\the\t_meta_extensions;\the\t_meta_userinclusions;\fi\the\t_meta_instance;} + {\ifconditional\c_meta_include_extensions + \the\t_meta_extensions;% + \the\t_meta_userinclusions;% + \fi + \the\t_meta_instance;} + +\def\meta_reset_current_preamble + {\ifconditional\c_meta_include_extensions + \global\t_meta_extensions\emptytoks + \fi} \def\meta_start_current_graphic {\begingroup @@ -164,7 +176,7 @@ \edef\p_extensions{\MPinstanceparameter\s!extensions}% \ifx\p_extensions\v!yes \settrue \c_meta_include_extensions - \global\letMPinstanceparameter\s!extensions\v!no % needs checking + %\global\letMPinstanceparameter\s!extensions\v!no % needs checking \else \setfalse\c_meta_include_extensions \fi @@ -204,6 +216,7 @@ "\MPaskedfigure" )}}% \meta_process_graphic_stop + \meta_reset_current_preamble \meta_stop_current_graphic} \let\meta_process_graphic_figure_start\relax @@ -307,6 +320,7 @@ \!!bs\meta_flush_current_preamble\!!es )}}}% \meta_stop_current_graphic + \meta_reset_current_preamble \ifx\MPclippath\empty \xdef\MPclippath{#4}% \fi diff --git a/tex/context/base/mlib-run.lua b/tex/context/base/mlib-run.lua index 08ed22e47..cdd6c3bd5 100644 --- a/tex/context/base/mlib-run.lua +++ b/tex/context/base/mlib-run.lua @@ -52,7 +52,8 @@ metapost.lastlog = "" metapost.texerrors = false metapost.exectime = metapost.exectime or { } -- hack -directives.register("mplib.texerrors", function(v) metapost.texerrors = v end) +directives.register("mplib.texerrors", function(v) metapost.texerrors = v end) +trackers.register ("metapost.showlog", function(v) metapost.showlog = v end) function metapost.resetlastlog() metapost.lastlog = "" diff --git a/tex/context/base/mult-def.mkiv b/tex/context/base/mult-def.mkiv index 0ee59d8c3..ceb15de90 100644 --- a/tex/context/base/mult-def.mkiv +++ b/tex/context/base/mult-def.mkiv @@ -65,6 +65,7 @@ \def\v!unframed {unframed} \def\v!chemical {chemical} \def\v!chemicals {chemicals} +\def\v!words {words} \def\s!lcgreek {lcgreek} \def\s!ucgreek {ucgreek} diff --git a/tex/context/base/node-rul.lua b/tex/context/base/node-rul.lua index d81016af0..9dba642f2 100644 --- a/tex/context/base/node-rul.lua +++ b/tex/context/base/node-rul.lua @@ -62,60 +62,59 @@ end local floor = math.floor -local trace_ruled = false trackers.register("nodes.rules", function(v) trace_ruled = v end) +local trace_ruled = false trackers.register("nodes.rules", function(v) trace_ruled = v end) +local report_ruled = logs.reporter("nodes","rules") -local report_ruled = logs.reporter("nodes","rules") +local n_tostring = nodes.idstostring +local n_tosequence = nodes.tosequence -local n_tostring = nodes.idstostring -local n_tosequence = nodes.tosequence +local a_ruled = attributes.private('ruled') +local a_color = attributes.private('color') +local a_transparency = attributes.private('transparency') +local a_colorspace = attributes.private('colormodel') -local a_ruled = attributes.private('ruled') -local a_color = attributes.private('color') -local a_transparency = attributes.private('transparency') -local a_colorspace = attributes.private('colormodel') +local insert_node_before = node.insert_before +local insert_node_after = node.insert_after +local striprange = nodes.striprange +local list_dimensions = node.dimensions +local has_attribute = node.has_attribute +local set_attribute = node.set_attribute -local insert_before = node.insert_before -local insert_after = node.insert_after -local striprange = nodes.striprange -local list_dimensions = node.dimensions -local has_attribute = node.has_attribute -local set_attribute = node.set_attribute +local hpack_nodes = node.hpack -local hpack_nodes = node.hpack +local fontdata = fonts.hashes.identifiers +local variables = interfaces.variables +local dimenfactor = fonts.helpers.dimenfactor +local splitdimen = number.splitdimen -local fontdata = fonts.hashes.identifiers -local variables = interfaces.variables -local dimenfactor = fonts.helpers.dimenfactor -local splitdimen = number.splitdimen +local nodecodes = nodes.nodecodes +local skipcodes = nodes.skipcodes +local whatcodes = nodes.whatcodes +local kerncodes = nodes.kerncodes -local nodecodes = nodes.nodecodes -local skipcodes = nodes.skipcodes -local whatcodes = nodes.whatcodes -local kerncodes = nodes.kerncodes +local glyph_code = nodecodes.glyph +local disc_code = nodecodes.disc +local glue_code = nodecodes.glue +local penalty_code = nodecodes.penalty +local kern_code = nodecodes.kern +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist +local rule_code = nodecodes.rule +local whatsit_code = nodecodes.whatsit -local glyph_code = nodecodes.glyph -local disc_code = nodecodes.disc -local glue_code = nodecodes.glue -local penalty_code = nodecodes.penalty -local kern_code = nodecodes.kern -local hlist_code = nodecodes.hlist -local vlist_code = nodecodes.vlist -local rule_code = nodecodes.rule -local whatsit_code = nodecodes.whatsit +local userskip_code = skipcodes.userskip +local spaceskip_code = skipcodes.spaceskip +local xspaceskip_code = skipcodes.xspaceskip -local userskip_code = skipcodes.userskip -local spaceskip_code = skipcodes.spaceskip -local xspaceskip_code = skipcodes.xspaceskip +local dir_code = whatcodes.dir -local dir_code = whatcodes.dir +local kerning_code = kerncodes.kern -local kerning_code = kerncodes.kern +local nodepool = nodes.pool -local nodepool = nodes.pool - -local new_rule = nodepool.rule -local new_kern = nodepool.kern -local new_glue = nodepool.glue +local new_rule = nodepool.rule +local new_kern = nodepool.kern +local new_glue = nodepool.glue -- we can use this one elsewhere too -- @@ -312,12 +311,12 @@ local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but a end local k = new_kern(-w) if foreground then - insert_after(head,l,k) - insert_after(head,k,r) + insert_node_after(head,l,k) + insert_node_after(head,k,r) l = r else - head = insert_before(head,f,r) - insert_after(head,r,k) + head = insert_node_before(head,f,r) + insert_node_after(head,r,k) end if trace_ruled then report_ruled("level: %s, width: %i, height: %i, depth: %i, nodes: %s, text: %s", diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex e0e66e4c3..e61ed0c0c 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex 4e2f295ee..095fedbc0 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/strc-lst.mkvi b/tex/context/base/strc-lst.mkvi index 965e53700..2aee09fbe 100644 --- a/tex/context/base/strc-lst.mkvi +++ b/tex/context/base/strc-lst.mkvi @@ -364,8 +364,8 @@ \unexpanded\def\structurelistfirst {\structurelistuservariable\s!first } % s! \unexpanded\def\structurelistsecond{\structurelistuservariable\s!second} % s! -\unexpanded\def\rawstructurelistfirst {\rawstructurelistuservariable\s!first } % s! -\unexpanded\def\rawstructurelistsecond{\rawstructurelistuservariable\s!second} % s! +\def\rawstructurelistfirst {\rawstructurelistuservariable\s!first } % s! % was \unexpanded +\def\rawstructurelistsecond{\rawstructurelistuservariable\s!second} % s! % was \unexpanded \unexpanded\def\doifstructurelisthaspageelse {\ctxcommand{doiflisthaspageelse("\currentlist",\currentlistindex)}} diff --git a/tex/context/base/trac-vis.lua b/tex/context/base/trac-vis.lua index 3876d0907..31821ab3f 100644 --- a/tex/context/base/trac-vis.lua +++ b/tex/context/base/trac-vis.lua @@ -70,8 +70,8 @@ local free_node_list = node.flush_list local has_attribute = node.has_attribute local set_attribute = node.set_attribute local unset_attribute = node.unset_attribute -local insert_before = node.insert_before -local insert_after = node.insert_after +local insert_node_before = node.insert_node_before +local insert_node_after = node.insert_node_after local fast_hpack = nodes.fasthpack local tex_attribute = tex.attribute @@ -337,7 +337,7 @@ local function fontkern(head,current) info.depth = 0 f_cache[kern] = info end - head = insert_before(head,current,copy_list(info)) + head = insert_node_before(head,current,copy_list(info)) return head, current end @@ -385,7 +385,7 @@ local function whatsit(head,current) set_attribute(info,a_layer,l_whatsit) w_cache[what] = info end - head, current = insert_after(head,current,copy_list(info)) + head, current = insert_node_after(head,current,copy_list(info)) return head, current end @@ -399,7 +399,7 @@ local function user(head,current) set_attribute(info,a_layer,l_user) w_cache[what] = info end - head, current = insert_after(head,current,copy_list(info)) + head, current = insert_node_after(head,current,copy_list(info)) return head, current end @@ -621,7 +621,7 @@ local function ruledglue(head,current,vertical) if vertical then info = vpack_nodes(info) end - head, current = insert_before(head,current,info) + head, current = insert_node_before(head,current,info) return head, current.next end @@ -647,7 +647,7 @@ local function ruledkern(head,current,vertical) if vertical then info = vpack_nodes(info) end - head, current = insert_before(head,current,info) + head, current = insert_node_before(head,current,info) return head, current.next end @@ -673,7 +673,7 @@ local function ruledpenalty(head,current,vertical) if vertical then info = vpack_nodes(info) end - head, current = insert_before(head,current,info) + head, current = insert_node_before(head,current,info) return head, current.next end diff --git a/tex/context/base/typo-dig.lua b/tex/context/base/typo-dig.lua index f11b3b0e3..a3a0feb3e 100644 --- a/tex/context/base/typo-dig.lua +++ b/tex/context/base/typo-dig.lua @@ -19,56 +19,56 @@ local report_digits = logs.reporter("typesetting","digits") local nodes, node = nodes, node -local has_attribute = node.has_attribute -local unset_attribute = node.unset_attribute -local set_attribute = node.set_attribute -local hpack_node = node.hpack -local traverse_id = node.traverse_id -local insert_before = node.insert_before -local insert_after = node.insert_after +local has_attribute = node.has_attribute +local unset_attribute = node.unset_attribute +local set_attribute = node.set_attribute +local hpack_node = node.hpack +local traverse_id = node.traverse_id +local insert_node_before = node.insert_before +local insert_node_after = node.insert_after -local texattribute = tex.attribute -local unsetvalue = attributes.unsetvalue +local texattribute = tex.attribute +local unsetvalue = attributes.unsetvalue -local nodecodes = nodes.nodecodes -local glyph_code = nodecodes.glyph +local nodecodes = nodes.nodecodes +local glyph_code = nodecodes.glyph -local nodepool = nodes.pool -local tasks = nodes.tasks +local nodepool = nodes.pool +local tasks = nodes.tasks -local new_glue = nodepool.glue +local new_glue = nodepool.glue -local fonthashes = fonts.hashes -local fontdata = fonthashes.identifiers -local chardata = fonthashes.characters -local quaddata = fonthashes.quads +local fonthashes = fonts.hashes +local fontdata = fonthashes.identifiers +local chardata = fonthashes.characters +local quaddata = fonthashes.quads -local v_reset = interfaces.variables.reset +local v_reset = interfaces.variables.reset -local charbase = characters.data -local getdigitwidth = fonts.helpers.getdigitwidth +local charbase = characters.data +local getdigitwidth = fonts.helpers.getdigitwidth -typesetters = typesetters or { } -local typesetters = typesetters +typesetters = typesetters or { } +local typesetters = typesetters -typesetters.digits = typesetters.digits or { } -local digits = typesetters.digits +typesetters.digits = typesetters.digits or { } +local digits = typesetters.digits -digits.actions = { } -local actions = digits.actions +digits.actions = { } +local actions = digits.actions -local a_digits = attributes.private("digits") -digits.attribute = a_digits +local a_digits = attributes.private("digits") +digits.attribute = a_digits -- at some point we can manipulate the glyph node so then i need -- to rewrite this then function nodes.aligned(head,start,stop,width,how) if how == "flushright" or how == "middle" then - head, start = insert_before(head,start,new_glue(0,65536,65536)) + head, start = insert_node_before(head,start,new_glue(0,65536,65536)) end if how == "flushleft" or how == "middle" then - head, stop = insert_after(head,stop,new_glue(0,65536,65536)) + head, stop = insert_node_after(head,stop,new_glue(0,65536,65536)) end local prv, nxt = start.prev, stop.next start.prev, stop.next = nil, nil diff --git a/tex/context/base/util-sql-imp-library.lua b/tex/context/base/util-sql-imp-library.lua index 90b6be5fb..374a34350 100644 --- a/tex/context/base/util-sql-imp-library.lua +++ b/tex/context/base/util-sql-imp-library.lua @@ -331,10 +331,10 @@ local function datafetched(specification,query,converter) local callokay, connectionerror, data, keys = pcall(fetched,specification,query,converter) if not callokay then report_state("call error, retrying") - callerror, connectionerror, data, keys = pcall(fetched,specification,query,converter) + callokay, connectionerror, data, keys = pcall(fetched,specification,query,converter) elseif connectionerror then report_state("error: %q, retrying",connectionerror) - callerror, connectionerror, data, keys = pcall(fetched,specification,query,converter) + callokay, connectionerror, data, keys = pcall(fetched,specification,query,converter) end if not callokay then report_state("persistent call error") diff --git a/tex/context/fonts/lm-math.lfg b/tex/context/fonts/lm-math.lfg index a2c095bc2..87c37cd78 100644 --- a/tex/context/fonts/lm-math.lfg +++ b/tex/context/fonts/lm-math.lfg @@ -44,19 +44,19 @@ local five = { { name = "lmroman5-regular.otf", features = "virtualmath", main = true }, { name = "rm-lmr5.tfm", vector = "tex-mr-missing" } , - { name = "lmmi5.tfm", vector = "tex-mi", skewchar=0x7F }, - { name = "lmmi5.tfm", vector = "tex-it", skewchar=0x7F }, - { name = "lmsy5.tfm", vector = "tex-sy", skewchar=0x30, parameters = true } , + { name = "lmmi5.tfm", vector = "tex-mi", skewchar = 0x7F }, + { name = "lmmi5.tfm", vector = "tex-it", skewchar = 0x7F }, + { name = "lmsy5.tfm", vector = "tex-sy", skewchar = 0x30, parameters = true } , { name = "lmex10.tfm", vector = "tex-ex", extension = true } , { name = "msam5.tfm", vector = "tex-ma" }, { name = "msbm5.tfm", vector = "tex-mb" }, { name = "stmary10.afm", vector = "tex-mc" }, -- { name = "rm-lmbx5.tfm", vector = "tex-bf" } , { name = "lmroman5-bold", vector = "tex-bf" } , - { name = "lmmib5.tfm", vector = "tex-bi", skewchar=0x7F } , - { name = "lmsans8-regular.otf", vector = "tex-ss", optional=true }, - { name = "lmmono8-regular.otf", vector = "tex-tt", optional=true }, - { name = "eufm5.tfm", vector = "tex-fraktur", optional=true }, + { name = "lmmib5.tfm", vector = "tex-bi", skewchar = 0x7F } , + { name = "lmsans8-regular.otf", vector = "tex-ss", optional = true }, + { name = "lmmono8-regular.otf", vector = "tex-tt", optional = true }, + { name = "eufm5.tfm", vector = "tex-fraktur", optional = true }, } -- rm-lmr6 : LMMathRoman6-Regular @@ -67,20 +67,20 @@ local five = { local six = { { name = "lmroman6-regular.otf", features = "virtualmath", main = true }, { name = "rm-lmr6.tfm", vector = "tex-mr-missing" } , - { name = "lmmi6.tfm", vector = "tex-mi", skewchar=0x7F }, - { name = "lmmi6.tfm", vector = "tex-it", skewchar=0x7F }, - { name = "lmsy6.tfm", vector = "tex-sy", skewchar=0x30, parameters = true } , + { name = "lmmi6.tfm", vector = "tex-mi", skewchar = 0x7F }, + { name = "lmmi6.tfm", vector = "tex-it", skewchar = 0x7F }, + { name = "lmsy6.tfm", vector = "tex-sy", skewchar = 0x30, parameters = true } , { name = "lmex10.tfm", vector = "tex-ex", extension = true } , { name = "msam5.tfm", vector = "tex-ma" }, { name = "msbm5.tfm", vector = "tex-mb" }, { name = "stmary10.afm", vector = "tex-mc" }, -- { name = "rm-lmbx6.tfm", vector = "tex-bf" } , { name = "lmroman6-bold.otf", vector = "tex-bf" } , - { name = "lmmib5.tfm", vector = "tex-bi", skewchar=0x7F } , - { name = "lmsans8-regular.otf", vector = "tex-ss", optional=true }, - { name = "lmmono8-regular.otf", vector = "tex-tt", optional=true }, - { name = "eufm5.tfm", vector = "tex-fraktur", optional=true }, - { name = "eufb5.tfm", vector = "tex-fraktur-bold", optional=true }, + { name = "lmmib5.tfm", vector = "tex-bi", skewchar = 0x7F } , + { name = "lmsans8-regular.otf", vector = "tex-ss", optional = true }, + { name = "lmmono8-regular.otf", vector = "tex-tt", optional = true }, + { name = "eufm5.tfm", vector = "tex-fraktur", optional = true }, + { name = "eufb5.tfm", vector = "tex-fraktur-bold", optional = true }, } -- rm-lmr7 : LMMathRoman7-Regular @@ -93,20 +93,20 @@ local six = { local seven = { { name = "lmroman7-regular.otf", features = "virtualmath", main = true }, { name = "rm-lmr7.tfm", vector = "tex-mr-missing" } , - { name = "lmmi7.tfm", vector = "tex-mi", skewchar=0x7F }, - { name = "lmmi7.tfm", vector = "tex-it", skewchar=0x7F }, - { name = "lmsy7.tfm", vector = "tex-sy", skewchar=0x30, parameters = true } , + { name = "lmmi7.tfm", vector = "tex-mi", skewchar = 0x7F }, + { name = "lmmi7.tfm", vector = "tex-it", skewchar = 0x7F }, + { name = "lmsy7.tfm", vector = "tex-sy", skewchar = 0x30, parameters = true } , { name = "lmex10.tfm", vector = "tex-ex", extension = true } , { name = "msam7.tfm", vector = "tex-ma" }, { name = "msbm7.tfm", vector = "tex-mb" }, { name = "stmary10.afm", vector = "tex-mc" }, -- { name = "rm-lmbx7.tfm", vector = "tex-bf" } , { name = "lmroman7-bold.otf", vector = "tex-bf" } , - { name = "lmmib7.tfm", vector = "tex-bi", skewchar=0x7F } , - { name = "lmsans8-regular.otf", vector = "tex-ss", optional=true }, - { name = "lmmono8-regular.otf", vector = "tex-tt", optional=true }, - { name = "eufm7.tfm", vector = "tex-fraktur", optional=true }, - { name = "eufb7.tfm", vector = "tex-fraktur-bold", optional=true }, + { name = "lmmib7.tfm", vector = "tex-bi", skewchar = 0x7F } , + { name = "lmsans8-regular.otf", vector = "tex-ss", optional = true }, + { name = "lmmono8-regular.otf", vector = "tex-tt", optional = true }, + { name = "eufm7.tfm", vector = "tex-fraktur", optional = true }, + { name = "eufb7.tfm", vector = "tex-fraktur-bold", optional = true }, } -- rm-lmr8 : LMMathRoman8-Regular @@ -117,20 +117,20 @@ local seven = { local eight = { { name = "lmroman8-regular.otf", features = "virtualmath", main = true }, { name = "rm-lmr8.tfm", vector = "tex-mr-missing" } , - { name = "lmmi8.tfm", vector = "tex-mi", skewchar=0x7F }, - { name = "lmmi8.tfm", vector = "tex-it", skewchar=0x7F }, - { name = "lmsy8.tfm", vector = "tex-sy", skewchar=0x30, parameters = true } , + { name = "lmmi8.tfm", vector = "tex-mi", skewchar = 0x7F }, + { name = "lmmi8.tfm", vector = "tex-it", skewchar = 0x7F }, + { name = "lmsy8.tfm", vector = "tex-sy", skewchar = 0x30, parameters = true } , { name = "lmex10.tfm", vector = "tex-ex", extension = true } , { name = "msam7.tfm", vector = "tex-ma" }, { name = "msbm7.tfm", vector = "tex-mb" }, { name = "stmary10.afm", vector = "tex-mc" }, -- { name = "rm-lmbx8.tfm", vector = "tex-bf" } , { name = "lmroman8-bold.otf", vector = "tex-bf" } , - { name = "lmmib7.tfm", vector = "tex-bi", skewchar=0x7F } , - { name = "lmsans8-regular.otf", vector = "tex-ss", optional=true }, - { name = "lmmono8-regular.otf", vector = "tex-tt", optional=true }, - { name = "eufm7.tfm", vector = "tex-fraktur", optional=true }, - { name = "eufb7.tfm", vector = "tex-fraktur-bold", optional=true }, + { name = "lmmib7.tfm", vector = "tex-bi", skewchar = 0x7F } , + { name = "lmsans8-regular.otf", vector = "tex-ss", optional = true }, + { name = "lmmono8-regular.otf", vector = "tex-tt", optional = true }, + { name = "eufm7.tfm", vector = "tex-fraktur", optional = true }, + { name = "eufb7.tfm", vector = "tex-fraktur-bold", optional = true }, } -- rm-lmr9 : LMMathRoman9-Regular @@ -141,20 +141,20 @@ local eight = { local nine = { { name = "lmroman9-regular.otf", features = "virtualmath", main = true }, { name = "rm-lmr9.tfm", vector = "tex-mr-missing" } , - { name = "lmmi9.tfm", vector = "tex-mi", skewchar=0x7F }, - { name = "lmmi9.tfm", vector = "tex-it", skewchar=0x7F }, - { name = "lmsy9.tfm", vector = "tex-sy", skewchar=0x30, parameters = true } , + { name = "lmmi9.tfm", vector = "tex-mi", skewchar = 0x7F }, + { name = "lmmi9.tfm", vector = "tex-it", skewchar = 0x7F }, + { name = "lmsy9.tfm", vector = "tex-sy", skewchar = 0x30, parameters = true } , { name = "lmex10.tfm", vector = "tex-ex", extension = true } , { name = "msam10.tfm", vector = "tex-ma" }, { name = "msbm10.tfm", vector = "tex-mb" }, { name = "stmary10.afm", vector = "tex-mc" }, -- { name = "rm-lmbx9.tfm", vector = "tex-bf" } , { name = "lmroman9-bold.otf", vector = "tex-bf" } , - { name = "lmmib10.tfm", vector = "tex-bi", skewchar=0x7F } , - { name = "lmsans9-regular.otf", vector = "tex-ss", optional=true }, - { name = "lmmono9-regular.otf", vector = "tex-tt", optional=true }, - { name = "eufm10.tfm", vector = "tex-fraktur", optional=true }, - { name = "eufb10.tfm", vector = "tex-fraktur-bold", optional=true }, + { name = "lmmib10.tfm", vector = "tex-bi", skewchar = 0x7F } , + { name = "lmsans9-regular.otf", vector = "tex-ss", optional = true }, + { name = "lmmono9-regular.otf", vector = "tex-tt", optional = true }, + { name = "eufm10.tfm", vector = "tex-fraktur", optional = true }, + { name = "eufb10.tfm", vector = "tex-fraktur-bold", optional = true }, } -- rm-lmr10 : LMMathRoman10-Regular @@ -168,20 +168,20 @@ local nine = { local ten = { { name = "lmroman10-regular.otf", features = "virtualmath", main = true }, { name = "rm-lmr10.tfm", vector = "tex-mr-missing" } , - { name = "lmmi10.tfm", vector = "tex-mi", skewchar=0x7F }, - { name = "lmmi10.tfm", vector = "tex-it", skewchar=0x7F }, - { name = "lmsy10.tfm", vector = "tex-sy", skewchar=0x30, parameters = true } , + { name = "lmmi10.tfm", vector = "tex-mi", skewchar = 0x7F }, + { name = "lmmi10.tfm", vector = "tex-it", skewchar = 0x7F }, + { name = "lmsy10.tfm", vector = "tex-sy", skewchar = 0x30, parameters = true } , { name = "lmex10.tfm", vector = "tex-ex", extension = true } , { name = "msam10.tfm", vector = "tex-ma" }, { name = "msbm10.tfm", vector = "tex-mb" }, { name = "stmary10.afm", vector = "tex-mc" }, -- { name = "rm-lmbx10.tfm", vector = "tex-bf" } , { name = "lmroman10-bold.otf", vector = "tex-bf" } , - { name = "lmmib10.tfm", vector = "tex-bi", skewchar=0x7F } , - { name = "lmsans10-regular.otf", vector = "tex-ss", optional=true }, - { name = "lmmono10-regular.otf", vector = "tex-tt", optional=true }, - { name = "eufm10.tfm", vector = "tex-fraktur", optional=true }, - { name = "eufb10.tfm", vector = "tex-fraktur-bold", optional=true }, + { name = "lmmib10.tfm", vector = "tex-bi", skewchar = 0x7F } , + { name = "lmsans10-regular.otf", vector = "tex-ss", optional = true }, + { name = "lmmono10-regular.otf", vector = "tex-tt", optional = true }, + { name = "eufm10.tfm", vector = "tex-fraktur", optional = true }, + { name = "eufb10.tfm", vector = "tex-fraktur-bold", optional = true }, } -- rm-lmr12 : LMMathRoman12-Regular @@ -191,20 +191,20 @@ local ten = { local twelve = { { name = "lmroman12-regular.otf", features = "virtualmath", main = true }, { name = "rm-lmr12.tfm", vector = "tex-mr-missing" }, - { name = "lmmi12.tfm", vector = "tex-mi", skewchar=0x7F }, - { name = "lmmi12.tfm", vector = "tex-it", skewchar=0x7F }, - { name = "lmsy10.tfm", vector = "tex-sy", skewchar=0x30, parameters = true } , + { name = "lmmi12.tfm", vector = "tex-mi", skewchar = 0x7F }, + { name = "lmmi12.tfm", vector = "tex-it", skewchar = 0x7F }, + { name = "lmsy10.tfm", vector = "tex-sy", skewchar = 0x30, parameters = true } , { name = "lmex10.tfm", vector = "tex-ex", extension = true } , { name = "msam10.tfm", vector = "tex-ma" }, { name = "msbm10.tfm", vector = "tex-mb" }, { name = "stmary10.afm", vector = "tex-mc" }, -- { name = "rm-lmbx12.tfm", vector = "tex-bf" } , { name = "lmroman12-bold.otf", vector = "tex-bf" } , - { name = "lmmib10.tfm", vector = "tex-bi", skewchar=0x7F } , - { name = "lmsans12-regular.otf", vector = "tex-ss", optional=true }, - { name = "lmmono12-regular.otf", vector = "tex-tt", optional=true }, - { name = "eufm10.tfm", vector = "tex-fraktur", optional=true }, - { name = "eufb10.tfm", vector = "tex-fraktur-bold", optional=true }, + { name = "lmmib10.tfm", vector = "tex-bi", skewchar = 0x7F } , + { name = "lmsans12-regular.otf", vector = "tex-ss", optional = true }, + { name = "lmmono12-regular.otf", vector = "tex-tt", optional = true }, + { name = "eufm10.tfm", vector = "tex-fraktur", optional = true }, + { name = "eufb10.tfm", vector = "tex-fraktur-bold", optional = true }, } -- rm-lmr17 : LMMathRoman17-Regular @@ -212,20 +212,20 @@ local twelve = { local seventeen = { { name = "lmroman17-regular.otf", features = "virtualmath", main = true }, { name = "rm-lmr12.tfm", vector = "tex-mr-missing" } , - { name = "lmmi12.tfm", vector = "tex-mi", skewchar=0x7F }, - { name = "lmmi12.tfm", vector = "tex-it", skewchar=0x7F }, - { name = "lmsy10.tfm", vector = "tex-sy", skewchar=0x30, parameters = true } , + { name = "lmmi12.tfm", vector = "tex-mi", skewchar = 0x7F }, + { name = "lmmi12.tfm", vector = "tex-it", skewchar = 0x7F }, + { name = "lmsy10.tfm", vector = "tex-sy", skewchar = 0x30, parameters = true } , { name = "lmex10.tfm", vector = "tex-ex", extension = true } , { name = "msam10.tfm", vector = "tex-ma" }, { name = "msbm10.tfm", vector = "tex-mb" }, { name = "stmary10.afm", vector = "tex-mc" }, -- { name = "rm-lmbx12.tfm", vector = "tex-bf" } , { name = "lmroman12-bold.otf", vector = "tex-bf" } , - { name = "lmmib10.tfm", vector = "tex-bi", skewchar=0x7F } , - { name = "lmsans17-regular.otf", vector = "tex-ss", optional=true }, - { name = "lmmono17-regular.otf", vector = "tex-tt", optional=true }, - { name = "eufm10.tfm", vector = "tex-fraktur", optional=true }, - { name = "eufb10.tfm", vector = "tex-fraktur-bold", optional=true }, + { name = "lmmib10.tfm", vector = "tex-bi", skewchar = 0x7F } , + { name = "lmsans17-regular.otf", vector = "tex-ss", optional = true }, + { name = "lmmono17-regular.otf", vector = "tex-tt", optional = true }, + { name = "eufm10.tfm", vector = "tex-fraktur", optional = true }, + { name = "eufb10.tfm", vector = "tex-fraktur-bold", optional = true }, } return { diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 4cbdcd152..d0cab53a6 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 11/08/12 12:14:23 +-- merge date : 11/12/12 17:10:25 do -- begin closure to overcome local limits and interference @@ -1162,10 +1162,11 @@ function table.unique(old) return new end --- function table.sorted(t,...) --- table.sort(t,...) --- return t -- still sorts in-place --- end +function table.sorted(t,...) + sort(t,...) + return t -- still sorts in-place +end + end -- closure |