From ecba7ee5768381e147782d6d73815b152f5c504a Mon Sep 17 00:00:00 2001 From: Marius Date: Thu, 12 Sep 2013 13:00:29 +0300 Subject: beta 2013.09.12 11:48 --- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4112 -> 4111 bytes tex/context/base/context.mkiv | 5 +- tex/context/base/font-syn.lua | 167 ++++++++++++--- tex/context/base/math-fen.mkiv | 6 + tex/context/base/meta-fnt.lua | 233 +++++++++++++++++++++ tex/context/base/meta-fnt.mkiv | 36 ++++ tex/context/base/mult-mps.lua | 1 + tex/context/base/status-files.pdf | Bin 24769 -> 24781 bytes tex/context/base/status-lua.log | 2 +- tex/context/base/util-sto.lua | 58 +++-- tex/context/base/x-mathml.lua | 1 + tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 13 files changed, 444 insertions(+), 69 deletions(-) create mode 100644 tex/context/base/meta-fnt.lua create mode 100644 tex/context/base/meta-fnt.mkiv (limited to 'tex') diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 8db1b0581..1a8290c6b 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{2013.09.11 15:37} +\newcontextversion{2013.09.12 11:48} %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 index d5a5ba2df..e05b9e104 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index d573388e0..a51acafeb 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -3,7 +3,7 @@ %D version=2008.28.10, % 1995.10.10, %D title=\CONTEXT, %D subtitle=\CONTEXT\ Format Generation, -%D author=Hans Hagen, +%D author=Hans Hagen, % ɦɑns ɦɑˈχən %D date=\currentdate, %D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] %C @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2013.09.11 15:37} +\edef\contextversion{2013.09.12 11:48} \edef\contextkind {beta} %D For those who want to use this: @@ -404,6 +404,7 @@ \loadmarkfile{meta-fun} \loadmarkfile{meta-pag} \loadmarkfile{meta-grd} +%loadmarkfile{meta-fnt} \loadmarkfile{page-mrk} % depends on mp diff --git a/tex/context/base/font-syn.lua b/tex/context/base/font-syn.lua index 77aeec553..f676b5952 100644 --- a/tex/context/base/font-syn.lua +++ b/tex/context/base/font-syn.lua @@ -12,13 +12,14 @@ local next, tonumber, type, tostring = next, tonumber, type, tostring 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 +local serialize, sortedhash = table.serialize, table.sortedhash local lpegmatch = lpeg.match local unpack = unpack or table.unpack local formatters, topattern = string.formatters, string.topattern local allocate = utilities.storage.allocate local sparse = utilities.storage.sparse +local setmetatableindex = table.setmetatableindex local removesuffix = file.removesuffix local splitbase = file.splitbase @@ -40,7 +41,7 @@ local trace_names = false trackers.register("fonts.names", fu local trace_warnings = false trackers.register("fonts.warnings", function(v) trace_warnings = v end) local trace_specifications = false trackers.register("fonts.specifications", function(v) trace_specifications = v end) -local report_names = logs.reporter("fonts","names") +local report_names = logs.reporter("fonts","names") --[[ldx--

This module implements a name to filename resolver. Names are resolved @@ -57,7 +58,7 @@ names.filters = filters names.data = names.data or allocate { } -names.version = 1.120 +names.version = 1.123 names.basename = "names" names.saved = false names.loaded = false @@ -92,7 +93,8 @@ local weights = Cs ( -- not extra + P("heavy") + P("ultra") + P("black") - + P("bol") -- / "bold" +--+ P("bol") / "bold" -- blocks + + P("bol") + P("regular") / "normal" ) @@ -107,8 +109,8 @@ local styles = Cs ( + P("oblique") / "italic" + P("slanted") + P("roman") / "normal" - + P("ital") / "italic" - + P("ita") / "italic" + + P("ital") / "italic" -- might be tricky + + P("ita") / "italic" -- might be tricky ) local normalized_styles = sparse { @@ -180,6 +182,28 @@ names.knownvariants = { "smallcaps", } +local remappedweights = { + [""] = "normal", + ["bol"] = "bold", +} + +local remappedstyles = { + [""] = "normal", +} + +local remappedwidths = { + [""] = "normal", +} + +local remappedvariants = { + [""] = "normal", +} + +names.remappedweights = remappedweights setmetatableindex(remappedweights ,"self") +names.remappedstyles = remappedstyles setmetatableindex(remappedstyles ,"self") +names.remappedwidths = remappedwidths setmetatableindex(remappedwidths ,"self") +names.remappedvariants = remappedvariants setmetatableindex(remappedvariants,"self") + local any = P(1) local analyzed_table @@ -465,6 +489,16 @@ local function check_name(data,result,filename,modification,suffix,subfont) fontname = fontname or fullname or familyname or filebase -- maybe cleanfilename fullname = fullname or fontname familyname = familyname or fontname + -- we do these sparse + local units = result.units_per_em or 1000 + local minsize = result.design_range_bottom or 0 + local maxsize = result.design_range_top or 0 + local designsize = result.design_size or 0 + local angle = result.italicangle or 0 + local pfminfo = result.pfminfo + local pfmwidth = pfminfo and pfminfo.width or 0 + local pfmweight = pfminfo and pfminfo.weight or 0 + -- specifications[#specifications + 1] = { filename = filename, -- unresolved cleanfilename = cleanfilename, @@ -480,10 +514,14 @@ local function check_name(data,result,filename,modification,suffix,subfont) style = style, width = width, variant = variant, - minsize = result.design_range_bottom or 0, - maxsize = result.design_range_top or 0, - designsize = result.design_size or 0, - modification = modification or 0, + units = units ~= 1000 and unit or nil, + pfmwidth = pfmwidth ~= 0 and pfmwidth or nil, + pfmweight = pfmweight ~= 0 and pfmweight or nil, + angle = angle ~= 0 and angle or nil, + minsize = minsize ~= 0 and minsize or nil, + maxsize = maxsize ~= 0 and maxsize or nil, + designsize = designsize ~= 0 and designsize or nil, + modification = modification ~= 0 and modification or nil, } end @@ -507,10 +545,10 @@ local function cleanupkeywords() local style = b_style or c_style or d_style or e_style or f_style or "normal" local width = b_width or c_width or d_width or e_width or f_width or "normal" local variant = b_variant or c_variant or d_variant or e_variant or f_variant or "normal" - if not weight or weight == "" then weight = "normal" end - if not style or style == "" then style = "normal" end - if not width or width == "" then width = "normal" end - if not variant or variant == "" then variant = "normal" end + weight = remappedweights [weight or ""] + style = remappedstyles [style or ""] + width = remappedwidths [width or ""] + variant = remappedvariants[variant or ""] weights [weight ] = (weights [weight ] or 0) + 1 styles [style ] = (styles [style ] or 0) + 1 widths [width ] = (widths [width ] or 0) + 1 @@ -529,12 +567,22 @@ local function collectstatistics() local data = names.data local specifications = data.specifications if specifications then - local weights = { } - local styles = { } - local widths = { } - local variants = { } + local f_w = formatters["%i"] + local f_a = formatters["%0.2f"] + -- normal stuff + local weights = { } + local styles = { } + local widths = { } + local variants = { } + -- weird stuff + local angles = { } + -- extra stuff + local pfmweights = { } setmetatableindex(pfmweights,"table") + local pfmwidths = { } setmetatableindex(pfmwidths, "table") + -- main loop for i=1,#specifications do - local s = specifications[i] + local s = specifications[i] + -- normal stuff local weight = s.weight local style = s.style local width = s.width @@ -543,13 +591,64 @@ local function collectstatistics() if style then styles [style ] = (styles [style ] or 0) + 1 end if width then widths [width ] = (widths [width ] or 0) + 1 end if variant then variants[variant] = (variants[variant] or 0) + 1 end - end - local stats = data.statistics - stats.weights = weights - stats.styles = styles - stats.widths = widths - stats.variants = variants - stats.fonts = #specifications + -- weird stuff + local angle = f_a(s.angle or 0) + angles[angle] = (angles[angles] or 0) + 1 + -- extra stuff + local pfmweight = f_w(s.pfmweight or 0) + local pfmwidth = f_w(s.pfmwidth or 0) + local tweights = pfmweights[pfmweight] + local twidths = pfmwidths [pfmwidth] + tweights[pfmweight] = (tweights[pfmweight] or 0) + 1 + twidths[pfmwidth] = (twidths [pfmwidth] or 0) + 1 + end + -- + local stats = data.statistics + stats.weights = weights + stats.styles = styles + stats.widths = widths + stats.variants = variants + stats.angles = angles + stats.pfmweights = pfmweights + stats.pfmwidths = pfmwidths + stats.fonts = #specifications + -- + setmetatableindex(pfmweights,nil) + setmetatableindex(pfmwidths, nil) + -- + report_names("") + report_names("weights") + report_names("") + report_names(formatters[" %T"](weights)) + report_names("") + report_names("styles") + report_names("") + report_names(formatters[" %T"](styles)) + report_names("") + report_names("widths") + report_names("") + report_names(formatters[" %T"](widths)) + report_names("") + report_names("variants") + report_names("") + report_names(formatters[" %T"](variants)) + report_names("") + report_names("angles") + report_names("") + report_names(formatters[" %T"](angles)) + report_names("") + report_names("pfmweights") + report_names("") + for k, v in sortedhash(pfmweights) do + report_names(formatters[" %-10s: %T"](k,v)) + end + report_names("") + report_names("pfmwidths") + report_names("") + for k, v in sortedhash(pfmwidths) do + report_names(formatters[" %-10s: %T"](k,v)) + end + report_names("") end end @@ -613,8 +712,11 @@ local function checkduplicate(where) -- fails on "Romantik" but that's a border local specifications = data.specifications local loaded = { } if specifications and mapping then - for _, m in next, mapping do - for k, v in next, m do + -- was: for _, m in sortedhash(mapping) do + local order = filters.list + for i=1,#order do + local m = mapping[order[i]] + for k, v in sortedhash(m) do local s = specifications[v] local hash = formatters["%s-%s-%s-%s-%s"](s.familyname,s.weight or "*",s.style or "*",s.width or "*",s.variant or "*") local h = loaded[hash] @@ -638,7 +740,7 @@ local function checkduplicate(where) -- fails on "Romantik" but that's a border end end local n = 0 - for k, v in table.sortedhash(loaded) do + for k, v in sortedhash(loaded) do local nv = #v if nv > 1 then if trace_warnings then @@ -959,12 +1061,13 @@ function names.identify(force) analyzefiles(not force and names.readdata(names.basename)) rejectclashes() collectfamilies() - collectstatistics() + -- collectstatistics() cleanupkeywords() collecthashes() checkduplicates() addfilenames() -- sorthashes() -- will be resorted when saved + collectstatistics() report_names("total scan time %0.3f seconds",os.gettimeofday()-starttime) end @@ -1823,8 +1926,8 @@ end -- -- for i=1,#specifications do -- local s = specifications[i] --- local min = s.minsize --- local max = s.maxsize +-- local min = s.minsize or 0 +-- local max = s.maxsize or 0 -- if min ~= 0 or max ~= 0 then -- -- the usual name mess: -- -- antykwa has modifiers so we need to take these into account, otherwise we get weird combinations diff --git a/tex/context/base/math-fen.mkiv b/tex/context/base/math-fen.mkiv index a7f5b2188..00837a607 100644 --- a/tex/context/base/math-fen.mkiv +++ b/tex/context/base/math-fen.mkiv @@ -128,6 +128,7 @@ \definemathfence [bar] [\c!left="007C,\c!right="007C] \definemathfence [doublebar] [\c!left="2016,\c!right="2016] \definemathfence [angle] [\c!left="003C,\c!right="003E] +\definemathfence [solidus] [\c!left="2044,\c!right="2044] \definemathfence [nothing] %D A bonus: @@ -137,6 +138,7 @@ \unexpanded\def\Lbrace {\math_fenced_fenced_start{brace}} \unexpanded\def\Rbrace {\math_fenced_fenced_stop{brace}} \unexpanded\def\Langle {\math_fenced_fenced_start{angle}} \unexpanded\def\Rangle {\math_fenced_fenced_stop{angle}} \unexpanded\def\Lbar {\math_fenced_fenced_start{bar}} \unexpanded\def\Rbar {\math_fenced_fenced_stop{bar}} +\unexpanded\def\Lsolidus {\math_fenced_fenced_start{solidus}} \unexpanded\def\Rsolidus {\math_fenced_fenced_stop{solidus}} \unexpanded\def\Ldoublebar {\math_fenced_fenced_start{doublebar}} \unexpanded\def\Rdoublebar{\math_fenced_fenced_stop{doublebar}} \unexpanded\def\Lnothing {\math_fenced_fenced_start{nothing}} \unexpanded\def\Rnothing {\math_fenced_fenced_stop{nothing}} @@ -191,6 +193,7 @@ \expandafter\let\csname\??mathleft\meaning <\endcsname\Langle \expandafter\let\csname\??mathleft\meaning {\endcsname\Lbrace \expandafter\let\csname\??mathleft\meaning |\endcsname\Lbar +\expandafter\let\csname\??mathleft\meaning /\endcsname\Lsolidus \expandafter\let\csname\??mathleft\meaning ‖\endcsname\Ldoublebar \expandafter\let\csname\??mathleft\meaning .\endcsname\Lnothing @@ -199,6 +202,7 @@ \expandafter\let\csname\??mathright\meaning >\endcsname\Rangle \expandafter\let\csname\??mathright\meaning }\endcsname\Rbrace \expandafter\let\csname\??mathright\meaning |\endcsname\Rbar +\expandafter\let\csname\??mathright\meaning /\endcsname\Rsolidus \expandafter\let\csname\??mathright\meaning ‖\endcsname\Rdoublebar \expandafter\let\csname\??mathright\meaning .\endcsname\Rnothing @@ -211,6 +215,7 @@ \installmathfencepair \langle \Langle \rangle \Rangle %installmathfencepair \lbar \Lbar \rbar \Rbar \installmathfencepair \vert \Lbar \vert \Rbar +\installmathfencepair \solidus \Lsolidus \solidus \Rsolidus \unexpanded\def\{{\mathortext\lbrace \letterleftbrace } % or maybe a chardef \unexpanded\def\}{\mathortext\rbrace \letterrightbrace } % or maybe a chardef @@ -219,6 +224,7 @@ \unexpanded\def\({\mathortext\lparent \letterleftparent } % or maybe a chardef \unexpanded\def\){\mathortext\rparent \letterrightparent } % or maybe a chardef \unexpanded\def\|{\mathortext\vert \letterbar } % or maybe a chardef +%unexpanded\def\/{\mathortext\solidus \letterslash } % or maybe a chardef \installmathfencepair \{ \Lbrace \} \Rbrace \installmathfencepair \[ \Lbracket \] \Rbracket diff --git a/tex/context/base/meta-fnt.lua b/tex/context/base/meta-fnt.lua new file mode 100644 index 000000000..75d8f2699 --- /dev/null +++ b/tex/context/base/meta-fnt.lua @@ -0,0 +1,233 @@ +if not modules then modules = { } end modules ['meta-fnt'] = { + version = 1.001, + comment = "companion to meta-fnt.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local concat = table.concat +local format = string.format +local formatters = string.formatters +local chardata = characters.data +local fontdata = fonts.hashes.identifiers + +local vffonts = fonts.handlers.vf + +local mpfonts = fonts.mp or { } +fonts.mp = mpfonts + +mpfonts.version = mpfonts.version or 1.20 +mpfonts.inline = true +mpfonts.cache = containers.define("fonts", "mp", mpfonts.version, true) + +metapost.fonts = metapost.fonts or { } + +-- a few glocals + +local characters, descriptions = { }, { } +local factor, code, slot, width, height, depth, total, variants = 100, { }, 0, 0, 0, 0, 0, 0, true + +-- A next version of mplib will provide the tfm font information which +-- gives better glyph dimensions, plus additional kerning information. + +local flusher = { + startfigure = function(chrnum,llx,lly,urx,ury) + code = { } + slot = chrnum + width = urx - llx + height = ury + depth = -lly + total = total + 1 + inline = mpfonts.inline + end, + flushfigure = function(t) + for i=1,#t do + code[#code+1] = t[i] + end + end, + stopfigure = function() + local cd = chardata[n] + descriptions[slot] = { + -- unicode = slot, + name = cd and cd.adobename, + width = width * 100, + height = height * 100, + depth = depth * 100, + boundingbox = { 0, -depth, width, height }, + } + if inline then + characters[slot] = { + commands = { + { "special", "pdf: " .. concat(code," ") }, + } + } + else + characters[slot] = { + commands = { + { + "image", + { + stream = concat(code," "), + bbox = { 0, -depth * 65536, width * 65536, height * 65536 } + }, + }, + } + } + end + end +} + +local function process(mpxformat,name,instances,scalefactor) + statistics.starttiming(metapost.fonts) + scalefactor = scalefactor or 1 + instances = instances or metapost.fonts.instances or 1 + local fontname = file.removesuffix(file.basename(name)) + local hash = file.robustname(formatters["%s %05i %03i"](fontname,scalefactor*1000,instances)) + local lists = containers.read(mpfonts.cache,hash) + if not lists or lists.version ~= version then + statistics.starttiming(flusher) + local data = io.loaddata(resolvers.findfile(name)) + metapost.reset(mpxformat) + metapost.setoutercolor(2) -- no outer color and no reset either + lists = { } + for i=1,instances do + characters = { } + descriptions = { } + metapost.process( + mpxformat, + { + formatters["randomseed := %s ;"](i*10), + formatters["charscale := %s ;"](scalefactor), + data, + }, + false, + flusher, + false, + false, + "all" + ) + lists[i] = { + characters = characters, + descriptions = descriptions, + parameters = { + designsize = 655360, + slant = 0, + space = 333 * scalefactor, + space_stretch = 166.5 * scalefactor, + space_shrink = 111 * scalefactor, + x_height = 431 * scalefactor, + quad = 1000 * scalefactor, + extra_space = 0, + }, + properties = { + name = formatters["%s-%03i"](hash,i), + virtualized = true, + spacer = "space", + } + } + end + lists.version = metapost.variables.fontversion or "1.000" + metapost.reset(mpxformat) -- saves memory + lists = containers.write(mpfonts.cache, hash, lists) + statistics.stoptiming(flusher) + end + variants = variants + #lists + statistics.stoptiming(metapost.fonts) + return lists +end + +metapost.fonts.flusher = flusher +metapost.fonts.instances = 1 +metapost.fonts.process = process + +local function build(g,v) + local size = g.specification.size + local data = process(v[2],v[3],v[4],size/655360,v[6]) + local list = { } + local t = { } + for d=1,#data do + t = fonts.constructors.scale(data[d],-1000) + local id = font.nextid() + t.fonts = { { id = id } } + fontdata[id] = t + if v[5] then + vffonts.helpers.composecharacters(t) + end + list[d] = font.define(t) + end + for k, v in next, t do -- last t + g[k] = v -- kind of replace, when not present, make nil + end + g.properties.virtualized = true + g.variants = list +end + +vffonts.combiner.commands.metapost = build +vffonts.combiner.commands.metafont = build + +statistics.register("metapost font generation", function() + local time = statistics.elapsedtime(flusher) + if total > 0 then + return format("%i glyphs, %.3f seconds runtime, %i glyphs/second", total, time, total/time) + else + return format("%i glyphs, %.3f seconds runtime", total, time) + end +end) + +statistics.register("metapost font loading",function() + local time = statistics.elapsedtime(metapost.fonts) + if variants > 0 then + return format("%.3f seconds, %i instances, %0.3f instances/second", time, variants, variants/time) + else + return format("%.3f seconds, %i instances", time, variants) + end +end) + +-- fonts.definers.methods.install( "bidi", { +-- { +-- "metapost", -- method +-- "metafun", -- format +-- "fontoeps.mp", -- filename +-- 1, -- instances +-- false, -- compose +-- }, +-- } ) + +local report = logs.reporter("metapost","fonts") + +function metapost.fonts.define(specification) + local fontname = specification.fontname or "" + local filename = specification.filename or "" + local format = specification.format or "metafun" + if fontname == "" then + report("no fontname given") + return + end + if filename == "" then + report("no filename given for %a",fontname) + return + end + local fullname = resolvers.findfile(filename) + if fullname == "" then + report("unable to locate file %a",filename) + return + end + report("generating font %a using format %a and file %a",fontname,format,filename) + fonts.definers.methods.install(fontname, { + { + specification.engine or "metapost", + format, + filename, + specification.instances or 1, + specification.compose or false, + }, + } ) +end + +commands.definemetafont = metapost.fonts.define + +-- metapost.fonts.define { +-- fontname = "bidi", +-- filename = "bidi-symbols.mp", +-- } diff --git a/tex/context/base/meta-fnt.mkiv b/tex/context/base/meta-fnt.mkiv new file mode 100644 index 000000000..603fcf14d --- /dev/null +++ b/tex/context/base/meta-fnt.mkiv @@ -0,0 +1,36 @@ +%D \module +%D [ file=meta-fnt, +%D version=2013.09.06, +%D title=\METAPOST\ Graphics, +%D subtitle=Fonts, +%D author=Hans Hagen, +%D date=\ currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\writestatus{loading}{MetaPost Graphics / Fonts} + +\registerctxluafile{meta-fnt}{1.001} + +\unprotect + +\unexpanded\def\definemetafont + {\dotripleempty\meta_font_define} + +\def\meta_font_define[#1][#2][#3]% + {\ctxcommand{definemetafont { + fontname = "#1", + filename = "#2" + % no #3 settings yet (compose, instances) + }}} + +% \startluacode +% metapost.fonts.define { fontname = "bidi-symbols", filename = "bidi-symbols.mp" } +% \stopluacode + +% \definemetafont[bidi-symbols][bidi-symbols.mp] + +\protect \endinput diff --git a/tex/context/base/mult-mps.lua b/tex/context/base/mult-mps.lua index fa93f7ef8..c1e05f265 100644 --- a/tex/context/base/mult-mps.lua +++ b/tex/context/base/mult-mps.lua @@ -61,6 +61,7 @@ return { }, commands = { "beginfig", "endfig", + "beginglyph", "endglyph", "charscale", "rotatedaround", "reflectedabout", "arrowhead", "currentpen", "currentpicture", "cuttings", diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 60b4169dc..998484dde 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.log b/tex/context/base/status-lua.log index fba6598e2..a6bd2f618 100644 --- a/tex/context/base/status-lua.log +++ b/tex/context/base/status-lua.log @@ -1,6 +1,6 @@ (cont-yes.mkiv -ConTeXt ver: 2013.09.11 15:37 MKIV beta fmt: 2013.9.11 int: english/english +ConTeXt ver: 2013.09.12 11:48 MKIV beta fmt: 2013.9.12 int: english/english system > 'cont-new.mkiv' loaded (cont-new.mkiv) diff --git a/tex/context/base/util-sto.lua b/tex/context/base/util-sto.lua index 191d6cd73..8aafca425 100644 --- a/tex/context/base/util-sto.lua +++ b/tex/context/base/util-sto.lua @@ -103,12 +103,22 @@ end local function f_empty () return "" end -- t,k local function f_self (t,k) t[k] = k return k end local function f_table (t,k) local v = { } t[k] = v return v end +local function f_number(t,k) t[k] = 0 return 0 end -- t,k,v local function f_ignore() end -- t,k,v -local t_empty = { __index = f_empty } -local t_self = { __index = f_self } -local t_table = { __index = f_table } -local t_ignore = { __newindex = f_ignore } +local f_index = { + ["empty"] = f_empty, + ["self"] = f_self, + ["table"] = f_table, + ["number"] = f_number, +} + +local t_index = { + ["empty"] = { __index = f_empty }, + ["self"] = { __index = f_self }, + ["table"] = { __index = f_table }, + ["number"] = { __index = f_number }, +} function table.setmetatableindex(t,f) if type(t) ~= "table" then @@ -116,46 +126,30 @@ function table.setmetatableindex(t,f) end local m = getmetatable(t) if m then - if f == "empty" then - m.__index = f_empty - elseif f == "key" then - m.__index = f_self - elseif f == "table" then - m.__index = f_table - else - m.__index = f - end + m.__index = f_index[f] or f else - if f == "empty" then - setmetatable(t, t_empty) - elseif f == "key" then - setmetatable(t, t_self) - elseif f == "table" then - setmetatable(t, t_table) - else - setmetatable(t,{ __index = f }) - end + setmetatable(t,t_index[f] or { __index = f }) end return t end +local f_index = { + ["ignore"] = f_ignore, +} + +local t_index = { + ["ignore"] = { __newindex = f_ignore }, +} + function table.setmetatablenewindex(t,f) if type(t) ~= "table" then f, t = t, { } end local m = getmetatable(t) if m then - if f == "ignore" then - m.__newindex = f_ignore - else - m.__newindex = f - end + m.__newindex = f_index[f] or f else - if f == "ignore" then - setmetatable(t, t_ignore) - else - setmetatable(t,{ __newindex = f }) - end + setmetatable(t,t_index[f] or { __newindex = f }) end return t end diff --git a/tex/context/base/x-mathml.lua b/tex/context/base/x-mathml.lua index 31483bbea..d19e1eebf 100644 --- a/tex/context/base/x-mathml.lua +++ b/tex/context/base/x-mathml.lua @@ -62,6 +62,7 @@ local o_replacements = { -- in main table ["{"] = "\\mmlleftdelimiter \\lbrace", ["}"] = "\\mmlrightdelimiter\\rbrace", ["|"] = "\\mmlleftorrightdelimiter\\vert", + ["/"] = "\\mmlleftorrightdelimiter\\solidus", [doublebar] = "\\mmlleftorrightdelimiter\\Vert", ["("] = "\\mmlleftdelimiter(", [")"] = "\\mmlrightdelimiter)", diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index a3496b3f3..261839531 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 : 09/11/13 15:37:51 +-- merge date : 09/12/13 11:48:29 do -- begin closure to overcome local limits and interference -- cgit v1.2.3