From 82ea6961d63e1ed2924e5ac885a03a4cf65a2069 Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Tue, 14 Jul 2015 11:15:05 +0200 Subject: 2015-07-14 10:39:00 --- tex/context/base/buff-ini.mkiv | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4204 -> 4208 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/font-mps.lua | 95 ++++++++++++++------- tex/context/base/mlib-pps.lua | 9 +- tex/context/base/mult-fun.lua | 8 +- tex/context/base/node-aux.lua | 6 +- tex/context/base/page-set.mkiv | 42 ++++----- tex/context/base/status-files.pdf | Bin 24374 -> 24384 bytes tex/context/base/status-lua.pdf | Bin 254528 -> 254535 bytes tex/context/base/x-asciimath.mkiv | 2 +- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 13 files changed, 109 insertions(+), 61 deletions(-) (limited to 'tex') diff --git a/tex/context/base/buff-ini.mkiv b/tex/context/base/buff-ini.mkiv index cd6b7bfe5..0d3d8b792 100644 --- a/tex/context/base/buff-ini.mkiv +++ b/tex/context/base/buff-ini.mkiv @@ -170,7 +170,7 @@ \unexpanded\def\buff_get[#1]% [name] {\namedbufferparameter\empty\c!before -% \doifelsenothing{#1} + \doifelsenothing{#1} {\buff_get_stored_indeed\empty} {\processcommalist[#1]\buff_get_stored_indeed}% \namedbufferparameter\empty\c!after} diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index c211c1c4d..3218ee57e 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{2015.07.12 23:30} +\newcontextversion{2015.07.14 10:37} %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 63e8b04f3..d2aec8d30 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 34b39aa35..aed7f884c 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2015.07.12 23:30} +\edef\contextversion{2015.07.14 10:37} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/font-mps.lua b/tex/context/base/font-mps.lua index 0cb07bbb8..478f29813 100644 --- a/tex/context/base/font-mps.lua +++ b/tex/context/base/font-mps.lua @@ -17,9 +17,11 @@ local formatters = string.formatters -- CP1 = QP0 + 2/3 *(QP1-QP0) -- CP2 = QP2 + 2/3 *(QP1-QP2) -fonts = fonts or { } -local metapost = fonts.metapost or { } -fonts.metapost = metapost +fonts = fonts or { } +local metapost = fonts.metapost or { } +fonts.metapost = metapost + +local trace_skips = false trackers.register("metapost.outlines.skips",function(v) trace_skips = v end) local f_moveto = formatters["(%.4F,%.4F)"] local f_lineto = formatters["--(%.4F,%.4F)"] @@ -246,8 +248,11 @@ local kern_code = nodecodes.kern local glue_code = nodecodes.glue local hlist_code = nodecodes.hlist local vlist_code = nodecodes.vlist +local rule_code = nodecodes.rule local penalty_code = nodecodes.penalty +local find_tail = nodes.tail + ----- metapost = fonts.glyphs.metapost local characters = fonts.hashes.characters @@ -278,7 +283,8 @@ function metapost.output(kind,font,char,advance,shift) local advance = advance or 0 local paths = topaths(glyf,factor) local code = f_code(kind,#paths,advance,shift,paths) - return code, glyf.width * factor + -- return code, glyf.width * factor + return code, character.width * fc end end end @@ -288,54 +294,78 @@ end -- shifted hboxes +local signal = -0x3FFFFFFF - 1 + function fonts.metapost.boxtomp(n,kind) local result = { } - local advance = 0 + local advance = 0 -- in bp local distance = 0 + local llx, lly, urx, ury = 0, 0, 0, 0 + local boxtomp - local function horizontal(current,shift,glue_sign,glue_set,glue_order) + local function horizontal(current,shift,glue_sign,glue_set,glue_order,ht,dp) + shift = shift or 0 while current do local id = current.id if id == glyph_code then - local code, width = metapost.output(kind,current.font,current.char,advance,-(shift or 0)* fc) + local code, width = metapost.output(kind,current.font,current.char,advance,-shift*fc) result[#result+1] = code advance = advance + width elseif id == disc_code then local replace = current.replace if replace then - horizontal(replace,shift,glue_sign,glue_set,glue_order) + horizontal(replace,shift,glue_sign,glue_set,glue_order,ht,dp) end elseif id == kern_code then - advance = advance + current.kern * fc + local kern = current.kern * fc + if trace_skips then -- todo: shift + result[#result+1] = formatters["draw rule(%3F,%3F,%3F) shifted (%3F,%3F) withcolor .5white;"](kern,0.8*ht*fc,0.8*dp*fc,advance,-shift*fc) + end + advance = advance + kern elseif id == glue_code then local spec = current.spec local width = spec.width if glue_sign == 1 then if spec.stretch_order == glue_order then - advance = advance + (width + spec.stretch * glue_set) * fc + width = (width + spec.stretch * glue_set) * fc else - advance = advance + width * fc + width = width * fc end elseif glue_sign == 2 then if spec.shrink_order == glue_order then - advance = advance + (width - spec.shrink * glue_set) * fc + width = (width - spec.shrink * glue_set) * fc else - advance = advance + width * fc + width = width * fc end else - advance = advance + width * fc + width = width * fc + end + if trace_skips then -- todo: shift + result[#result+1] = formatters["draw rule(%3F,%3F,%3F) shifted (%3F,%3F) withcolor .5white;"](width,0.1*ht*fc,0.1*dp*fc,advance,-shift*fc) end + advance = advance + width elseif id == hlist_code then local a = advance - boxtomp(current,(shift or 0)+current.shift,current.glue_sign,current.glue_set,current.glue_order) + boxtomp(current,shift+current.shift,current.glue_sign,current.glue_set,current.glue_order) advance = a + current.width * fc elseif id == vlist_code then - boxtomp(current) -- ,distance + (shift or 0),current.glue_set*current.glue_sign) + boxtomp(current) -- ,distance + shift,current.glue_set*current.glue_sign) elseif id == rule_code then - -- todo + local wd = current.width + local ht = current.height + local dp = current.depth + if not (ht == signal or dp == signal or wd == signal) then + ht = ht - shift + dp = dp - shift + if wd == 0 then + result[#result+1] = formatters["strut(%3F,%3F);"](ht*fc,-dp*fc) + else + result[#result+1] = formatters["draw rule(%3F,%3F,%3F);"](wd*fc,ht*fc,-dp*fc) + end + end else -- print("horizontal >>>",nodecodes[id]) end @@ -344,22 +374,24 @@ function fonts.metapost.boxtomp(n,kind) end local function vertical(current,shift) + shift = shift or 0 + current = find_tail(current) -- otherwise bad bbox while current do local id = current.id if id == hlist_code then - distance = distance + current.height - boxtomp(current,distance + (shift or 0),current.glue_set*current.glue_sign) - distance = distance + current.depth + distance = distance - current.depth + boxtomp(current,distance + shift,current.glue_set*current.glue_sign) + distance = distance - current.height elseif id == vlist_code then print("vertical >>>",nodecodes[id]) elseif id == kern_code then - distance = distance + current.kern + distance = distance - current.kern advance = 0 elseif id == glue_code then - distance = distance + current.spec.width + distance = distance - current.spec.width advance = 0 end - current = current.next + current = current.prev end end @@ -367,21 +399,24 @@ function fonts.metapost.boxtomp(n,kind) local current = list.list if current then if list.id == hlist_code then - horizontal(current,shift,list.glue_sign,list.glue_set,list.glue_order) + horizontal(current,shift,list.glue_sign,list.glue_set,list.glue_order,list.height,list.depth) else vertical(current,shift) end -result[#result+1] = formatters["setbounds currentpicture to %s;"] ( metapost.boundingbox ( - { boundingbox = { 0, -list.depth, list.width, list.height } }, - fc -) ) end end - -- todo: honor struts / ht dp - local box = tex.box[n] + boxtomp(box,box.shift,box.glue_sign,box.glue_set,box.glue_order) + + local wd = box.width + local ht = box.height + local dp = box.depth + local sh = box.shift + + result[#result+1] = formatters["checkbounds(%3F,%3F,%3F,%3F);"](0,-dp*fc,wd*fc,ht*fc) + return concat(result) end diff --git a/tex/context/base/mlib-pps.lua b/tex/context/base/mlib-pps.lua index 0b31bd6bf..759149073 100644 --- a/tex/context/base/mlib-pps.lua +++ b/tex/context/base/mlib-pps.lua @@ -280,6 +280,9 @@ end local function settext(box,slot) if top then + -- if trace_textexts then + -- report_textexts("getting text %s from box %s",slot,box) + -- end top.textexts[slot] = copy_list(texgetbox(box)) texsetbox(box,nil) -- this can become @@ -292,9 +295,9 @@ end local function gettext(box,slot) if top then texsetbox(box,copy_list(top.textexts[slot])) - if trace_textexts then - report_textexts("putting text %s in box %s",slot,box) - end + -- if trace_textexts then + -- report_textexts("putting text %s in box %s",slot,box) + -- end -- top.textexts[slot] = nil -- no, pictures can be placed several times else -- weird error diff --git a/tex/context/base/mult-fun.lua b/tex/context/base/mult-fun.lua index 1b750d73c..6be8e83db 100644 --- a/tex/context/base/mult-fun.lua +++ b/tex/context/base/mult-fun.lua @@ -13,6 +13,7 @@ return { -- "angleoffset", anglelength", anglemethod", "metapostversion", "maxdimensions", + "drawoptionsfactor", }, commands = { "transparency", @@ -51,6 +52,7 @@ return { "onlayer", "along", "graphictext", "loadfigure", "externalfigure", "figure", "register", "outlinetext", -- "lua", + "checkedbounds", "checkbounds", "strut", "rule", "withmask", "bitmapimage", "colordecimals", "ddecimal", "dddecimal", "ddddecimal", "textext", "thetextext", "rawtextext", "textextoffset", @@ -106,9 +108,9 @@ return { "colortype", "whitecolor", "blackcolor", "basiccolors", -- -- "swappointlabels", - "normalfill", "normaldraw", "visualizepaths", "naturalizepaths", + "normalfill", "normaldraw", "visualizepaths", "detailpaths", "naturalizepaths", "drawboundary", "drawwholepath", "drawpathonly", - "visualizeddraw", "visualizedfill", + "visualizeddraw", "visualizedfill", "detaileddraw", "draworigin", "drawboundingbox", "drawpath", "drawpoint", "drawpoints", "drawcontrolpoints", "drawcontrollines", @@ -125,5 +127,7 @@ return { -- "eofill", "eoclip", "nofill", "area", + -- + "addbackground", }, } diff --git a/tex/context/base/node-aux.lua b/tex/context/base/node-aux.lua index 12da8ea8a..f9b300d1e 100644 --- a/tex/context/base/node-aux.lua +++ b/tex/context/base/node-aux.lua @@ -89,8 +89,10 @@ local function takebox(id) if box then local copy = copy_node(box) local list = getlist(box) - setfield(copy,"list",list) - setfield(box,"list",nil) + if list then + setfield(copy,"list",list) + setfield(box,"list",nil) + end texsetbox(id,nil) return copy end diff --git a/tex/context/base/page-set.mkiv b/tex/context/base/page-set.mkiv index a5afb92e9..105fedb3e 100644 --- a/tex/context/base/page-set.mkiv +++ b/tex/context/base/page-set.mkiv @@ -694,7 +694,7 @@ \installcolumnbreakmethod \s!columnset \v!page {\page_otr_fill_and_eject_page} - + \newtoks\OTRSETeverystartofcolumn \newbox\OTRSETsavedfootnotes @@ -857,7 +857,7 @@ \fi} \let\OTRSETcheckfreelines\donothing - + \def\OTRSETfillgapsbetweencells#1#2% col {\ifnum\columngaplimit>\zerocount \donefalse @@ -885,7 +885,7 @@ \appendtoks \OTRSETfillgapsbetweencells\mofcolumns\plusone \to \OTRSETeverystartofcolumn - + \newif\ifspancolumnslots \spancolumnslotstrue \newif\ifcheckcolumnspan \checkcolumnspantrue @@ -963,7 +963,7 @@ \columnlastcell\savedcolumnlastcell \OTRSETsavebox{#1}% \fi} - + \newdimen\totalcolumnspace \def\columnspacetopoffset{0} @@ -1298,7 +1298,7 @@ \ifnum#1<3\vss\fi \egroup \fi} - + \unexpanded\def\page_set_command_check_if_float_fits {\global\ifconditional\c_page_floats_not_permitted\setfalse\c_page_floats_room\else\settrue\c_page_floats_room\fi} @@ -1334,6 +1334,13 @@ \ifdim\floatwidth>\zeropoint \!!doneatrue \page_floats_flush\s!text\plusone +% +% a quick hack ... will be redone +% +\ifdim\wd\floatbox<\floatwidth \ifhbox\floatbox + \global\setbox\floatbox\hbox{\unhbox\floatbox}% +\fi \fi +% \dp\floatbox\zeropoint \OTRSETstoreincolumnslot{TBLR}\floatbox \if!!donea @@ -1349,9 +1356,8 @@ \exitloop \fi} \egroup} - -\newif\ifcentergridcells \centergridcellstrue +\newif\ifcentergridcells \centergridcellstrue \newif\ifcentergridcellonly \centergridcellonlyfalse \newif\ifautocentergridcellonly \autocentergridcellonlytrue @@ -1420,7 +1426,7 @@ \fi \fi}}% \fi} - + \def\OTRSETinitializecolumns% once per page {\columnspreadtrue % todo \ifcolumnspread @@ -1442,7 +1448,7 @@ \OTRSETassignwidths \global\mofcolumns\plusone \page_set_cell_erase_grid} - + % this is a first step in upgrading \installcorenamespace{columnset} @@ -1558,7 +1564,7 @@ \v!last=>\expanded{\doOTRSETgotoCOLUMN{\the\nofcolumns}}, \s!default=>\OTRSETdummycolumn, \s!unknown=>\expanded{\doOTRSETgotoCOLROW{\commalistelement}}]} - + % to be documented and tested, not yet that robust % \def\OTRSETgotocell#1#2% @@ -1600,7 +1606,7 @@ {\endgraf \doOTRSETgotoCOLUMN{#1}% \doOTRSETgotoROW {#2}} - + \def\OTRSETdummycolumn {\verticalstrut \vskip-\struttotal @@ -2032,7 +2038,7 @@ \@EA\uppercasestring\floatmethod\to\floatmethod \OTRSETstoreincolumnslot\floatmethod\floatbox \page_floats_report_total} - + % kind of new, looks much like OTRONE, but not entirely \newconditional\c_page_set_top_of_insert @@ -2046,10 +2052,8 @@ \ifnum\rootfloatparameter\c!nbottom=\zerocount \ifnum\rootfloatparameter\c!nlines>\zerocount \ifdim\totaltopinserted>\zeropoint\relax - \dimen0\lineheight - \dimen0=\rootfloatparameter\c!nlines\dimen0 - \advance\dimen0 \totaltopinserted\relax - \ifdim\dimen0>\textheight % \vsize %%%%%%%%% \textheight + \scratchdimen\dimexpr\rootfloatparameter\c!nlines\lineheight+\totaltopinserted\relax + \ifdim\scratchdimen>\textheight % \vsize %%%%%%%%% \textheight \showmessage\m!floatblocks8{\rootfloatparameter\c!nlines}% \page_otr_fill_and_eject_page % was triple: vfilll \fi @@ -2080,7 +2084,7 @@ \blank[\rootfloatparameter\c!spaceafter]}% \global\advance\d_page_floats_inserted_top \ht\scratchbox\relax \ifdim\d_page_floats_inserted_top>\vsize % was \textheight\relax - \OTRSETresavebox\floatbox + \OTRSETresavebox\scratchbox \noffloatinserts\c_page_floats_n_of_top\relax \global\advance\d_page_floats_inserted_top -\ht\scratchbox \let\OTRSETdodosettopinserts\relax % to be tested @@ -2167,7 +2171,7 @@ % \box\columnbotbox\mofcolumns} \fi \global\d_page_floats_inserted_bottom\zeropoint\relax} % goes away - + % set ipv text % left right 1 2 3 +1 +2 +3 @@ -2441,7 +2445,7 @@ \else \d_strc_float_temp_width \fi} - + \unexpanded\def\definecolumnsetspan {\dodoubleempty\dodefinecolumnsetspan} diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 458af0624..71aec6f9b 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 9d961bd91..a200aa55e 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/x-asciimath.mkiv b/tex/context/base/x-asciimath.mkiv index a1254a445..d3a629c81 100644 --- a/tex/context/base/x-asciimath.mkiv +++ b/tex/context/base/x-asciimath.mkiv @@ -157,7 +157,7 @@ }}% \to \everysetupasciimath -\newtoks\everyascimath +\newtoks\everyasciimath % \appendtoks % \ignorediscretionaries diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 1fe4ebf40..5bd8eecf3 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/12/15 23:30:14 +-- merge date : 07/14/15 10:37:12 do -- begin closure to overcome local limits and interference -- cgit v1.2.3