From 78f55ee13ec8a41dc28a1b6ac91ea259df0965d9 Mon Sep 17 00:00:00 2001 From: Marius Date: Fri, 17 Feb 2012 01:20:15 +0200 Subject: beta 2012.02.16 23:57 --- tex/context/base/anch-pgr.lua | 50 +++++++++++++++++- tex/context/base/anch-pos.lua | 56 ++++++++++++--------- tex/context/base/cont-new.mkii | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4074 -> 4074 bytes tex/context/base/context-version.png | Bin 105522 -> 105550 bytes tex/context/base/context.mkii | 2 +- tex/context/base/context.mkiv | 2 +- tex/context/base/page-set.mkiv | 6 ++- tex/context/base/regi-ini.lua | 37 ++++++++++++-- tex/context/base/status-files.pdf | Bin 24322 -> 24314 bytes tex/context/base/status-lua.pdf | Bin 172240 -> 172259 bytes tex/context/base/strc-des.mkvi | 4 ++ tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 14 files changed, 128 insertions(+), 35 deletions(-) (limited to 'tex') diff --git a/tex/context/base/anch-pgr.lua b/tex/context/base/anch-pgr.lua index 3d020ca64..821cec6be 100644 --- a/tex/context/base/anch-pgr.lua +++ b/tex/context/base/anch-pgr.lua @@ -73,6 +73,7 @@ local function shapes(r,rx,ry,rw,rh,rd,lytop,lybot,rytop,rybot) local paragraphs = r.paragraphs local left = { { rx, rh } } local right = { { rw, rh } } + local extending = false if paragraphs then for i=1,#paragraphs do local p = paragraphs[i] @@ -100,12 +101,57 @@ local function shapes(r,rx,ry,rw,rh,rd,lytop,lybot,rytop,rybot) add(left,rx, py_ph + hang) end end +extending = false + else -- we need to clip to the next par + local ps = p.ps + if ps then + local py = p.y + local ph = p.h + local pd = p.d + local step = ph + pd + local size = #ps * step + local py_ph = py + ph + add(left,rx,py_ph) + add(right,rw,py_ph) + for i=1,#ps do + local p = ps[i] + local l = p[1] + local w = p[2] + add(left,rx + l, py_ph) + add(right,rx + l + w, py_ph) + py_ph = py_ph - step + add(left,rx + l, py_ph) + add(right,rx + l + w, py_ph) + end + extending = true +-- add(left,rx,py_ph) +-- add(right,rw,py_ph) + else + if extending then + local py = p.y + local ph = p.h + local pd = p.d + local py_ph = py + ph + local py_pd = py - pd + add(left,left[#left][1],py_ph) + add(right,right[#right][1],py_ph) + add(left,rx,py_ph) + add(right,rw,py_ph) +extending = false + end + end end end end -- we can have a simple variant when no paragraphs - add(left,rx,rd) - add(right,rw,rd) + if extending then + -- not ok + left[#left][2] = rd + right[#right][2] = rw + else + add(left,rx,rd) + add(right,rw,rd) + end return clip(left,lytop,lybot), clip(right,rytop,rybot) end diff --git a/tex/context/base/anch-pos.lua b/tex/context/base/anch-pos.lua index b43cd3781..d6fefd3b8 100644 --- a/tex/context/base/anch-pos.lua +++ b/tex/context/base/anch-pos.lua @@ -52,21 +52,22 @@ job.positions = jobpositions _plib_ = jobpositions -local default = { +local default = { -- not r and paragraphs etc __index = { - x = 0, -- x position baseline - y = 0, -- y position baseline - w = 0, -- width - h = 0, -- height - d = 0, -- depth - p = 0, -- page - n = 0, -- paragraph - ls = 0, -- leftskip - rs = 0, -- rightskip - hi = 0, -- hangindent - ha = 0, -- hangafter - hs = 0, -- hsize - pi = 0, -- parindent + x = 0, -- x position baseline + y = 0, -- y position baseline + w = 0, -- width + h = 0, -- height + d = 0, -- depth + p = 0, -- page + n = 0, -- paragraph + ls = 0, -- leftskip + rs = 0, -- rightskip + hi = 0, -- hangindent + ha = 0, -- hangafter + hs = 0, -- hsize + pi = 0, -- parindent + ps = false, -- parshape } } @@ -79,11 +80,10 @@ local function initializer() collected = jobpositions.collected -- enhance regions with paragraphs for tag, data in next, collected do - local hi = data.hi - if hi and hi ~= 0 then - local region = data.r - if region then - local r = collected[region] + local region = data.r + if region then + local r = collected[region] + if r then local paragraphs = r.paragraphs if not paragraphs then r.paragraphs = { data } @@ -92,19 +92,25 @@ local function initializer() end end end + setmetatable(data,default) end + -- add metatable + -- for tag, data in next, collected do + -- setmetatable(data,default) + -- end -- sort this data and add metatable for tag, data in next, collected do local region = data.r if region then local r = collected[region] - local paragraphs = r.paragraphs - if paragraphs and #paragraphs > 1 then - sort(paragraphs,sorter) + if r then + local paragraphs = r.paragraphs + if paragraphs and #paragraphs > 1 then + sort(paragraphs,sorter) + end end end -- so, we can be sparse and don't need 'or 0' code - setmetatable(data,default) end end @@ -348,6 +354,7 @@ function commands.parpos() -- todo: relate to localpar (so this is an intermedia local hangindent = tex.hangindent local hangafter = tex.hangafter local parindent = tex.parindent + local parshape = tex.parshape if leftskip ~= 0 then t.ls = leftskip end @@ -363,6 +370,9 @@ function commands.parpos() -- todo: relate to localpar (so this is an intermedia if parindent ~= 0 then t.pi = parindent end + if parshape and #parshape > 0 then + t.ps = parshape + end local tag = format("p:%s",nofparagraphs) tobesaved[tag] = t context(new_latelua(format("_plib_.enhance(%q)",tag))) diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index d84e7c457..568e161f9 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.02.16 17:54} +\newcontextversion{2012.02.16 23:57} %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 954023287..3c9cbb3ef 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.02.16 17:54} +\newcontextversion{2012.02.16 23:57} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index 1ad49e359..31d8cfdf5 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-version.png b/tex/context/base/context-version.png index 9aee2c118..ac35a6918 100644 Binary files a/tex/context/base/context-version.png and b/tex/context/base/context-version.png differ diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index 665b4bf33..489dfd378 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.02.16 17:54} +\edef\contextversion{2012.02.16 23:57} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 299536c6d..6c6cf6145 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -23,7 +23,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2012.02.16 17:54} +\edef\contextversion{2012.02.16 23:57} %D For those who want to use this: diff --git a/tex/context/base/page-set.mkiv b/tex/context/base/page-set.mkiv index 97ede1357..bbceef77a 100644 --- a/tex/context/base/page-set.mkiv +++ b/tex/context/base/page-set.mkiv @@ -1595,7 +1595,8 @@ \page_set_command_set_hsize \else \bgroup - \fi} + \fi + \begingroup} % extra grouping needed ... else weird issue with ungrouped font switch (e.g. \ss) % \setuplayout[grid=yes] \definecolumnset[example] \showgrid @@ -1622,7 +1623,8 @@ {}} \unexpanded\def\stopcolumnset - {\relax + {\endgraf + \endgroup % ends extra grouping \ifnum\columnsetlevel=\plusone \endgraf % needed, else wrong vsize in one par case \global\settrue\OTRSETfinish diff --git a/tex/context/base/regi-ini.lua b/tex/context/base/regi-ini.lua index b5e928af0..ec6f812cc 100644 --- a/tex/context/base/regi-ini.lua +++ b/tex/context/base/regi-ini.lua @@ -12,11 +12,13 @@ if not modules then modules = { } end modules ['regi-ini'] = { runtime.

--ldx]]-- -local utfchar = utf.char +local utfchar, utfgsub = utf.char, utf.gsub local char, gsub, format = string.char, string.gsub, string.format local next = next local insert, remove = table.insert, table.remove + +local allocate = utilities.storage.allocate local sequencers = utilities.sequencers local textlineactions = resolvers.openers.helpers.textlineactions local setmetatableindex = table.setmetatableindex @@ -33,10 +35,15 @@ local report_translating = logs.reporter("regimes","translating") regimes = regimes or { } local regimes = regimes -local mapping = { +local mapping = allocate { utf = false } +local backmapping = allocate { +} + +-- regimes.mapping = mapping + local synonyms = { -- backward compatibility list ["windows-1250"] = "cp1250", @@ -109,7 +116,17 @@ local function loadregime(mapping,regime) return vector end -setmetatableindex(mapping, loadregime) +local function loadreverse(t,k) + local t = { } + for k, v in next, mapping[k] do + t[v] = k + end + backmapping[k] = t + return t +end + +setmetatableindex(mapping, loadregime) +setmetatableindex(backmapping, loadreverse) local function translate(line,regime) if line and #line > 0 then @@ -121,6 +138,19 @@ local function translate(line,regime) return line end +local function toregime(vector,str,default) -- toregime('8859-1',"abcde Ä","?") + local t = backmapping[vector] + local m = getmetatable(t) + setmetatableindex(t, function(t,k) + local v = default or "?" + t[k] = v + return v + end) + str = utfgsub(str,".",t) + setmetatable(t,m) + return str +end + local function disable() currentregime = "utf" sequencers.disableaction(textlineactions,"regimes.process") @@ -136,6 +166,7 @@ local function enable(regime) end end +regimes.toregime = toregime regimes.translate = translate regimes.enable = enable regimes.disable = disable diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 73fc72cfd..56def7add 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.pdf b/tex/context/base/status-lua.pdf index 39e8f7b49..b36798788 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/strc-des.mkvi b/tex/context/base/strc-des.mkvi index ec74a3359..845fb648c 100644 --- a/tex/context/base/strc-des.mkvi +++ b/tex/context/base/strc-des.mkvi @@ -21,6 +21,10 @@ \let\setupdescriptions\setupdescription +% \setupdescriptions % check with old +% [\c!alternative=\descriptionparameter\c!location, +% \c!location=\v!left] + \setupdescriptions % check with old [\c!alternative=\v!left, \c!headstyle=\v!bold, diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index b8bc1b134..6b1a41c09 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 : 02/16/12 17:54:20 +-- merge date : 02/16/12 23:57:34 do -- begin closure to overcome local limits and interference -- cgit v1.2.3