diff options
21 files changed, 165 insertions, 127 deletions
diff --git a/doc/context/documents/general/manuals/luatex.pdf b/doc/context/documents/general/manuals/luatex.pdf Binary files differindex 760995ea8..07bd03751 100644 --- a/doc/context/documents/general/manuals/luatex.pdf +++ b/doc/context/documents/general/manuals/luatex.pdf diff --git a/doc/context/sources/general/manuals/luatex/luatex-libraries.tex b/doc/context/sources/general/manuals/luatex/luatex-libraries.tex index df81bcea4..93ea85118 100644 --- a/doc/context/sources/general/manuals/luatex/luatex-libraries.tex +++ b/doc/context/sources/general/manuals/luatex/luatex-libraries.tex @@ -4246,6 +4246,7 @@ This is an experimental function that will append a node list to \TEX's \quote either! \subsubsection{\type {node.protrusion_skippable}} + \startfunctioncall <boolean> skippable = node.protrusion_skippable(<node> n) \stopfunctioncall @@ -4253,6 +4254,45 @@ either! Returns \type {true} if, for the purpose of line boundary discovery when character protrusion is active, this node can be skipped. +\subsection{Glue handling} + +\subsubsection{\type {node.setglue}} + +You can set the properties of a glue in one go. If you pass no values, the glue +will become a zero glue. + +\startfunctioncall +node.setglue(<node> n) +node.setglue(<node> n,width,stretch,shrink,stretch_order,shrink_order) +\stopfunctioncall + +When you pass values, only arguments that are numbers +are assigned so + +\starttyping +node.setglue(n,655360,false,65536) +\stoptyping + +will only adapt the width and shrink. + +\subsubsection{\type {node.getglue}} + +The next call will return 5 values (or northing when no glue is passed). + +\startfunctioncall +<integer> width, <integer> stretch, <integer> shrink, <integer> stretch_order, + <integer> shrink_order = node.getglue(<node> n) +\stopfunctioncall + +\subsubsection{\type {node.is_zero_glue}} + +This function returns \type {true} when the width, stretch and shrink properties +are zero. + +\startfunctioncall +<boolean> isglue = node.is_zero_glue(<node> n) +\stopfunctioncall + \subsection{Attribute handling} Attributes appear as linked list of userdata objects in the \type {attr} field of diff --git a/doc/context/sources/general/manuals/luatex/luatex-nodes.tex b/doc/context/sources/general/manuals/luatex/luatex-nodes.tex index a48e2f267..e77590369 100644 --- a/doc/context/sources/general/manuals/luatex/luatex-nodes.tex +++ b/doc/context/sources/general/manuals/luatex/luatex-nodes.tex @@ -1225,7 +1225,7 @@ summarized this: \starttabulate[|T|c|c|] \HL -\NC \bf function \NC \bf node \NC \bf direct \NC \NR +\NC \bf function \NC \bf node \NC \bf direct \NC \NR \HL \NC \type {copy_list} \NC \yes \NC \yes \NC \NR \NC \type {copy} \NC \yes \NC \yes \NC \NR @@ -1305,6 +1305,9 @@ summarized this: \NC \type {whatsits} \NC \yes \NC \nop \NC \NR \NC \type {whatsitsubtypes} \NC \yes \NC \nop \NC \NR \NC \type {write} \NC \yes \NC \yes \NC \NR +\NC \type {setglue} \NC \yes \NC \yes \NC \NR +\NC \type {getglue} \NC \yes \NC \yes \NC \NR +\NC \type {glue_is_zero} \NC \yes \NC \yes \NC \NR \stoptabulate \stop diff --git a/metapost/context/base/mpiv/mp-tool.mpiv b/metapost/context/base/mpiv/mp-tool.mpiv index 306b40f0a..05f9d9edc 100644 --- a/metapost/context/base/mpiv/mp-tool.mpiv +++ b/metapost/context/base/mpiv/mp-tool.mpiv @@ -1702,6 +1702,22 @@ enddef ; let greyed = grayed ; +vardef hsvtorgb(expr h,s,v) = + save H, S, V, x ; + H = h mod 360 ; + S = if s < 0 : 0 elseif s > 1 : 1 else: s fi ; + V = if v < 0 : 0 elseif v > 1 : 1 else: v fi ; + x = 1 - abs(H mod 120 - 60)/60 ; + V * ( (1-S) * (1,1,1) + S * + if H < 60 : (1,x,0) + elseif H < 120 : (x,1,0) + elseif H < 180 : (0,1,x) + elseif H < 240 : (0,x,1) + elseif H < 300 : (x,0,1) + else : (1,0,x) + fi ) +enddef ; + % yes or no: "text" infont "cmr12" at 24pt ; % let normalinfont = infont ; diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex fb8f7e3eb..a1aeca783 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 8fe6401f1..1148bb842 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2016.03.30 11:59} +\newcontextversion{2016.03.31 09:08} %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/mkiv/context-todo.tex b/tex/context/base/mkiv/context-todo.tex index 933b15e6f..86a5f82ce 100644 --- a/tex/context/base/mkiv/context-todo.tex +++ b/tex/context/base/mkiv/context-todo.tex @@ -15,9 +15,6 @@ \startitem optimize some callback resolution (more direct) \stopitem - \startitem - move glue specs into glue nodes - \stopitem \stopitemize \subsubject{\CONTEXT} diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 50f23ec32..10c935822 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2016.03.30 11:59} +\edef\contextversion{2016.03.31 09:08} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua index 15de12867..879a1ffc7 100644 --- a/tex/context/base/mkiv/font-ots.lua +++ b/tex/context/base/mkiv/font-ots.lua @@ -3648,13 +3648,21 @@ local function spaceinitializer(tfmdata,value) -- attr local kerns = coverage[32] if kerns then for k, v in next, kerns do - right[k] = v + if type(v) == "table" then + right[k] = v[3] -- needs checking + else + right[k] = v + end end end for k, v in next, coverage do local kern = v[32] if kern then - left[k] = kern + if type(v) == "table" then + left[k] = kern[3] -- needs checking + else + left[k] = kern + end end end end diff --git a/tex/context/base/mkiv/font-pre.mkiv b/tex/context/base/mkiv/font-pre.mkiv index 584bd1779..3b3a76d9c 100644 --- a/tex/context/base/mkiv/font-pre.mkiv +++ b/tex/context/base/mkiv/font-pre.mkiv @@ -56,13 +56,13 @@ \definefontfeature [inlinenumbers] - [lnum=yes, + [pnum=yes, tnum=no] \definefontfeature [tabularnumbers] [tnum=yes, - lnum=no] + pnum=no] \definefontfeature [oldstylenumbers] diff --git a/tex/context/base/mkiv/grph-inc.mkiv b/tex/context/base/mkiv/grph-inc.mkiv index b7923d16e..deba82c58 100644 --- a/tex/context/base/mkiv/grph-inc.mkiv +++ b/tex/context/base/mkiv/grph-inc.mkiv @@ -782,8 +782,16 @@ % Bonus: \useexternalfigure - [buffer] + [\v!buffer] [\jobname.buffer] [\c!object=\v!no] +% Another one: + +\defineexternalfigure + [\v!inline] + [\c!height=\lineheight] + +\unexpanded\def\inlinefigure[#1]{\dontleavehmode\sbox{\externalfigure[#1][\v!inline]}} + \protect \endinput diff --git a/tex/context/base/mkiv/node-met.lua b/tex/context/base/mkiv/node-met.lua index a2398da90..272b1d176 100644 --- a/tex/context/base/mkiv/node-met.lua +++ b/tex/context/base/mkiv/node-met.lua @@ -116,6 +116,10 @@ nodes.mlist_to_hlist = node.mlist_to_hlist nodes.effective_glue = node.effective_glue +nodes.is_zero_glue = node.is_zero_glue +nodes.getglue = node.getglue +nodes.getglue = node.getglue + -- if not gonuts or not node.getfield then -- node.getfield = metatable.__index -- node.setfield = metatable.__newindex diff --git a/tex/context/base/mkiv/node-nut.lua b/tex/context/base/mkiv/node-nut.lua index 6fe2e0f33..1465a6680 100644 --- a/tex/context/base/mkiv/node-nut.lua +++ b/tex/context/base/mkiv/node-nut.lua @@ -200,29 +200,7 @@ nuts.ligaturing = direct.ligaturing nuts.kerning = direct.kerning nuts.effective_glue = direct.effective_glue --- placeholders - -if not nuts.kerning then - - local n_kerning = node.kerning - - function nuts.kerning(head) - return tonode(n_kerning(tonut(head))) - end - -end - -if not nuts.ligaturing then - - local n_ligaturing = node.ligaturing - - function nuts.ligaturing(head) - return tonode(n_ligaturing(tonut(head))) - end - -end - -if not direct.mlist_to_hlist then +if not direct.mlist_to_hlist then -- needed local n_mlist_to_hlist = node.mlist_to_hlist @@ -232,15 +210,36 @@ if not direct.mlist_to_hlist then end -if not direct.setlist then - - local setfield = nuts.setfield +local is_zero_glue = direct.is_zero_glue +local setglue = direct.setglue +local getglue = direct.getglue + +if not is_zero_glue then + is_zero_glue = function(n) + return not n or ( + getfield(n,"width") == 0 and + getfield(n,"stretch") == 0 and + getfield(n,"shrink") == 0 + ) + end + setglue = function(n,width,stretch,shrink,stretch_order,shrink_order) + setfield(n,"width", width or 0) + setfield(n,"stretch", stretch or 0) + setfield(n,"shrink", shrink or 0) + setfield(n,"stretch_order",stretch_order or 0) + setfield(n,"shrink_order", shrink_order or 0) + end + getglue = function(n) + return + getfield(n,"width"), getfield(n,"stretch"), getfield(n,"shrink"), + getfield(n,"stretch_order"), getfield(n,"shrink_order") + end +end - function direct.setlist (n,l) setfield(n,"list",l) end - function direct.setleader (n,l) setfield(n,"leader",l) end - function direct.setsubtype(n,s) setfield(n,"subtype",s) end +nuts.is_zero_glue = is_zero_glue +nuts.setglue = setglue +nuts.getglue = getglue -end -- if not direct.getpre then -- @@ -252,10 +251,11 @@ end -- -- end -nuts.getdisc = direct.getdisc ----.getpre = direct.getpre ----.getpost = direct.getpost ----.getreplace = direct.getreplace + +nuts.getdisc = direct.getdisc nuts.setdisc = direct.setdisc nuts.setchar = direct.setchar nuts.setnext = direct.setnext @@ -267,45 +267,6 @@ nuts.setlist = direct.setlist nuts.setleader = direct.setleader nuts.setsubtype = direct.setsubtype -if not direct.is_glyph then - - local getchar = direct.getchar - local getid = direct.getid - local getfont = direct.getfont - local getsubtype = direct.getsubtype - - local glyph_code = nodes.nodecodes.glyph - - function direct.is_glyph(n,f) - local id = getid(n) - if id == glyph_code then - if f and getfont(n) == f then - return getchar(n) - else - return false - end - else - return nil, id - end - end - - function direct.is_char(n,f) - local id = getid(n) - if id == glyph_code then - if getsubtype(n) >= 256 then - return false - elseif f and getfont(n) == f then - return getchar(n) - else - return false - end - else - return nil, id - end - end - -end - nuts.is_char = direct.is_char nuts.ischar = direct.is_char nuts.is_glyph = direct.is_glyph diff --git a/tex/context/base/mkiv/node-res.lua b/tex/context/base/mkiv/node-res.lua index b74929a81..d87f40df7 100644 --- a/tex/context/base/mkiv/node-res.lua +++ b/tex/context/base/mkiv/node-res.lua @@ -82,23 +82,6 @@ local free_nut = nuts.free local copy_node = nodes.copy local new_node = nodes.new -local reset_glue = nuts.reset_glue - -if not reset_glue then - reset_glue = function(n,width,stretch,shrink,stretch_order,shrink_order) - setfield(n,"width",width or 0) - setfield(n,"stretch",stretch or 0) - setfield(n,"shrink",shrink or 0) - setfield(n,"stretch_order",stretch_order or 0) - setfield(n,"shrink_order",shrink_order or 0) - end - nuts.reset_glue = reset_glue -end - -nuts.resetglue = reset_glue - --- todo: nodes.reset_glue - -- at some point we could have a dual set (the overhead of tonut is not much larger than -- metatable associations at the lua/c end esp if we also take assignments into account diff --git a/tex/context/base/mkiv/pack-mrl.mkiv b/tex/context/base/mkiv/pack-mrl.mkiv index 39e1f4086..649b29fa6 100644 --- a/tex/context/base/mkiv/pack-mrl.mkiv +++ b/tex/context/base/mkiv/pack-mrl.mkiv @@ -346,26 +346,35 @@ \def\pack_thinrules[#1]% {\bgroup \setupcurrentthinrules[#1]% - \assignvalue{\directthinrulesparameter\c!interlinespace}\m_pack_thinrules_interlinespace{1.0}{1.5}{2.0}% - \spacing\m_pack_thinrules_interlinespace - \edef\p_after {\directthinrulesparameter\c!after}% - \edef\p_inbetween{\directthinrulesparameter\c!inbetween}% - \directthinrulesparameter\c!before \scratchcounter\directthinrulesparameter\c!n\relax - \dorecurse\scratchcounter - {\ifnum\recurselevel=\scratchcounter \directvspacing\v!samepage \else % \penalty500 - \ifnum\recurselevel=\plustwo \directvspacing\v!samepage \fi\fi % \penalty500 - \thinrule - \ifnum\recurselevel<\scratchcounter\relax - % test needed, else messed up whitespace - \ifx\p_inbetween\empty - \softbreak % \ifhmode \hskip \parfillskip \break \fi - \else - \endgraf - \nowhitespace - \p_inbetween - \fi - \fi}% + \ifcase\scratchcounter + % nothing, not even before/after + \let\p_after\relax + \else + \assignvalue{\directthinrulesparameter\c!interlinespace}\m_pack_thinrules_interlinespace{1.0}{1.5}{2.0}% + \spacing\m_pack_thinrules_interlinespace + \edef\p_after {\directthinrulesparameter\c!after}% + \edef\p_inbetween{\directthinrulesparameter\c!inbetween}% + \directthinrulesparameter\c!before + \ifcase\scratchcounter\or + \thinrule + \else + \dorecurse\scratchcounter + {\ifnum\recurselevel=\scratchcounter \directvspacing\v!samepage \else % \penalty500 + \ifnum\recurselevel=\plustwo \directvspacing\v!samepage \fi\fi % \penalty500 + \thinrule + \ifnum\recurselevel<\scratchcounter\relax + % test needed, else messed up whitespace + \ifx\p_inbetween\empty + \softbreak % \ifhmode \hskip \parfillskip \break \fi + \else + \endgraf + \nowhitespace + \p_inbetween + \fi + \fi}% + \fi + \fi \ifx\p_after\empty \carryoverpar\egroup \else diff --git a/tex/context/base/mkiv/spac-prf.lua b/tex/context/base/mkiv/spac-prf.lua index 3bfd89f2e..39d90794c 100644 --- a/tex/context/base/mkiv/spac-prf.lua +++ b/tex/context/base/mkiv/spac-prf.lua @@ -71,7 +71,7 @@ local new_kern = nuts.pool.kern local hpack_nodes = nuts.hpack local link_nodes = nuts.link local find_node_tail = nuts.tail -local reset_glue = nuts.reset_glue +local setglue = nuts.setglue local properties = nodes.properties.data @@ -720,7 +720,7 @@ local function profilelist(line,mvl) if action then local ok = action(top,bot,t_profile,b_profile,specification) if ok and lastglue and distance ~= 0 then - resetglue(lastglue) + setglue(lastglue) end end t_profile.done = true @@ -826,7 +826,7 @@ function profiling.profilebox(specification) if action then local ok = action(top,bot,t_profile,b_profile,specification) if ok and lastglue and distance ~= 0 then - reset_glue(lastglue) + setglue(lastglue) end end t_profile.done = true diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 0af031181..0885f937d 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 11167c0ca..710b5e838 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/typo-krn.lua b/tex/context/base/mkiv/typo-krn.lua index bb9061c56..7607fc5f5 100644 --- a/tex/context/base/mkiv/typo-krn.lua +++ b/tex/context/base/mkiv/typo-krn.lua @@ -50,7 +50,7 @@ local setsubtype = nuts.setsubtype local texsetattribute = tex.setattribute local unsetvalue = attributes.unsetvalue -local resetglue = nuts.resetglue +local setglue = nuts.setglue -- todo local new_kern = nodepool.kern local new_glue = nodepool.glue @@ -554,13 +554,13 @@ function kerns.handler(head) local width = w + gluefactor * w * krn local stretch = getfield(start,"stretch") * width / w local shrink = getfield(start,"shrink") * width / w - setfield(start,"width",width) if fillup then stretch = 2 * stretch shrink = 2 * shrink setfield(start,"stretch_order",1) -- shrink_order ? end + setfield(start,"width",width) setfield(start,"stretch",stretch) setfield(start,"shrink", shrink) -- diff --git a/tex/context/base/mkiv/typo-tal.lua b/tex/context/base/mkiv/typo-tal.lua index f76a69a26..a67cd0a4b 100644 --- a/tex/context/base/mkiv/typo-tal.lua +++ b/tex/context/base/mkiv/typo-tal.lua @@ -54,7 +54,8 @@ local insert_node_after = nuts.insert_after local traverse_list_by_id = nuts.traverse_id local dimensions_of_list = nuts.dimensions local first_glyph = nuts.first_glyph -local reset_glue = nuts.reset_glue + +local setglue = nuts.setglue local nodepool = nuts.pool local new_kern = nodepool.kern @@ -260,7 +261,7 @@ function characteralign.handler(originalhead,where) local prev = getprev(current) if next and prev and getid(next) == glyph_code and getid(prev) == glyph_code then -- too much checking local width = fontcharacters[getfont(b_start)][separator or period].width - reset_glue(current,width) + setglue(current,width) setattr(current,a_character,punctuationspace) if a_start then a_stop = current diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index c1d06ea0e..f354a246f 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 : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 03/30/16 11:59:12 +-- merge date : 03/31/16 09:08:01 do -- begin closure to overcome local limits and interference @@ -20938,13 +20938,21 @@ local function spaceinitializer(tfmdata,value) local kerns=coverage[32] if kerns then for k,v in next,kerns do - right[k]=v + if type(v)=="table" then + right[k]=v[3] + else + right[k]=v + end end end for k,v in next,coverage do local kern=v[32] if kern then - left[k]=kern + if type(v)=="table" then + left[k]=kern[3] + else + left[k]=kern + end end end end |