diff options
Diffstat (limited to 'tex/context/base/mkiv')
24 files changed, 88 insertions, 119 deletions
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index b8b97f52b..f60590c20 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2020.12.06 18:12} +\newcontextversion{2020.12.08 11:06} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index dc6bc1a4c..907146f68 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2020.12.06 18:12} +\edef\contextversion{2020.12.08 11:06} %D Kind of special: diff --git a/tex/context/base/mkiv/font-cft.lua b/tex/context/base/mkiv/font-cft.lua index ee9ffa6a7..cf6c232a6 100644 --- a/tex/context/base/mkiv/font-cft.lua +++ b/tex/context/base/mkiv/font-cft.lua @@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['font-cft'] = { license = "see context related readme files" } --- context font tables +-- context font tables (needs updating) -- -- todo: extra: -- @@ -229,7 +229,7 @@ do data.scaled = { properties = { - encodingbytes = t_cardinal, + encodingbytes = t_cardinal, -- not in lmtx embedding = t_cardinal, -- ? cidinfo = t_hash, format = t_string, @@ -238,7 +238,7 @@ do filename = t_string, psname = t_string, name = t_string, - virtualized = t_boolean, + virtualized = t_boolean, -- not in lmtx hasitalics = t_boolean, autoitalicamount = t_float, nostackmath = t_boolean, diff --git a/tex/context/base/mkiv/font-chk.lua b/tex/context/base/mkiv/font-chk.lua index d2a0943f6..e18e4b804 100644 --- a/tex/context/base/mkiv/font-chk.lua +++ b/tex/context/base/mkiv/font-chk.lua @@ -273,12 +273,6 @@ registerotffeature { fonts.loggers.add_placeholders = function(id) addmissingsymbols(fontdata[id or true]) end fonts.loggers.category_to_placeholder = mapping -function commands.getplaceholderchar(name) - local id = currentfont() - addmissingsymbols(fontdata[id]) - context(getprivatenode(fontdata[id],name)) -end - -- todo in luatex: option to add characters (just slots, no kerns etc) -- we can do that now so ... diff --git a/tex/context/base/mkiv/font-ctx.lua b/tex/context/base/mkiv/font-ctx.lua index 6c21bc0cc..5c93f302f 100644 --- a/tex/context/base/mkiv/font-ctx.lua +++ b/tex/context/base/mkiv/font-ctx.lua @@ -167,11 +167,6 @@ addformatter(formatters,"font:features",[["'"..sequenced(%s," ",true).."'"]],{ s -- ... like font-sfm or so constructors.resolvevirtualtoo = true -- context specific (due to resolver) - -if CONTEXTLMTXMODE and CONTEXTLMTXMODE > 0 then - constructors.fixprotrusion = false -end - constructors.sharefonts = true -- experimental constructors.nofsharedfonts = 0 constructors.nofsharedhashes = 0 @@ -339,12 +334,7 @@ implement { permanent = false, actions = function() for i=1,7 do - if CONTEXTLMTXMODE > 0 then - font.setfontdimen(0,i,0) - else - -- we have no direct method - context([[\fontdimen%s\nullfont\zeropoint]],i) - end + context([[\fontdimen%s\nullfont\zeropoint]],i) end definers.resetnullfont() end @@ -1657,17 +1647,7 @@ tfmdata.original = specification.specification return id, csnames[id] end - local read - - if CONTEXTLMTXMODE and CONTEXTLMTXMODE > 0 then -- maybe always - read = function(name,size) - return (define { name = name, size = size } or 0) - end - else - read = definers.read - end - - callbacks.register('define_font', read, "definition of fonts (tfmdata preparation)") + callbacks.register('define_font', definers.read, "definition of fonts (tfmdata preparation)") -- here @@ -1833,7 +1813,7 @@ function mappings.loadfile(name) if trace_mapfiles then report_mapfiles("loading map file %a",name) end - lpdf.setmapfile(name) + lpdf.setmapfile(name) -- bah. will go in lmtx loaded[name] = true end end @@ -1851,7 +1831,7 @@ function mappings.loadline(how,line) if trace_mapfiles then report_mapfiles("processing map line %a",line) end - lpdf.setmapline(how) + lpdf.setmapline(how) -- bah. will go in lmtx loaded[how] = true end end @@ -1860,6 +1840,10 @@ function mappings.reset() lpdf.setmapfile("") -- tricky ... backend related end +function mappings.getentry(...) + return lpdf.getmapentry(...) -- tricky ... backend related +end + implement { name = "loadmapfile", actions = mappings.loadfile, @@ -3390,8 +3374,3 @@ function fonts.helpers.collectanchors(tfmdata) return anchors end - -if CONTEXTLMTXMODE > 0 then - fonts.constructors.addtounicode = false - fonts.constructors.autocleanup = false -end diff --git a/tex/context/base/mkiv/font-one.lua b/tex/context/base/mkiv/font-one.lua index a76c92985..5ef6e4749 100644 --- a/tex/context/base/mkiv/font-one.lua +++ b/tex/context/base/mkiv/font-one.lua @@ -592,15 +592,18 @@ local function copytotfm(data) parameters.descender = abs(metadata.descender or 0) parameters.units = 1000 -- - properties.spacer = spacer + properties.spacer = spacer + properties.format = fonts.formats[filename] or "type1" + properties.filename = filename + properties.fontname = fontname + properties.fullname = fullname + properties.psname = fullname + properties.name = filename or fullname or fontname + properties.private = properties.private or data.private or privateoffset + -- +if not CONTEXTLMTXMODE or CONTEXTLMTXMODE == 0 then properties.encodingbytes = 2 - properties.format = fonts.formats[filename] or "type1" - properties.filename = filename - properties.fontname = fontname - properties.fullname = fullname - properties.psname = fullname - properties.name = filename or fullname or fontname - properties.private = properties.private or data.private or privateoffset +end -- if next(characters) then return { diff --git a/tex/context/base/mkiv/font-otl.lua b/tex/context/base/mkiv/font-otl.lua index e8f89b4e7..b8e13f107 100644 --- a/tex/context/base/mkiv/font-otl.lua +++ b/tex/context/base/mkiv/font-otl.lua @@ -486,23 +486,26 @@ local function copytotfm(data,cache_id) end end -- - parameters.designsize = (designsize/10)*65536 - parameters.minsize = (minsize /10)*65536 - parameters.maxsize = (maxsize /10)*65536 - parameters.ascender = abs(metadata.ascender or 0) - parameters.descender = abs(metadata.descender or 0) - parameters.units = units - parameters.vheight = metadata.defaultvheight + parameters.designsize = (designsize/10)*65536 + parameters.minsize = (minsize /10)*65536 + parameters.maxsize = (maxsize /10)*65536 + parameters.ascender = abs(metadata.ascender or 0) + parameters.descender = abs(metadata.descender or 0) + parameters.units = units + parameters.vheight = metadata.defaultvheight -- - properties.space = spacer + properties.space = spacer + properties.format = data.format or formats.otf + properties.filename = filename + properties.fontname = fontname + properties.fullname = fullname + properties.psname = psname + properties.name = filename or fullname + properties.subfont = subfont + -- +if not CONTEXTLMTXMODE or CONTEXTLMTXMODE == 0 then properties.encodingbytes = 2 - properties.format = data.format or formats.otf - properties.filename = filename - properties.fontname = fontname - properties.fullname = fullname - properties.psname = psname - properties.name = filename or fullname - properties.subfont = subfont +end -- -- properties.name = specification.name -- properties.sub = specification.sub diff --git a/tex/context/base/mkiv/font-tfm.lua b/tex/context/base/mkiv/font-tfm.lua index e2f0d22f2..63f3276b1 100644 --- a/tex/context/base/mkiv/font-tfm.lua +++ b/tex/context/base/mkiv/font-tfm.lua @@ -139,10 +139,12 @@ local function read_from_tfm(specification) -- If reencode returns a new table, we assume that we're doing something -- special. An 'auto' reencode picks up its vector from the pfb file. - if lpdf and lpdf.getmapentry and not features.reencode then + local getmapentry = fonts.mappings.getentry + + if getmapentry and not features.reencode then -- This can happen multiple times but not that often so we don't -- optimize this. - local encoding, pfbfile, encfile = lpdf.getmapentry(filename) + local encoding, pfbfile, encfile = getmapentry(filename) if encoding and pfbfile then features.reencode = encfile features.pfbfile = pfbfile @@ -170,9 +172,9 @@ local function read_from_tfm(specification) properties.format = tfmdata.format or fonts.formats.tfm -- better than nothing properties.usedbitmap = tfmdata.usedbitmap -- -if lpdf and lpdf.getmapentry and newtfmdata then - properties.filename = features.pfbfile -end + if getmapentry and newtfmdata then + properties.filename = features.pfbfile + end -- tfmdata.properties = properties tfmdata.resources = resources @@ -234,8 +236,10 @@ end -- -- The tounicode data is passed to the backend that constructs the vectors for us. -- - tfmdata.tounicode = 1 - local tounicode = fonts.mappings.tounicode +if not CONTEXTLMTXMODE or CONTEXTLMTXMODE == 0 then + tfmdata.tounicode = 1 +end + local tounicode = fonts.mappings.tounicode for unicode, v in next, tfmdata.characters do local u = v.unicode if u then @@ -514,11 +518,13 @@ do tfmdata.fullname = tfmdata.fullname or tfmdata.name tfmdata.psname = file.nameonly(pfbfile or tfmdata.name) tfmdata.filename = pfbfile - tfmdata.encodingbytes = 2 -- tfmdata.format = bitmap and "type3" or "type1" tfmdata.format = "type1" +if not CONTEXTLMTXMODE or CONTEXTLMTXMODE == 0 then + tfmdata.encodingbytes = 2 tfmdata.tounicode = 1 tfmdata.embedding = "subset" +end tfmdata.usedbitmap = bitmap and virtualid tfmdata.private = private diff --git a/tex/context/base/mkiv/font-tpk.lua b/tex/context/base/mkiv/font-tpk.lua index c24af1df8..16b89c393 100644 --- a/tex/context/base/mkiv/font-tpk.lua +++ b/tex/context/base/mkiv/font-tpk.lua @@ -848,7 +848,6 @@ do direction = direction, -- checksum = checksum, -- embedding = "unknown", - -- encodingbytes = 0, -- extend = 1000, -- slant = 0, -- squeeze = 0, diff --git a/tex/context/base/mkiv/grph-bmp.lua b/tex/context/base/mkiv/grph-bmp.lua index e10b01aa4..6669b5db1 100644 --- a/tex/context/base/mkiv/grph-bmp.lua +++ b/tex/context/base/mkiv/grph-bmp.lua @@ -39,10 +39,6 @@ function bitmaps.new(xsize,ysize,colorspace,colordepth,mask,index) } end --- function backends.codeinjections.bitmap(bitmap) --- return lpdf.injectors.bitmap(bitmap) --- end - local function flush(bitmap) local specification = backends.codeinjections.bitmap(bitmap) if specification then @@ -89,7 +85,7 @@ local function placeholder(nx,ny) end end - return lpdf.injectors.bitmap(bitmap) + return backends.codeinjections.bitmap(bitmap) end diff --git a/tex/context/base/mkiv/grph-chk.lua b/tex/context/base/mkiv/grph-chk.lua index 0688f46ef..0cfc9ba08 100644 --- a/tex/context/base/mkiv/grph-chk.lua +++ b/tex/context/base/mkiv/grph-chk.lua @@ -35,7 +35,7 @@ function checkers.pdf(data) local request = data.request local used = data.used if request and used and not request.scanimage then - local image = lpdf.epdf.image + local image = lpdf.epdf.image -- ok, this is a pdf specific main function local openpdf = image.open local closepdf = image.close local querypdf = image.query @@ -163,7 +163,6 @@ function checkers.jpg(data) local used = data.used if request and used and not request.scanimage then local identify = graphics.identify - local inject = lpdf.injectors.jpg local found = false request.scanimage = function(t) local result = wrappedidentify(identify,t.filename,"jpg") @@ -187,7 +186,7 @@ function checkers.jpg(data) request.copyimage = function(t) if found then found = false - return inject(t) + return backends.codeinjections.jpg(t) end end end @@ -199,7 +198,6 @@ function checkers.jp2(data) -- idem as jpg local used = data.used if request and used and not request.scanimage then local identify = graphics.identify - local inject = lpdf.injectors.jp2 local found = false request.scanimage = function(t) local result = wrappedidentify(identify,t.filename,"jp2") @@ -223,7 +221,7 @@ function checkers.jp2(data) -- idem as jpg request.copyimage = function(t) if found then found = false - return inject(t) + return backends.codeinjections.jp2(t) end end end @@ -235,7 +233,6 @@ function checkers.png(data) -- same as jpg (for now) local used = data.used if request and used and not request.scanimage then local identify = graphics.identify - local inject = lpdf.injectors.png -- currently pdf specific local found = false request.scanimage = function(t) local result = wrappedidentify(identify,t.filename,"png") @@ -263,7 +260,7 @@ function checkers.png(data) -- same as jpg (for now) t.colorref = used.colorref -- this is a bit of a hack if found then found = false - local ok, result = pcall(inject,t) + local ok, result = pcall(backends.codeinjections.png,t) if ok then return result else diff --git a/tex/context/base/mkiv/grph-pat.lua b/tex/context/base/mkiv/grph-pat.lua index e38a9a674..4310af672 100644 --- a/tex/context/base/mkiv/grph-pat.lua +++ b/tex/context/base/mkiv/grph-pat.lua @@ -38,7 +38,7 @@ interfaces.implement { return end nodes.handlers.finalizebox(number) - names[name] = lpdf.registerpattern { + names[name] = backends.codeinjections.registerpattern { number = number, width = specification.width or box.width, height = specification.height or (box.height + box.depth) , diff --git a/tex/context/base/mkiv/lpdf-grp.lua b/tex/context/base/mkiv/lpdf-grp.lua index e827419a6..963b1dde3 100644 --- a/tex/context/base/mkiv/lpdf-grp.lua +++ b/tex/context/base/mkiv/lpdf-grp.lua @@ -293,3 +293,5 @@ end function lpdf.patternstream(n,width,height) return f_pattern("Pt" .. n,width*basepoints,height*basepoints) end + +backends.pdf.codeinjections.registerpattern = lpdf.registerpattern diff --git a/tex/context/base/mkiv/luat-cod.lua b/tex/context/base/mkiv/luat-cod.lua index 0b7521180..927f6dfab 100644 --- a/tex/context/base/mkiv/luat-cod.lua +++ b/tex/context/base/mkiv/luat-cod.lua @@ -68,7 +68,7 @@ function lua.registercode(filename,options) end end if barename == filename then - filename = filename .. (opts.autosuffix and CONTEXTLMTXMODE > 0 and ".lmt" or ".lua") + filename = filename .. ".lua" end local code = environment.luafilechunk(filename,false,opts.optimize) if code then diff --git a/tex/context/base/mkiv/math-act.lua b/tex/context/base/mkiv/math-act.lua index 03f44dd1c..4f38b4195 100644 --- a/tex/context/base/mkiv/math-act.lua +++ b/tex/context/base/mkiv/math-act.lua @@ -247,10 +247,10 @@ function mathematics.overloaddimensions(target,original,set) local factor = parameters.factor local hfactor = parameters.hfactor local vfactor = parameters.vfactor - -- to be sure +if not CONTEXTLMTXMODE or CONTEXTLMTXMODE == 0 then target.type = "virtual" target.properties.virtualized = true - -- +end local function overload(dimensions) for unicode, data in next, dimensions do local character = characters[unicode] @@ -603,8 +603,10 @@ interfaces.implement { -- if not fonts then -- fonts = { } -- target.fonts = fonts +-- if not CONTEXTLMTXMODE or CONTEXTLMTXMODE == 0 then -- target.type = "virtual" -- target.properties.virtualized = true +-- end -- end -- if #fonts == 0 then -- fonts[1] = { id = 0, size = size } -- sel, will be resolved later @@ -709,8 +711,10 @@ function mathematics.finishfallbacks(target,specification,fallbacks) fonts = { } target.fonts = fonts end +if not CONTEXTLMTXMODE or CONTEXTLMTXMODE == 0 then target.type = "virtual" target.properties.virtualized = true +end if #fonts == 0 then fonts[1] = { id = 0, size = size } -- self, will be resolved later end diff --git a/tex/context/base/mkiv/math-vfu.lua b/tex/context/base/mkiv/math-vfu.lua index 9090955e9..c7079caca 100644 --- a/tex/context/base/mkiv/math-vfu.lua +++ b/tex/context/base/mkiv/math-vfu.lua @@ -837,7 +837,6 @@ function vfmath.define(specification,set,goodies) setmetatableindex(goodies,parent.goodies) end -- - properties.virtualized = true properties.hasitalics = true properties.hasmath = true -- @@ -850,9 +849,13 @@ function vfmath.define(specification,set,goodies) -- we need to set some values in main as well (still?) -- main.fullname = properties.fullname - main.type = "virtual" main.nomath = false -- +if not CONTEXTLMTXMODE or CONTEXTLMTXMODE == 0 then + properties.virtualized = true + main.type = "virtual" +end + -- parameters.x_height = parameters.x_height or 0 -- local already_reported = false diff --git a/tex/context/base/mkiv/node-acc.lua b/tex/context/base/mkiv/node-acc.lua index e6c617602..d8f4b25bf 100644 --- a/tex/context/base/mkiv/node-acc.lua +++ b/tex/context/base/mkiv/node-acc.lua @@ -129,10 +129,9 @@ end) -- local done = false -- for n, id in nextnode, tonuts(head) do -- if id == disc then --- local r = getfield(n,"replace") --- local p = getfield(n,"pre") --- if r and p then --- local str = compact(r) +-- local pre, post, replace = getdisc(n) +-- if replace and pre then +-- local str = compact(replace) -- local hsh = hyphenated[str] -- if not hsh then -- hsh = #codes + 1 diff --git a/tex/context/base/mkiv/node-res.lua b/tex/context/base/mkiv/node-res.lua index 03de8f843..478a46906 100644 --- a/tex/context/base/mkiv/node-res.lua +++ b/tex/context/base/mkiv/node-res.lua @@ -626,10 +626,10 @@ do return v end) - traversers.node = nodes.traverse (glyph) - traversers.char = nodes.traverse_char (glyph) - if nuts.traverse_glyph then traversers.glyph = nodes.traverse_glyph (glyph) end - if nuts.traverse_list then traversers.list = nodes.traverse_list (glyph) end + traversers.node = nodes.traverse (glyph) + traversers.char = nodes.traverse_char (glyph) + if nodes.traverse_glyph then traversers.glyph = nodes.traverse_glyph(glyph) end + if nodes.traverse_list then traversers.list = nodes.traverse_list (glyph) end nodes.traversers = traversers diff --git a/tex/context/base/mkiv/node-ser.lua b/tex/context/base/mkiv/node-ser.lua index 6fc2b7ea4..25a6dd6c3 100644 --- a/tex/context/base/mkiv/node-ser.lua +++ b/tex/context/base/mkiv/node-ser.lua @@ -19,7 +19,6 @@ local context = context local nodes = nodes local node = node -local traverse = nodes.traverse local is_node = nodes.is_node local nodecodes = nodes.nodecodes diff --git a/tex/context/base/mkiv/node-tra.lua b/tex/context/base/mkiv/node-tra.lua index a86dfb620..83c072c19 100644 --- a/tex/context/base/mkiv/node-tra.lua +++ b/tex/context/base/mkiv/node-tra.lua @@ -180,18 +180,8 @@ end nodes.tosequence = tosequence nuts .tosequence = tosequence -if CONTEXTLMTXMODE > 0 then - - function nodes.report(t) - report_nodes("output %a, %s nodes",tex.getoutputactive(),count_nodes(t)) - end - -else - - function nodes.report(t) - report_nodes("output %a, %s nodes",status.output_active,count_nodes(t)) - end - +function nodes.report(t) + report_nodes("output %a, %s nodes",status.output_active,count_nodes(t)) end function nodes.packlist(head) diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex f61ff2582..1f59f1008 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 75f0d1787..c39495b08 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/strc-tag.lua b/tex/context/base/mkiv/strc-tag.lua index 694f7bdf0..83ff515e3 100644 --- a/tex/context/base/mkiv/strc-tag.lua +++ b/tex/context/base/mkiv/strc-tag.lua @@ -266,8 +266,8 @@ end function structures.atlocation(str) local specification = taglist[texgetattribute(a_tagged)] if specification then + local list = specification.taglist if list then - local taglist = specification.taglist local pattern = patterns[str] for i=#list,1,-1 do if find(list[i],pattern) then diff --git a/tex/context/base/mkiv/typo-drp.lua b/tex/context/base/mkiv/typo-drp.lua index 12864e52d..ddc6d68ae 100644 --- a/tex/context/base/mkiv/typo-drp.lua +++ b/tex/context/base/mkiv/typo-drp.lua @@ -321,13 +321,8 @@ actions[v_default] = function(head,setting) if trace_initials then report_initials("setting hangafter to %i and hangindent to %p",hangafter,hangindent) end - if CONTEXTLMTXMODE > 0 then - texset("hangafter",hangafter,true) - texset("hangindent",hangindent,true) - else - texset("hangafter",hangafter) - texset("hangindent",hangindent) - end + texset("hangafter",hangafter) + texset("hangindent",hangindent) end if indent then insert_after(first,first,new_kern(-parindent)) |