diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2014-07-17 12:15:05 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2014-07-17 12:15:05 +0200 |
commit | b3eb25e82ae27e0bea990fbae342bd0d2070e1a6 (patch) | |
tree | eb53ad88f9a972bd0126576cff3aa40acf7bffcd /tex | |
parent | bed6a8f91d263c155072adaa865416279b9d58b0 (diff) | |
download | context-b3eb25e82ae27e0bea990fbae342bd0d2070e1a6.tar.gz |
2014-07-17 11:21:00
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4434 -> 4429 bytes | |||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/data-res.lua | 67 | ||||
-rw-r--r-- | tex/context/base/font-otf.lua | 4 | ||||
-rw-r--r-- | tex/context/base/lpdf-epd.lua | 7 | ||||
-rw-r--r-- | tex/context/base/mlib-run.lua | 18 | ||||
-rw-r--r-- | tex/context/base/publ-aut.lua | 90 | ||||
-rw-r--r-- | tex/context/base/publ-ini.lua | 162 | ||||
-rw-r--r-- | tex/context/base/sort-ini.lua | 1 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24925 -> 24948 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.pdf | bin | 326318 -> 326383 bytes | |||
-rw-r--r-- | tex/context/base/syst-aux.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/syst-ini.mkiv | 4 | ||||
-rw-r--r-- | tex/context/base/tabl-xtb.lua | 259 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 6 |
16 files changed, 400 insertions, 224 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 71b4c6066..f61e4b9e4 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{2014.07.14 19:25} +\newcontextversion{2014.07.17 11:19} %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 6ba007d52..224939b24 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index e318bdea9..947076800 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -28,7 +28,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2014.07.14 19:25} +\edef\contextversion{2014.07.17 11:19} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/data-res.lua b/tex/context/base/data-res.lua index dfb50413f..7887dee7e 100644 --- a/tex/context/base/data-res.lua +++ b/tex/context/base/data-res.lua @@ -762,14 +762,50 @@ function resolvers.registerextrapath(paths,subpaths) end end +-- local function made_list(instance,list,extra_too) +-- if not extra_too then +-- return list +-- end +-- local ep = instance.extra_paths +-- if not ep or #ep == 0 then +-- return list +-- end +-- local done, new, newn = { }, { }, 0 +-- -- honour . .. ../.. but only when at the start +-- for k=1,#list do +-- local v = list[k] +-- if not done[v] then +-- if find(v,"^[%.%/]$") then +-- done[v] = true +-- newn = newn + 1 +-- new[newn] = v +-- else +-- break +-- end +-- end +-- end +-- -- first the extra paths +-- for k=1,#ep do +-- local v = ep[k] +-- if not done[v] then +-- done[v] = true +-- newn = newn + 1 +-- new[newn] = v +-- end +-- end +-- -- next the formal paths +-- for k=1,#list do +-- local v = list[k] +-- if not done[v] then +-- done[v] = true +-- newn = newn + 1 +-- new[newn] = v +-- end +-- end +-- return new +-- end + local function made_list(instance,list,extra_too) - if not extra_too then - return list - end - local ep = instance.extra_paths - if not ep or #ep == 0 then - return list - end local done, new, newn = { }, { }, 0 -- honour . .. ../.. but only when at the start for k=1,#list do @@ -785,12 +821,17 @@ local function made_list(instance,list,extra_too) end end -- first the extra paths - for k=1,#ep do - local v = ep[k] - if not done[v] then - done[v] = true - newn = newn + 1 - new[newn] = v + if extra_too then + local ep = instance.extra_paths + if ep and #ep > 0 then + for k=1,#ep do + local v = ep[k] + if not done[v] then + done[v] = true + newn = newn + 1 + new[newn] = v + end + end end end -- next the formal paths diff --git a/tex/context/base/font-otf.lua b/tex/context/base/font-otf.lua index 430f18a2f..8e9a43929 100644 --- a/tex/context/base/font-otf.lua +++ b/tex/context/base/font-otf.lua @@ -699,7 +699,9 @@ end unicode = cidunicodes[index] end if unicode and descriptions[unicode] then - report_otf("preventing glyph %a at index %H to overload unicode %U",name or "noname",index,unicode) + if trace_private then + report_otf("preventing glyph %a at index %H to overload unicode %U",name or "noname",index,unicode) + end unicode = -1 end if not unicode or unicode == -1 then -- or unicode >= criterium then diff --git a/tex/context/base/lpdf-epd.lua b/tex/context/base/lpdf-epd.lua index a7399f6b4..c37336d07 100644 --- a/tex/context/base/lpdf-epd.lua +++ b/tex/context/base/lpdf-epd.lua @@ -252,7 +252,7 @@ local function getlayers(document) local n = layers.n for i=1,n do local layer = layers[i] ---~ print(document.xrefs[layer]) + -- print(document.xrefs[layer]) t[i] = layer.Name end t.n = n @@ -261,6 +261,10 @@ local function getlayers(document) end end +local function getstructure(document) + -- this might become a tree + return document.Catalog.StructTreeRoot +end local function getpages(document,Catalog) local data = document.data @@ -353,6 +357,7 @@ function lpdf.epdf.load(filename) document.widgets = delayed(document,"widgets", function() return getnames(document,Catalog.Names and Catalog.Names.AcroForm) end) document.embeddedfiles = delayed(document,"embeddedfiles",function() return getnames(document,Catalog.Names and Catalog.Names.EmbeddedFiles) end) document.layers = delayed(document,"layers", function() return getlayers(document) end) + document.structure = delayed(document,"structure", function() return getstructure(document) end) else document = false end diff --git a/tex/context/base/mlib-run.lua b/tex/context/base/mlib-run.lua index 2a34f44d5..bd00cc260 100644 --- a/tex/context/base/mlib-run.lua +++ b/tex/context/base/mlib-run.lua @@ -106,14 +106,24 @@ end mplib.preprocessed = preprocessed -- helper +local function validftype(ftype) + if ftype == "" then + -- whatever + elseif ftype == 0 then + -- mplib bug + else + return ftype + end +end + finders.file = function(specification,name,mode,ftype) - return preprocessed(resolvers.findfile(name,ftype)) + return preprocessed(resolvers.findfile(name,validftype(ftype))) end local function i_finder(name,mode,ftype) -- fake message for mpost.map and metafun.mpvi local specification = url.hashed(name) local finder = finders[specification.scheme] or finders.file - return finder(specification,name,mode,ftype) + return finder(specification,name,mode,validftype(ftype)) end local function o_finder(name,mode,ftype) @@ -123,9 +133,9 @@ end local function finder(name,mode,ftype) if mode == "w" then - return o_finder(name,mode,ftype) + return o_finder(name,mode,validftype(ftype)) else - return i_finder(name,mode,ftype) + return i_finder(name,mode,validftype(ftype)) end end diff --git a/tex/context/base/publ-aut.lua b/tex/context/base/publ-aut.lua index 0167d66e7..17c6a2fba 100644 --- a/tex/context/base/publ-aut.lua +++ b/tex/context/base/publ-aut.lua @@ -379,78 +379,7 @@ local splitter = sorters.splitters.utf local pubsorters = { } authors.sorters = pubsorters --- local function assemble(snippets,key) --- -- maybe an option is to also sort the authors first --- if not key then --- return "" --- end --- local n = #key --- if n == 0 then --- return "" --- end --- local s = 0 --- for i=1,n do --- local k = key[i] --- local vons = k.vons --- local surnames = k.surnames --- local initials = k.initials --- if vons and #vons > 0 then --- s = s + 1 ; snippets[s] = concat(vons," ") --- end --- if surnames and #surnames > 0 then --- s = s + 1 ; snippets[s] = concat(surnames," ") --- end --- if initials and #initials > 0 then --- s = s + 1 ; snippets[s] = concat(initials," ") --- end --- end --- local result = concat(snippets," ",1,s) --- return strip(result) --- end - --- local function byauthor(dataset,list,sorttype_a,sorttype_b,sorttype_c) --- local luadata = datasets[dataset].luadata --- local details = datasets[dataset].details --- local valid = { } --- local splitted = { } --- table.setmetatableindex(splitted,function(t,k) -- could be done in the sorter but seldom that many shared --- local v = splitter(k,true) -- in other cases --- t[k] = v --- return v --- end) --- local snippets = { } --- for i=1,#list do --- -- either { tag, tag, ... } or { { tag, index }, { tag, index } } --- local li = list[i] --- local tag = type(li) == "string" and li or li[1] --- local entry = luadata[tag] --- local detail = details[tag] --- local suffix = tostring(i) --- local year = nil --- local assembled = nil --- if entry and detail then --- assembled = assemble(snippets,detail.author or detail.editor) --- year = entry.year or "9998" --- else --- assembled = "" --- year = "9999" --- end --- valid[i] = { --- index = i, --- split = { --- splitted[strip(assembled)], --- splitted[year], --- splitted[suffix], --- splitted[entry.journal or ""], --- splitted[entry.title or ""], --- splitted[entry.pages or ""], --- }, --- } --- end --- return valid --- end - -local function writer(snippets,key) +local function writer(key,snippets) if not key then return "" end @@ -458,6 +387,9 @@ local function writer(snippets,key) if n == 0 then return "" end + if not snippets then + snippets = { } + end local s = 0 for i=1,n do local k = key[i] @@ -474,8 +406,7 @@ local function writer(snippets,key) s = s + 1 ; snippets[s] = concat(initials," ") end end - local result = concat(snippets," ",1,s) - return strip(result) + return concat(snippets," ",1,s) end local function newsplitter(splitter) @@ -502,11 +433,11 @@ local function byauthor(dataset,list,method) -- todo: yearsuffix result[i] = { index = i, split = { - splitted[writer(snippets,detail.author or detail.editor or "")], - splitted[entry.year or "9998"], - splitted[entry.journal or ""], - splitted[entry.title or ""], - splitted[entry.pages or ""], + splitted[strip(writer(detail.author or detail.editor or "",snippets))], + splitted[entry.year or "9998"], + splitted[strip(entry.journal or "")], + splitted[strip(entry.title or "")], + splitted[entry.pages or ""], splitted[tostring(i)], }, } @@ -527,6 +458,7 @@ local function byauthor(dataset,list,method) -- todo: yearsuffix return result end +authors.sorters.writer = writer authors.sorters.author = byauthor function authors.sorted(dataset,list,sorttype) -- experimental diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua index 4d4c9ef09..7ab03fb45 100644 --- a/tex/context/base/publ-ini.lua +++ b/tex/context/base/publ-ini.lua @@ -904,6 +904,39 @@ setmetatableindex(renderings,function(t,k) return v end) +-- helper + +-- local function sortedtags(dataset,list,sorttype) +-- local luadata = datasets[dataset].luadata +-- local valid = { } +-- for i=1,#list do +-- local tag = list[i] +-- local entry = luadata[tag] +-- if entry then +-- local key = entry[sorttype] +-- if key then +-- valid[#valid+1] = { +-- tag = tag, +-- split = sortsplitter(sortstripper(key)) +-- } +-- end +-- end +-- end +-- if #valid == 0 or #valid ~= #list then +-- return list +-- else +-- sorters.sort(valid,basicsorter) +-- for i=1,#valid do +-- valid[i] = valid[i].tag +-- end +-- return valid +-- end +-- end +-- +-- if sorttype and sorttype ~= "" then +-- tags = sortedtags(dataset,tags,sorttype) +-- end + -- why shorts vs tags: only for sorting function lists.register(dataset,tag,short) -- needs checking now that we split @@ -1060,6 +1093,86 @@ function lists.collectentries(specification) filtermethod(dataset,rendering,keyword) end +-- experiment + +local splitspec = lpeg.splitat(lpeg.S(":.")) +local splitter = sorters.splitters.utf +local strip = sorters.strip + +local function newsplitter(splitter) + return table.setmetatableindex({},function(t,k) -- could be done in the sorter but seldom that many shared + local v = splitter(k,true) -- in other cases + t[k] = v + return v + end) +end + +local writers = { + author = publications.authors.sorters.writer, + editor = publications.authors.sorters.writer, +} + +local template = [[ + local strip = sorters.strip + return function(entry,detail,splitted,i,writers) -- snippets + return { + index = i, + split = { %s, splitted[tostring(i)] } + } + end +]] + +local function byspec(dataset,list,method) -- todo: yearsuffix + local luadata = datasets[dataset].luadata + local details = datasets[dataset].details + local result = { } + local splitted = newsplitter(splitter) -- saves mem + -- local snippets = { } -- saves mem + local fields = utilities.parsers.settings_to_array(method) + for i=1,#fields do + local f = utilities.parsers.settings_to_array(fields[i]) + local r = { } + for i=1,#f do + local a, b = lpeg.match(splitspec,f[i]) + if b then + if a == "detail" or a == "entry" then + local w = writers[b] + if w then + -- r[#r+1] = formatters["(%s.%s and writers[%q](%s.%s,snippets))"](a,b,b,a,b) + r[#r+1] = formatters["(%s.%s and writers[%q](%s.%s))"](a,b,b,a,b) + else + r[#r+1] = formatters["%s.%s"](a,b,a,b) + end + end + elseif a then + r[#r+1] = formatters["%s"](a) + end + end + r[#r+1] = '""' + fields[i] = "splitted[strip(" .. concat(r," or ") .. ")]" + end + local action = formatters[template](concat(fields,", ")) + local prepare = loadstring(action) + if prepare then + prepare = prepare() + local dummy = { } + for i=1,#list do + -- either { tag, tag, ... } or { { tag, index }, { tag, index } } + local li = list[i] + local tag = type(li) == "string" and li or li[1] + local entry = luadata[tag] + local detail = details[tag] + if entry and detail then + result[i] = prepare(entry,detail,splitted,i,writers) -- ,snippets) + else + result[i] = prepare(dummy,dummy,splitted,i,writers) -- ,snippets) + end + end + end + return result +end + + lists.sorters = { [v_short] = function(dataset,rendering,list) local shorts = rendering.shorts @@ -1106,6 +1219,20 @@ lists.sorters = { -- end -- sort(list,compare) -- end, + [v_default] = function(dataset,rendering,list,sorttype) -- experimental + local valid = byspec(dataset,list,sorttype) + if #valid == 0 or #valid ~= #list then + -- nothing to sort + else + -- if needed we can wrap compare and use the list directly but this is cleaner + sorters.sort(valid,sortcomparer) + for i=1,#valid do + local v = valid[i] + valid[i] = list[v.index] + end + return valid + end + end, [v_author] = function(dataset,rendering,list) local valid = publications.authors.sorters.author(dataset,list) if #valid == 0 or #valid ~= #list then @@ -1152,7 +1279,7 @@ function lists.flushentries(dataset,sorttype) local repeated = rendering.repeated == v_yes local luadata = datasets[dataset].luadata if type(sorter) == "function" then - list = sorter(dataset,rendering,list) or list + list = sorter(dataset,rendering,list,sorttype) or list end -- local details = datasets[dataset].details for i=1,#list do @@ -1208,39 +1335,6 @@ commands.btxflushlistentries = lists.flushentries local citevariants = { } publications.citevariants = citevariants --- helper - -local function sortedtags(dataset,list,sorttype) - local luadata = datasets[dataset].luadata - local valid = { } - for i=1,#list do - local tag = list[i] - local entry = luadata[tag] - if entry then - local key = entry[sorttype] - if key then - valid[#valid+1] = { - tag = tag, - split = sortsplitter(sortstripper(key)) - } - end - end - end - if #valid == 0 or #valid ~= #list then - return list - else - sorters.sort(valid,basicsorter) - for i=1,#valid do - valid[i] = valid[i].tag - end - return valid - end -end - --- if sorttype and sorttype ~= "" then --- tags = sortedtags(dataset,tags,sorttype) --- end - local optionalspace = lpeg.patterns.whitespace^0 local prefixsplitter = optionalspace * lpeg.splitat(optionalspace * P("::") * optionalspace) diff --git a/tex/context/base/sort-ini.lua b/tex/context/base/sort-ini.lua index ab6ad0649..3937c77d5 100644 --- a/tex/context/base/sort-ini.lua +++ b/tex/context/base/sort-ini.lua @@ -535,6 +535,7 @@ local function prepare() pattern = Cs( ( characters.tex.toutfpattern() + lpeg.patterns.whitespace / "\000" + + (P("\\") / "") * R("AZ")^0 * (P(-1) + #(1-R("AZ"))) + (P("\\") * P(1) * R("az","AZ")^0) / "" + S("[](){}$\"'") / "" + R("09")^1 / numify diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 8cd6959c3..49f117626 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 75bf20d23..11ce54457 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv index 3642d6753..8af86a35e 100644 --- a/tex/context/base/syst-aux.mkiv +++ b/tex/context/base/syst-aux.mkiv @@ -6883,7 +6883,7 @@ \def\syst_helpers_direct_double_empty_one_nop#1{#1[][]} \def\syst_helpers_direct_double_empty_two_nop#1[#2]{#1[#2][]} -%D Used in math definitions (in an type {\edef}): +%D Used in math definitions (in an \type {\edef}): %D \startbuffer %D [\docheckedpair{}] diff --git a/tex/context/base/syst-ini.mkiv b/tex/context/base/syst-ini.mkiv index e01b8315c..f1aeb094d 100644 --- a/tex/context/base/syst-ini.mkiv +++ b/tex/context/base/syst-ini.mkiv @@ -766,8 +766,8 @@ \normalprotected\def\newfraction#1{\let#1\!!plusone} -%D It would be handy to have a primitive \unless\ifcase because then we could -%D use nicer values. Anyhow, this conditional code used to be in the \type +%D It would be handy to have a primitive \type {\unless\ifcase} because then we +%D could use nicer values. Anyhow, this conditional code used to be in the \type %D {syst-aux} module but is now promoted to here. %D \macros diff --git a/tex/context/base/tabl-xtb.lua b/tex/context/base/tabl-xtb.lua index 04f3eaa50..46f08c6df 100644 --- a/tex/context/base/tabl-xtb.lua +++ b/tex/context/base/tabl-xtb.lua @@ -25,7 +25,7 @@ this mechamism will be improved so that it can replace its older cousin. -- todo: use linked list instead of r/c array -local tonumber = tonumber +local tonumber, next = tonumber, next local commands = commands local context = context @@ -110,36 +110,36 @@ local stack, data = { }, nil function xtables.create(settings) table.insert(stack,data) - local rows = { } - local widths = { } - local heights = { } - local depths = { } - local spans = { } - local distances = { } - local autowidths = { } - local modes = { } - local fixedrows = { } - local fixedcolumns = { } - local frozencolumns = { } - local options = { } + local rows = { } + local widths = { } + local heights = { } + local depths = { } + local spans = { } + local distances = { } + local autowidths = { } + local modes = { } + local fixedrows = { } + local fixedcolumns = { } + local frozencolumns = { } + local options = { } data = { - rows = rows, - widths = widths, - heights = heights, - depths = depths, - spans = spans, - distances = distances, - modes = modes, - autowidths = autowidths, - fixedrows = fixedrows, - fixedcolumns = fixedcolumns, - frozencolumns = frozencolumns, - options = options, - nofrows = 0, - nofcolumns = 0, - currentrow = 0, - currentcolumn = 0, - settings = settings or { }, + rows = rows, + widths = widths, + heights = heights, + depths = depths, + spans = spans, + distances = distances, + modes = modes, + autowidths = autowidths, + fixedrows = fixedrows, + fixedcolumns = fixedcolumns, + frozencolumns = frozencolumns, + options = options, + nofrows = 0, + nofcolumns = 0, + currentrow = 0, + currentcolumn = 0, + settings = settings or { }, } local function add_zero(t,k) t[k] = 0 @@ -155,6 +155,9 @@ function xtables.create(settings) nx = 0, ny = 0, list = false, + wd = 0, + ht = 0, + dp = 0, } row[c] = cell if c > data.nofcolumns then @@ -210,7 +213,7 @@ function xtables.initialize_reflow_width(option) end if option and option ~= "" then local options = settings_to_hash(option) - data.options[r][c] = options + -- data.options[r][c] = options -- not yet used (commented elsewhere) if options[v_fixed] then data.frozencolumns[c] = true end @@ -218,8 +221,7 @@ function xtables.initialize_reflow_width(option) data.currentcolumn = c end --- local function rather_fixed(n) --- for n in node. +-- todo: we can better set the cell values in one go function xtables.set_reflow_width() local r = data.currentrow @@ -234,19 +236,29 @@ function xtables.set_reflow_width() -- drc.list = true -- we don't need to keep the content around as we're in trial mode (no: copy_node_list(tb)) -- - local widths, width = data.widths, getfield(tb,"width") + local width = getfield(tb,"width") + local height = getfield(tb,"height") + local depth = getfield(tb,"depth") + -- + local widths = data.widths + local heights = data.heights + local depths = data.depths if width > widths[c] then widths[c] = width end - local heights, height = data.heights, getfield(tb,"height") - if height > heights[r] then - heights[r] = height - end - local depths, depth = data.depths, getfield(tb,"depth") - if depth > depths[r] then - depths[r] = depth + if drc.ny < 2 then + if height > heights[r] then + heights[r] = height + end + if depth > depths[r] then + depths[r] = depth + end end -- + drc.wd = width + drc.ht = height + drc.dp = depth + -- local dimensionstate = texgetcount("frameddimensionstate") local fixedcolumns = data.fixedcolumns local fixedrows = data.fixedrows @@ -259,25 +271,45 @@ function xtables.set_reflow_width() elseif dimensionstate == 3 then fixedrows[r] = height -- width fixedcolumns[c] = width -- height - elseif data.options[v_auto] then -- new per 5/5/2014 - data.autowidths[c] = true - else - -- no dimensions are set in the cell - if width <= data.criterium_h and height >= data.criterium_v then - -- somewhat tricky branch - if width > fixedcolumns[c] then -- how about a span here? - -- maybe an image, so let's fix - fixedcolumns[c] = width - end - else - -- safeguard as it could be text that can be recalculated - -- and the previous branch could have happened in a previous - -- row and then forces a wrong one-liner in a multiliner - if width > fixedcolumns[c] then - data.autowidths[c] = true -- new per 5/5/2014 - end + elseif width <= data.criterium_h and height >= data.criterium_v then + -- somewhat tricky branch + if width > fixedcolumns[c] then -- how about a span here? + -- maybe an image, so let's fix + fixedcolumns[c] = width end end +-- +-- -- this fails so not good enough predictor +-- +-- -- \startxtable +-- -- \startxrow +-- -- \startxcell knuth \stopxcell +-- -- \startxcell \input knuth \stopxcell +-- -- \stopxrow +-- +-- else +-- local o = data.options[r][c] +-- if o and o[v_auto] then -- new per 5/5/2014 - removed per 15/07/2014 +-- data.autowidths[c] = true +-- else +-- -- no dimensions are set in the cell +-- if width <= data.criterium_h and height >= data.criterium_v then +-- -- somewhat tricky branch +-- if width > fixedcolumns[c] then -- how about a span here? +-- -- maybe an image, so let's fix +-- fixedcolumns[c] = width +-- end +-- else +-- -- safeguard as it could be text that can be recalculated +-- -- and the previous branch could have happened in a previous +-- -- row and then forces a wrong one-liner in a multiliner +-- if width > fixedcolumns[c] then +-- data.autowidths[c] = true -- new per 5/5/2014 - removed per 15/07/2014 +-- end +-- end +-- end +-- end +-- -- drc.dimensionstate = dimensionstate -- @@ -324,7 +356,6 @@ function xtables.initialize_reflow_height() end texsetdimen("d_tabl_x_width",w) local dimensionstate = drc.dimensionstate or 0 --- print(r,c,w,data.autowidths[c]) if dimensionstate == 1 or dimensionstate == 3 then -- width was fixed so height is known texsetcount("c_tabl_x_skip_mode",1) @@ -347,18 +378,30 @@ function xtables.set_reflow_height() -- while row[c].span do -- we could adapt drc.nx instead -- c = c + 1 -- end - local tb = getbox("b_tabl_x") + local tb = getbox("b_tabl_x") local drc = row[c] - if data.fixedrows[r] == 0 then -- and drc.dimensionstate < 2 - local heights, height = data.heights, getfield(tb,"height") - if height > heights[r] then - heights[r] = height - end - local depths, depth = data.depths, getfield(tb,"depth") - if depth > depths[r] then - depths[r] = depth + -- + local width = getfield(tb,"width") + local height = getfield(tb,"height") + local depth = getfield(tb,"depth") + -- + if drc.ny < 2 then + if data.fixedrows[r] == 0 then -- and drc.dimensionstate < 2 + local heights = data.heights + local depths = data.depths + if height > heights[r] then + heights[r] = height + end + if depth > depths[r] then + depths[r] = depth + end end end + -- + drc.wd = width + drc.ht = height + drc.dp = depth + -- -- c = c + drc.nx - 1 -- data.currentcolumn = c end @@ -372,23 +415,35 @@ function xtables.initialize_construct() c = c + 1 end data.currentcolumn = c - local widths = data.widths + local widths = data.widths local heights = data.heights - local depths = data.depths - local w = widths[c] - local h = heights[r] - local d = depths[r] + local depths = data.depths + -- local drc = row[c] + local wd = drc.wd + local ht = drc.ht + local dp = drc.dp + -- + local width = widths[c] + local height = heights[r] + local depth = depths[r] + -- for x=1,drc.nx-1 do - w = w + widths[c+x] + width = width + widths[c+x] end - for y=1,drc.ny-1 do - h = h + heights[r+y] - d = d + depths[r+y] + -- + local total = height + depth + local ny = drc.ny + if ny > 1 then + for y=1,ny-1 do + local nxt = r + y + total = total + heights[nxt] + depths[nxt] + end end - texsetdimen("d_tabl_x_width",w) - texsetdimen("d_tabl_x_height",h + d) - texsetdimen("d_tabl_x_depth",0) + -- + texsetdimen("d_tabl_x_width",width) + texsetdimen("d_tabl_x_height",total) + texsetdimen("d_tabl_x_depth",0) -- for now end function xtables.set_construct() @@ -401,8 +456,7 @@ function xtables.set_construct() -- end local drc = row[c] -- this will change as soon as in luatex we can reset a box list without freeing --- drc.list = copy_node_list(getbox("b_tabl_x")) -drc.list = takebox("b_tabl_x") + drc.list = takebox("b_tabl_x") -- c = c + drc.nx - 1 -- data.currentcolumn = c end @@ -435,6 +489,8 @@ function xtables.reflow_width() local maxwidth = settings.maxwidth -- calculate width local widths = data.widths + local heights = data.heights + local depths = data.depths local distances = data.distances local autowidths = data.autowidths local fixedcolumns = data.fixedcolumns @@ -576,10 +632,42 @@ function xtables.reflow_height() data.currentrow = 0 data.currentcolumn = 0 local settings = data.settings + -- + -- analyze ny + -- + local nofrows = data.nofrows + local nofcolumns = data.nofcolumns + local widths = data.widths + local heights = data.heights + local depths = data.depths + -- + for r=1,nofrows do + for c=1,nofcolumns do + local drc = data.rows[r][c] + if drc then + local ny = drc.ny + if ny > 1 then + local height = heights[r] + local depth = depths[r] + local total = height + depth + local htdp = drc.ht + drc.dp + for y=1,ny-1 do + local nxt = r + y + total = total + heights[nxt] + depths[nxt] + end + local delta = htdp - total + if delta > 0 then + delta = delta / ny + for y=1,ny do + heights[y] = heights[y] + delta + end + end + end + end + end + end + -- if settings.options[v_height] then - local heights = data.heights - local depths = data.depths - local nofrows = data.nofrows local totalheight = 0 local totaldepth = 0 for i=1,nofrows do @@ -597,6 +685,7 @@ function xtables.reflow_height() end end end + -- end local function showspans(data) diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 09582f980..c6ac4511a 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 : 07/14/14 19:25:59 +-- merge date : 07/17/14 11:19:17 do -- begin closure to overcome local limits and interference @@ -7236,7 +7236,9 @@ end unicode=cidunicodes[index] end if unicode and descriptions[unicode] then - report_otf("preventing glyph %a at index %H to overload unicode %U",name or "noname",index,unicode) + if trace_private then + report_otf("preventing glyph %a at index %H to overload unicode %U",name or "noname",index,unicode) + end unicode=-1 end if not unicode or unicode==-1 then |