diff options
Diffstat (limited to 'tex/context/base/mkxl')
-rw-r--r-- | tex/context/base/mkxl/cont-new.mkxl | 2 | ||||
-rw-r--r-- | tex/context/base/mkxl/context.mkxl | 2 | ||||
-rw-r--r-- | tex/context/base/mkxl/driv-shp.lmt | 1 | ||||
-rw-r--r-- | tex/context/base/mkxl/font-dsp.lmt | 31 | ||||
-rw-r--r-- | tex/context/base/mkxl/lpdf-img.lmt | 2 | ||||
-rw-r--r-- | tex/context/base/mkxl/math-ini.mkxl | 22 | ||||
-rw-r--r-- | tex/context/base/mkxl/mlib-fnt.lmt | 120 | ||||
-rw-r--r-- | tex/context/base/mkxl/mlib-lmp.lmt | 17 | ||||
-rw-r--r-- | tex/context/base/mkxl/mlib-pps.lmt | 28 | ||||
-rw-r--r-- | tex/context/base/mkxl/pack-lyr.mkxl | 2 | ||||
-rw-r--r-- | tex/context/base/mkxl/spac-ver.mkxl | 9 | ||||
-rw-r--r-- | tex/context/base/mkxl/strc-flt.mklx | 4 | ||||
-rw-r--r-- | tex/context/base/mkxl/typo-shp.mkxl | 5 |
13 files changed, 163 insertions, 82 deletions
diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index a35ab8489..1a0c93600 100644 --- a/tex/context/base/mkxl/cont-new.mkxl +++ b/tex/context/base/mkxl/cont-new.mkxl @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2022.12.29 14:29} +\newcontextversion{2023.01.04 11:32} %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/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl index 152850f03..af85d279a 100644 --- a/tex/context/base/mkxl/context.mkxl +++ b/tex/context/base/mkxl/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \immutable\edef\contextformat {\jobname} -\immutable\edef\contextversion{2022.12.29 14:29} +\immutable\edef\contextversion{2023.01.04 11:32} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/driv-shp.lmt b/tex/context/base/mkxl/driv-shp.lmt index 9a37ccf8a..7bc2f54c5 100644 --- a/tex/context/base/mkxl/driv-shp.lmt +++ b/tex/context/base/mkxl/driv-shp.lmt @@ -240,6 +240,7 @@ local flush_character do csy = sy end -- here no current! + -- return flushcharacter(false,pos_h,pos_v,pos_r,fnt,chr,nil,csx,csy,factor,sx,sy) return flush_character(false,fnt,chr,factor,nest,pos_h,pos_v,pos_r,csx,csy) else return 0 diff --git a/tex/context/base/mkxl/font-dsp.lmt b/tex/context/base/mkxl/font-dsp.lmt index 0cb05786b..1b54bf463 100644 --- a/tex/context/base/mkxl/font-dsp.lmt +++ b/tex/context/base/mkxl/font-dsp.lmt @@ -1186,25 +1186,30 @@ local function chainedcontext(f,fontdata,lookupid,lookupoffset,offset,glyphs,nof rules = rules, } elseif subtype == 3 then + -- Maybe this one needs checking. Anyway zero current is bad. local before = readarray(f) local current = readarray(f) local after = readarray(f) local noflookups = readushort(f) - local lookups = readlookuparray(f,noflookups,#current) - before = readcoveragearray(f,tableoffset,before,true) - current = readcoveragearray(f,tableoffset,current,true) - after = readcoveragearray(f,tableoffset,after,true) - return { - format = "coverage", - rules = { - { - before = before, - current = current, - after = after, - lookups = lookups, + local lookups = current and readlookuparray(f,noflookups,#current) + if lookups then + before = readcoveragearray(f,tableoffset,before,true) + current = readcoveragearray(f,tableoffset,current,true) + after = readcoveragearray(f,tableoffset,after,true) + return { + format = "coverage", + rules = { + { + before = before, + current = current, + after = after, + lookups = lookups, + } } } - } + else + report("confusing subtype %a in %a %s",subtype,"chainedcontext",what) + end else report("unsupported subtype %a in %a %s",subtype,"chainedcontext",what) end diff --git a/tex/context/base/mkxl/lpdf-img.lmt b/tex/context/base/mkxl/lpdf-img.lmt index df658c236..c241ccdb7 100644 --- a/tex/context/base/mkxl/lpdf-img.lmt +++ b/tex/context/base/mkxl/lpdf-img.lmt @@ -1181,6 +1181,7 @@ do Filter = filter, ColorSpace = palette or pdfconstant(colorspace), Length = #content, +-- Decode = pdfarray { 0, .5, 0, .5, 0, .5 } -- darker (test for luatex list) } + specification.attr if mask then local d = pdfdictionary { @@ -1190,6 +1191,7 @@ do Height = ysize, BitsPerComponent = palette and 8 or colordepth, ColorSpace = pdfconstant("DeviceGray"), +-- Decode = pdfarray { 0, .5, 0, .5, 0, .5 }, -- lighter (test for luatex list) } xobject.SMask = pdfreference(pdfflushstreamobject(mask,d())) end diff --git a/tex/context/base/mkxl/math-ini.mkxl b/tex/context/base/mkxl/math-ini.mkxl index 8880956af..b007a64d1 100644 --- a/tex/context/base/mkxl/math-ini.mkxl +++ b/tex/context/base/mkxl/math-ini.mkxl @@ -1234,28 +1234,28 @@ % \inherited\setmathspacing \mathclosecode \mathradicalcode \allmathstyles \zeromuskip % \inherited\setmathspacing \mathpunctuationcode \mathordinarycode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathordinarycode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathordinarycode \allunsplitstyles \tinymuskip \inherited\setmathspacing \mathpunctuationcode \mathoperatorcode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathoperatorcode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathoperatorcode \allunsplitstyles \tinymuskip % \inherited\setmathspacing \mathpunctuationcode \mathbinarycode \allmathstyles \zeromuskip \inherited\setmathspacing \mathpunctuationcode \mathrelationcode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathrelationcode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathrelationcode \allunsplitstyles \tinymuskip \inherited\setmathspacing \mathpunctuationcode \mathopencode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathopencode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathopencode \allunsplitstyles \tinymuskip \inherited\setmathspacing \mathpunctuationcode \mathmiddlecode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathpunctuationcode \mathmiddlecode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathmiddlecode \allunsplitstyles \tinymuskip \inherited\setmathspacing \mathpunctuationcode \mathclosecode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathclosecode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathclosecode \allunsplitstyles \tinymuskip \inherited\setmathspacing \mathpunctuationcode \mathpunctuationcode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathpunctuationcode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathpunctuationcode \allunsplitstyles \tinymuskip \inherited\setmathspacing \mathpunctuationcode \mathconstructcode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathconstructcode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathconstructcode \allunsplitstyles \tinymuskip \inherited\setmathspacing \mathpunctuationcode \mathellipsiscode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathellipsiscode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathellipsiscode \allunsplitstyles \tinymuskip \inherited\setmathspacing \mathpunctuationcode \mathfractioncode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathfractioncode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathfractioncode \allunsplitstyles \tinymuskip \inherited\setmathspacing \mathpunctuationcode \mathradicalcode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathradicalcode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathradicalcode \allunsplitstyles \tinymuskip % \inherited\setmathspacing \mathconstructcode \mathordinarycode \allsplitstyles \thinmuskip \inherited\setmathspacing \mathconstructcode \mathordinarycode \allunsplitstyles \pettymuskip diff --git a/tex/context/base/mkxl/mlib-fnt.lmt b/tex/context/base/mkxl/mlib-fnt.lmt index e53ded38a..3209b2ee6 100644 --- a/tex/context/base/mkxl/mlib-fnt.lmt +++ b/tex/context/base/mkxl/mlib-fnt.lmt @@ -260,41 +260,44 @@ end -- right time. It's probably why I like watching https://www.youtube.com/watch?v=c5FqpddnJmc -- so much: precisely (and perfectly) timed too. -local texgetbox = tex.getbox +local texgetbox = tex.getbox -local nodecodes = nodes.nodecodes -- no nuts yet -local rulecodes = nodes.rulecodes +local nodecodes = nodes.nodecodes -- no nuts yet +local rulecodes = nodes.rulecodes -local rule_code = nodecodes.rule +local rule_code = nodecodes.rule -local normalrule_code = rulecodes.normal -local outlinerule_code = rulecodes.outline -local userrule_code = rulecodes.user -local emptyrule_code = rulecodes.empty +local normalrule_code = rulecodes.normal +local outlinerule_code = rulecodes.outline +local userrule_code = rulecodes.user +local emptyrule_code = rulecodes.empty -local nuts = nodes.nuts -local getwhd = nuts.getwhd -local getexpansion = nuts.getexpansion -local getscales = nuts.getscales -local isglyph = nuts.isglyph +local nuts = nodes.nuts +----- getwhd = nuts.getwhd +local getexpansion = nuts.getexpansion +local getscales = nuts.getscales +local isglyph = nuts.isglyph +local getglyphdimensions = nuts.getglyphdimensions -local fonthashes = fonts.hashes -local fontcharacters = fonthashes.characters -local fontparameters = fonthashes.parameters -local fontshapes = fonthashes.shapes -local fontdescriptions = fonthashes.descriptions +local fonthashes = fonts.hashes +local fontcharacters = fonthashes.characters +local fontparameters = fonthashes.parameters +local fontshapes = fonthashes.shapes +local fontdescriptions = fonthashes.descriptions -local topaths = metapost.paths +local topaths = metapost.paths -local f_text = formatters["mfun_do_outline_text_flush(%q,%i,%N,%N,%q)(%,t);"] -local f_rule = formatters["mfun_do_outline_rule_flush(%q,%N,%N,%N,%N);"] -local f_bounds = formatters["checkbounds(%N,%N,%N,%N);"] -local s_nothing = "(origin scaled 10)" +local f_text = formatters["mfun_do_outline_text_flush(%q,%i,%N,%N,%q)(%,t);"] +local f_rule = formatters["mfun_do_outline_rule_flush(%q,%N,%N,%N,%N);"] +local f_bounds = formatters["checkbounds(%N,%N,%N,%N);"] +local s_nothing = "(origin scaled 10)" -local sc = 10 -local fc = number.dimenfactors.bp +local sc = 10 +local fc = number.dimenfactors.bp -local function glyph(kind,font,char,advance,shift,ex,s, sx,sy) +-- handle compact mode here: + +local function glyph(kind,font,char,advance,shift,ex,s,sx,sy) local character = fontcharacters[font][char] if character then local index = character.index @@ -312,10 +315,20 @@ local function glyph(kind,font,char,advance,shift,ex,s, sx,sy) local exfactor = ex or 0 local wfactor = 1 local detail = kind == "p" and tostring(char) or "" + -- what about other effects + local xoffset = character.xoffset or 0 + local yoffset = character.yoffset or 0 -- todo + -- if exfactor ~= 0 then wfactor = (1+(ex/units)/1000) xfactor = xfactor * wfactor end + if xoffset ~= 0 then + advance = advance + s * sx * xoffset * fc / 1000000 + end + if yoffset ~= 0 then + shift = shift + s * sy * yoffset * fc / 1000000 + end if s then xfactor = (s/1000) * ((sx or 1000)/1000) * xfactor yfactor = (s/1000) * ((sy or 1000)/1000) * yfactor @@ -342,16 +355,57 @@ local function reset() end local function flushcharacter(current, pos_h, pos_v, pod_r, font, char) - local char, font = isglyph(current) - local s, sx, sy = getscales(current) - local code = glyph(kind,font,char,pos_h*fc,pos_v*fc,getexpansion(current),s,sx,sy) - if code then - b = b + 1 - buffer[b] = code + if current then + local char, font = isglyph(current) + local s, sx, sy = getscales(current) + local code = glyph(kind,font,char,pos_h*fc,pos_v*fc,getexpansion(current),s,sx,sy) + if code then + b = b + 1 + buffer[b] = code + end + else + logs.report("mlib-fnt","check 'flushcharacter', no current") end end -local function flushrule(current, pos_h, pos_v, pos_r, size_h, size_v, subtype) +-- Messy ... todo: + +-- local function flushcharacter(current,pos_h,pos_v,pos_r,font,char,data,csx,csy,factor,ssx,ssy) +-- local width, height, depth, sx, sy +-- if current then +-- char, font = isglyph(current) +-- width, height, depth, factor, sx, sy = getglyphdimensions(current) +-- else +-- if not data then +-- data = fontcharacters[font][char] or { } +-- end +-- width = data.width or 0 +-- height = data.height or 0 +-- depth = data.depth or 0 +-- sx = 1 +-- sy = 1 +-- end +-- if csx then +-- sx = sx * csx +-- end +-- if csy then +-- sy = sy * csy +-- end +-- if ssx then +-- sx = sx * ssx +-- end +-- if ssy then +-- sy = sy * ssy +-- end +-- local code = glyph(kind,font,char,pos_h*fc,pos_v*fc,factor,s,sx,sy) +-- if code then +-- b = b + 1 +-- buffer[b] = code +-- end +-- return width, height, depth +-- end + +local function flushrule(current,pos_h,pos_v,pos_r,size_h,size_v,subtype) if subtype == normalrule_code then b = b + 1 buffer[b] = f_rule(kind,pos_h*fc,pos_v*fc,size_h*fc,size_v*fc) diff --git a/tex/context/base/mkxl/mlib-lmp.lmt b/tex/context/base/mkxl/mlib-lmp.lmt index a6d17dd2c..db23fcede 100644 --- a/tex/context/base/mkxl/mlib-lmp.lmt +++ b/tex/context/base/mkxl/mlib-lmp.lmt @@ -216,14 +216,19 @@ do end end) - -- + -- older: - local mpprint = mp.print - local mpquoted = mp.quoted - local getmacro = tokens.getters.macro + registerscript("texvar", function() + if not expandtex(unknown_value,"mpcategoryparameter",true,scanstring()) then + injectnumeric(0) + end + end) - registerscript("texvar", function() mpprint (getmacro(metapost.namespace .. scanstring())) end) - registerscript("texstr", function() mpquoted(getmacro(metapost.namespace .. scanstring())) end) + registerscript("texstr", function() + if not expandtex(string_value,"mpcategoryparameter",true,scanstring()) then + injectstring("") + end + end) end diff --git a/tex/context/base/mkxl/mlib-pps.lmt b/tex/context/base/mkxl/mlib-pps.lmt index fbb507a3f..209656fbe 100644 --- a/tex/context/base/mkxl/mlib-pps.lmt +++ b/tex/context/base/mkxl/mlib-pps.lmt @@ -1362,16 +1362,24 @@ end local function ps_process(object,prescript,before,after) local ps_label = prescript.ps_label if ps_label then - local op = object.path - local first = op[1] - local third = op[3] - local x = first.x_coord - local y = first.y_coord - local w = third.x_coord - x - local h = third.y_coord - y - local properties = metapost.properties - x = x - properties.llx - y = properties.ury - y + local op = object.path + local first = op[1] + local third = op[3] + local x, y, w, h + if first and third then + local properties = metapost.properties + x = first.x_coord + y = first.y_coord + w = third.x_coord - x + h = third.y_coord - y + x = x - properties.llx + y = properties.ury - y + else + x = 0 + y = 0 + w = 0 + h = 0 + end before[#before+1] = function() context.MPLIBpositionwhd(ps_label,x,y,w,h) end diff --git a/tex/context/base/mkxl/pack-lyr.mkxl b/tex/context/base/mkxl/pack-lyr.mkxl index a3dd301c2..b93d32960 100644 --- a/tex/context/base/mkxl/pack-lyr.mkxl +++ b/tex/context/base/mkxl/pack-lyr.mkxl @@ -661,7 +661,7 @@ % \pack_layers_bottom_fill}% % \edef\currentlayer{#2}% :\the\realpageno}% local .. check \anchor - % \edef\p_pack_layers_position{\layerparameter\c!position}% local + \edef\p_pack_layers_position{\layerparameter\c!position}% local \ifx\p_pack_layers_position\v!yes \edef\p_pack_layers_region{\layerparameter\c!region}% \ifempty\p_pack_layers_region\else diff --git a/tex/context/base/mkxl/spac-ver.mkxl b/tex/context/base/mkxl/spac-ver.mkxl index 2b16e42ee..89632bd84 100644 --- a/tex/context/base/mkxl/spac-ver.mkxl +++ b/tex/context/base/mkxl/spac-ver.mkxl @@ -2420,20 +2420,23 @@ \tolerant\protected\def\spac_textdisplay_start#1#:[#2]% {\par \begingroup + \whitespace + \forgetall \edef\currenttextdisplay{#1}% \setupcurrenttextdisplay[#2]% \textdisplayparameter\c!before - \dbox + \dpack \bgroup \strut \vskip-\lineheight - \vbox + \vpack \s!yoffset -\textdisplayparameter\c!factor\strutdp \bgroup} \protected\def\spac_textdisplay_stop {\egroup - \vskip-\lineheight\strut + \vskip-\lineheight + \strut \egroup \textdisplayparameter\c!after \endgroup diff --git a/tex/context/base/mkxl/strc-flt.mklx b/tex/context/base/mkxl/strc-flt.mklx index 40c627b2c..1f2aeaae5 100644 --- a/tex/context/base/mkxl/strc-flt.mklx +++ b/tex/context/base/mkxl/strc-flt.mklx @@ -679,8 +679,12 @@ %D We abuse the settings to pick up some float parameters too which makes it %D messy. +%D Do we need a \setuplayout here (kind of costly) in case we mix multi page text +%D with a side float and less height. + \permanent\tolerant\protected\def\startplacefloat[#tag]#spacer[#settings]#spacer[#userdata]% {\flushnotes + %\setuplayout \page_otr_command_flush_side_floats % here ! \strc_floats_begin_group \strc_floats_set_current_tag{#tag}% diff --git a/tex/context/base/mkxl/typo-shp.mkxl b/tex/context/base/mkxl/typo-shp.mkxl index e6bc143c1..12d3c0115 100644 --- a/tex/context/base/mkxl/typo-shp.mkxl +++ b/tex/context/base/mkxl/typo-shp.mkxl @@ -190,7 +190,7 @@ \dontcomplain \setuptolerance[\v!verytolerant,\v!stretch]% default % \setuplayout[\c!grid=\v!yes]% goes wrong, we need a local one - \pushparagraphtweak {shift}} + \pushparagraphtweak{shift}} \permanent\protected\def\stopshapetext {\popparagraphtweak @@ -223,7 +223,7 @@ % \fi % \egroup} -\pushoverloadmode\permanent\protected\def\getshapetext +\permanent\protected\def\getshapetext {\vbox\bgroup \forgetall \dontcomplain @@ -251,5 +251,4 @@ \fi \egroup} - \protect |