diff options
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/mkii/cont-new.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/mkii/context.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/font-imp-effects.lua | 8 | ||||
-rw-r--r-- | tex/context/base/mkiv/mult-prm.lua | 3 | ||||
-rw-r--r-- | tex/context/base/mkiv/status-files.pdf | bin | 26083 -> 26109 bytes | |||
-rw-r--r-- | tex/context/base/mkiv/status-lua.pdf | bin | 253562 -> 253687 bytes | |||
-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 | 60 | ||||
-rw-r--r-- | tex/context/base/mkxl/font-ini.mklx | 20 | ||||
-rw-r--r-- | tex/context/base/mkxl/font-otj.lmt | 134 | ||||
-rw-r--r-- | tex/context/base/mkxl/font-ots.lmt | 240 | ||||
-rw-r--r-- | tex/context/base/mkxl/lpdf-lmt.lmt | 61 | ||||
-rw-r--r-- | tex/context/base/mkxl/meta-ini.mkxl | 2 | ||||
-rw-r--r-- | tex/context/base/mkxl/node-nut.lmt | 7 | ||||
-rw-r--r-- | tex/context/base/mkxl/strc-des.mklx | 20 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 6 |
19 files changed, 270 insertions, 303 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 15c0a415a..4d3bf955f 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2020.12.22 22:09} +\newcontextversion{2020.12.24 12:12} %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/mkii/context.mkii b/tex/context/base/mkii/context.mkii index ea2ab00dc..24750486c 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2020.12.22 22:09} +\edef\contextversion{2020.12.24 12:12} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 0de515f2f..4d2e5f928 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2020.12.22 22:09} +\newcontextversion{2020.12.24 12:12} %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/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index f0a1b127c..146c1276d 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2020.12.22 22:09} +\edef\contextversion{2020.12.24 12:12} %D Kind of special: diff --git a/tex/context/base/mkiv/font-imp-effects.lua b/tex/context/base/mkiv/font-imp-effects.lua index ee9f644a9..cf338ae49 100644 --- a/tex/context/base/mkiv/font-imp-effects.lua +++ b/tex/context/base/mkiv/font-imp-effects.lua @@ -215,7 +215,9 @@ local rules = { -- end -- end -local function setmathparameters(tfmdata,characters,mathparameters,dx,dy,squeeze) +-- radicals are not yet ok + +local function setmathparameters(tfmdata,characters,mathparameters,dx,dy,squeeze,multiplier) if delta ~= 0 then for i=1,#rules do local name = rules[i] @@ -229,6 +231,8 @@ end local function setmathcharacters(tfmdata,characters,mathparameters,dx,dy,squeeze,wdelta,hdelta,ddelta) + -- still not the perfect rule + local function wdpatch(char) if wsnap ~= 0 then char.width = char.width + wdelta/2 @@ -358,7 +362,7 @@ local function manipulateeffect(tfmdata) end end if mathparameters then - setmathparameters(tfmdata,characters,mathparameters,dx,dy,squeeze) + setmathparameters(tfmdata,characters,mathparameters,dx,dy,squeeze,multiplier) setmathcharacters(tfmdata,characters,mathparameters,dx,dy,squeeze,wdelta,hdelta,ddelta) end parameters.factor = factor diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua index e2b12f05c..7014000dd 100644 --- a/tex/context/base/mkiv/mult-prm.lua +++ b/tex/context/base/mkiv/mult-prm.lua @@ -299,9 +299,10 @@ return { "glyphdatafield", "glyphdimensionsmode", "glyphoptions", - "glyphscale", "glyphscriptfield", "glyphstatefield", + "glyphxscale", + "glyphyscale", "gtoksapp", "gtokspre", "hjcode", diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex f6badb99a..2b8fe901e 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 f277ec894..f6049db80 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 354f089c1..ceb357fad 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{2020.12.22 22:09} +\newcontextversion{2020.12.24 12:12} %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 b59d6982c..fe891d156 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{2020.12.22 22:09} +\immutable\edef\contextversion{2020.12.24 12:12} %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 124f95bb3..dcdbd3f62 100644 --- a/tex/context/base/mkxl/driv-shp.lmt +++ b/tex/context/base/mkxl/driv-shp.lmt @@ -122,28 +122,28 @@ local report = logs.reporter("drivers") --------------------------------------------------------------------------------------- -local lastfont = nil -local fontcharacters = nil +local lastfont = nil +local fontcharacters = nil -local magicconstants = tex.magicconstants -local trueinch = magicconstants.trueinch -local maxdimen = magicconstants.maxdimen -local running = magicconstants.running +local magicconstants = tex.magicconstants +local trueinch = magicconstants.trueinch +local maxdimen = magicconstants.maxdimen +local running = magicconstants.running -local pos_h = 0 -local pos_v = 0 -local pos_r = lefttoright_code -local shippingmode = "none" +local pos_h = 0 +local pos_v = 0 +local pos_r = lefttoright_code +local shippingmode = "none" -local abs_max_v = 0 -local abs_max_h = 0 +local abs_max_v = 0 +local abs_max_h = 0 -local shipbox_h = 0 -local shipbox_v = 0 -local page_size_h = 0 -local page_size_v = 0 ------ page_h_origin = 0 -- trueinch ------ page_v_origin = 0 -- trueinch +local shipbox_h = 0 +local shipbox_v = 0 +local page_size_h = 0 +local page_size_v = 0 +----- page_h_origin = 0 -- trueinch +----- page_v_origin = 0 -- trueinch local initialize local finalize @@ -192,7 +192,7 @@ updaters.register("backend.update",function() stopcolor = fonts.vfcommands.stopcolor end) -local function flush_vf_packet(current,pos_h,pos_v,pos_r,font,char,data,factor,vfcommands) +local function flush_vf_packet(current,pos_h,pos_v,pos_r,font,char,data,factor,vfcommands,sx,sy) if nesting > 100 then return @@ -287,9 +287,11 @@ local function flush_vf_packet(current,pos_h,pos_v,pos_r,font,char,data,factor,v if factor ~= 0 and h ~= 0 then h = h + h * factor / 1000 -- expansion end +h = h * sx pos_h = pos_h + h elseif command == "down" then local v = packet[2] -- already scaled +v = v * sy pos_v = pos_v - v elseif command == "push" then level = level + 1 @@ -314,6 +316,8 @@ local function flush_vf_packet(current,pos_h,pos_v,pos_r,font,char,data,factor,v size_h = size_h + size_h * factor / 1000 end if size_h > 0 then +size_h = size_h * sx +size_v = size_v * sy flushsimplerule(pos_h,pos_v,pos_r,size_h,size_v) pos_h = pos_h + size_h end @@ -338,6 +342,9 @@ local function flush_vf_packet(current,pos_h,pos_v,pos_r,font,char,data,factor,v if color then startcolor(color) end +width = width * sx +height = height * sy +depth = depth * sy flushspecialrule(pos_h,pos_v,pos_r,width,height,depth,line,outline,baseline) if color then stopcolor() @@ -362,7 +369,7 @@ local function flush_vf_packet(current,pos_h,pos_v,pos_r,font,char,data,factor,v kind = type(code) end if kind == "function" then - code(font,char,pos_h,pos_v) + code(font,char,pos_h,pos_v,sx,sy) end elseif command == "node" then local h = packet[2] @@ -392,6 +399,8 @@ end local onetimemessage -- could be defined later (todo: make plug for this) +local getxyscales = nuts.getxyscales + flush_character = function(current,font,char,factor,vfcommands,pos_h,pos_v,pos_r,f,e) if font ~= lastfont then @@ -413,9 +422,10 @@ flush_character = function(current,font,char,factor,vfcommands,pos_h,pos_v,pos_r if vfcommands then vfcommands = data.commands end - local width, height, depth, naturalwidth + local width, height, depth, naturalwidth, sx, sy if current then naturalwidth, height, depth, factor = getwhd(current,true) -- also get corrected width + sx, sy = getxyscales(current) -- maybe: getwhdfs if factor == 0 then width = naturalwidth else @@ -431,12 +441,14 @@ flush_character = function(current,font,char,factor,vfcommands,pos_h,pos_v,pos_r if not factor then factor = 0 end + sx = 1 + sy = 1 end if pos_r == righttoleft_code then pos_h = pos_h - width -- here ? end if vfcommands then - flush_vf_packet(current,pos_h,pos_v,pos_r,font,char,data,factor,vfcommands) -- also f ? + flush_vf_packet(current,pos_h,pos_v,pos_r,font,char,data,factor,vfcommands,sx,sy) -- also f ? else -- kind of messy that we do orientation here and offsets elsewhere local orientation = data.orientation @@ -450,10 +462,10 @@ flush_character = function(current,font,char,factor,vfcommands,pos_h,pos_v,pos_r pos_v = pos_v + y end pushorientation(orientation,pos_h,pos_v) - flushcharacter(current,pos_h,pos_v,pos_r,font,char,data,f,e,factor) -- ,naturalwidth,width) + flushcharacter(current,pos_h,pos_v,pos_r,font,char,data,f,e,factor,sx,sy) -- ,naturalwidth,width) poporientation(orientation,pos_h,pos_v) else - flushcharacter(current,pos_h,pos_v,pos_r,font,char,data,f,e,factor) -- ,naturalwidth,width) + flushcharacter(current,pos_h,pos_v,pos_r,font,char,data,f,e,factor,sx,sy) -- ,naturalwidth,width) end end return width, height, depth diff --git a/tex/context/base/mkxl/font-ini.mklx b/tex/context/base/mkxl/font-ini.mklx index 59dea4024..af4674a6c 100644 --- a/tex/context/base/mkxl/font-ini.mklx +++ b/tex/context/base/mkxl/font-ini.mklx @@ -2515,16 +2515,30 @@ %D Experiment: \installcorenamespace{scaledfont} +\installcorenamespace{scaledfontxscale} +\installcorenamespace{scaledfontyscale} \installcommandhandler \??scaledfont {scaledfont} \??scaledfont \appendtoks - \frozen\protected\edefcsname\currentscaledfont\endcsname - {\glyphscale\scaledfontparameter\c!scale\relax + \ifempty\currentscaledfont\else + \expandafter\integerdef\csname\??scaledfontxscale\currentscaledfont\endcsname\scaledfontparameter\c!xscale\relax + \expandafter\integerdef\csname\??scaledfontyscale\currentscaledfont\endcsname\scaledfontparameter\c!yscale\relax + \fi +\to \everysetupscaledfont + +\appendtoks + \expandafter\integerdef\csname\??scaledfontxscale\currentscaledfont\endcsname\scaledfontparameter\c!xscale\relax + \expandafter\integerdef\csname\??scaledfontyscale\currentscaledfont\endcsname\scaledfontparameter\c!yscale\relax + \overloaded\frozen\protected\edefcsname\currentscaledfont\endcsname + {\glyphxscale\csname\??scaledfontxscale\currentscaledfont\endcsname + \glyphyscale\csname\??scaledfontyscale\currentscaledfont\endcsname \begincsname\scaledfontparameter\c!style\endcsname} \to \everydefinescaledfont \setupscaledfont - [\c!scale=1000] + [\c!scale=\plusthousand, + \c!xscale=\scaledfontparameter\c!scale, + \c!yscale=\scaledfontparameter\c!scale] \protect \endinput diff --git a/tex/context/base/mkxl/font-otj.lmt b/tex/context/base/mkxl/font-otj.lmt index 77e6707f3..d408babeb 100644 --- a/tex/context/base/mkxl/font-otj.lmt +++ b/tex/context/base/mkxl/font-otj.lmt @@ -87,23 +87,20 @@ local getid = nuts.getid local getfont = nuts.getfont local getchar = nuts.getchar local getoffsets = nuts.getoffsets -local getscale = nuts.getscale +local getxscale = nuts.getxscale +local getyscale = nuts.getyscale local getboth = nuts.getboth local getdisc = nuts.getdisc local setdisc = nuts.setdisc local setoffsets = nuts.setoffsets local ischar = nuts.ischar local isnextchar = nuts.isnextchar -local isnextglyph = nuts.isnextglyph ------ isprevchar = nuts.isprevchar local getkern = nuts.getkern local setkern = nuts.setkern local setlink = nuts.setlink local setwidth = nuts.setwidth local getwidth = nuts.getwidth ------ traverse_id = nuts.traverse_id ------ traverse_char = nuts.traverse_char local nextchar = nuts.traversers.char local nextglue = nuts.traversers.glue @@ -615,10 +612,6 @@ end -- D-post +D-post -- +D-replace +D-replace -local gs = getscale - -local function getscale(font) local s = gs(font) if s == 0 then return 1 else return s/1000 end end - local function inject_kerns_only(head,where) if trace_injections then trace(head,"kerns") @@ -635,10 +628,7 @@ local function inject_kerns_only(head,where) local posttail = nil -- saves a lookup local replacetail = nil -- saves a lookup while current do - -- local next = getnext(current) - -- local char, id = ischar(current) - -- local next, char, id = isnextchar(current) - local next, char, id = isnextglyph(current) + local next, char, id = isnextchar(current) if char then local p = rawget(properties,current) if p then @@ -647,7 +637,7 @@ local function inject_kerns_only(head,where) -- left|glyph|right local leftkern = i.leftkern if leftkern and leftkern ~= 0 then -leftkern = leftkern * getscale(current) +leftkern = leftkern * getxscale(current) if prev and getid(prev) == glue_code then if useitalickerns then head = insert_node_before(head,current,italickern(leftkern)) @@ -666,7 +656,7 @@ leftkern = leftkern * getscale(current) if i then local leftkern = i.leftkern if leftkern and leftkern ~= 0 then -leftkern = leftkern * getscale(current) +leftkern = leftkern * getxscale(current) setlink(posttail,fontkern(leftkern)) done = true end @@ -677,7 +667,7 @@ leftkern = leftkern * getscale(current) if i then local leftkern = i.leftkern if leftkern and leftkern ~= 0 then -leftkern = leftkern * getscale(current) +leftkern = leftkern * getxscale(current) setlink(replacetail,fontkern(leftkern)) done = true end @@ -688,7 +678,7 @@ leftkern = leftkern * getscale(current) -- glyph|disc|glyph (special case) local leftkern = i.leftkern if leftkern and leftkern ~= 0 then -leftkern = leftkern * getscale(current) +leftkern = leftkern * getxscale(current) replace = fontkern(leftkern) done = true end @@ -717,7 +707,7 @@ leftkern = leftkern * getscale(current) if i then local leftkern = i.leftkern if leftkern and leftkern ~= 0 then -leftkern = leftkern * getscale(n) +leftkern = leftkern * getxscale(n) pre = insert_node_before(pre,n,fontkern(leftkern)) done = true end @@ -734,7 +724,7 @@ leftkern = leftkern * getscale(n) if i then local leftkern = i.leftkern if leftkern and leftkern ~= 0 then -leftkern = leftkern * getscale(n) +leftkern = leftkern * getxscale(n) post = insert_node_before(post,n,fontkern(leftkern)) done = true end @@ -751,7 +741,7 @@ leftkern = leftkern * getscale(n) if i then local leftkern = i.leftkern if leftkern and leftkern ~= 0 then -leftkern = leftkern * getscale(n) +leftkern = leftkern * getxscale(n) replace = insert_node_before(replace,n,fontkern(leftkern)) done = true end @@ -799,10 +789,7 @@ local function inject_positions_only(head,where) local posttail = nil -- saves a lookup local replacetail = nil -- saves a lookup while current do - -- local next = getnext(current) - -- local char, id = ischar(current) - -- local next, char, id = isnextchar(current) - local next, char, id = isnextglyph(current) + local next, char, id = isnextchar(current) if char then local p = rawget(properties,current) if p then @@ -811,13 +798,13 @@ local function inject_positions_only(head,where) -- left|glyph|right local yoffset = i.yoffset if yoffset and yoffset ~= 0 then -yoffset = yoffset * getscale(current) +yoffset = yoffset * getxscale(current) setoffsets(current,false,yoffset) end local leftkern = i.leftkern local rightkern = i.rightkern if leftkern and leftkern ~= 0 then -leftkern = leftkern * getscale(current) +leftkern = leftkern * getxscale(current) if rightkern and leftkern == -rightkern then setoffsets(current,leftkern,false) rightkern = 0 @@ -832,7 +819,7 @@ leftkern = leftkern * getscale(current) end end if rightkern and rightkern ~= 0 then -rightkern = rightkern * getscale(current) +rightkern = rightkern * getxscale(current) if next and getid(next) == glue_code then if useitalickerns then insert_node_after(head,current,italickern(rightkern)) @@ -854,7 +841,7 @@ rightkern = rightkern * getscale(current) -- error, we expect an empty one else -- KE setfield(next,"replace",fontkern(rightkern)) -- maybe also leftkern -rightkern = rightkern * getscale(current) +rightkern = rightkern * getxscale(current) replace = fontkern(rightkern) -- maybe also leftkern done = true --KE end @@ -869,7 +856,7 @@ rightkern = rightkern * getscale(current) if i then local leftkern = i.leftkern if leftkern and leftkern ~= 0 then -leftkern = leftkern * getscale(current) +leftkern = leftkern * getxscale(current) setlink(posttail,fontkern(leftkern)) done = true end @@ -880,7 +867,7 @@ leftkern = leftkern * getscale(current) if i then local leftkern = i.leftkern if leftkern and leftkern ~= 0 then -leftkern = leftkern * getscale(current) +leftkern = leftkern * getxscale(current) setlink(replacetail,fontkern(leftkern)) done = true end @@ -891,7 +878,7 @@ leftkern = leftkern * getscale(current) -- new .. okay? local leftkern = i.leftkern if leftkern and leftkern ~= 0 then -leftkern = leftkern * getscale(current) +leftkern = leftkern * getxscale(current) replace = fontkern(leftkern) done = true end @@ -919,18 +906,18 @@ leftkern = leftkern * getscale(current) if i then local yoffset = i.yoffset if yoffset and yoffset ~= 0 then -yoffset = yoffset * getscale(current) +yoffset = yoffset * getyscale(current) setoffsets(n,false,yoffset) end local leftkern = i.leftkern if leftkern and leftkern ~= 0 then -leftkern = leftkern * getscale(n) +leftkern = leftkern * getxscale(n) pre = insert_node_before(pre,n,fontkern(leftkern)) done = true end local rightkern = i.rightkern if rightkern and rightkern ~= 0 then -rightkern = rightkern * getscale(n) +rightkern = rightkern * getxscale(n) insert_node_after(pre,n,fontkern(rightkern)) done = true end @@ -947,18 +934,18 @@ rightkern = rightkern * getscale(n) if i then local yoffset = i.yoffset if yoffset and yoffset ~= 0 then -yoffset = yoffset * getscale(current) +yoffset = yoffset * getyscale(current) setoffsets(n,false,yoffset) end local leftkern = i.leftkern if leftkern and leftkern ~= 0 then -leftkern = leftkern * getscale(n) +leftkern = leftkern * getxscale(n) post = insert_node_before(post,n,fontkern(leftkern)) done = true end local rightkern = i.rightkern if rightkern and rightkern ~= 0 then -rightkern = rightkern * getscale(n) +rightkern = rightkern * getxscale(n) insert_node_after(post,n,fontkern(rightkern)) done = true end @@ -975,18 +962,18 @@ rightkern = rightkern * getscale(n) if i then local yoffset = i.yoffset if yoffset and yoffset ~= 0 then -yoffset = yoffset * getscale(current) +yoffset = yoffset * getyscale(current) setoffsets(n,false,yoffset) end local leftkern = i.leftkern if leftkern and leftkern ~= 0 then -leftkern = leftkern * getscale(n) +leftkern = leftkern * getxscale(n) replace = insert_node_before(replace,n,fontkern(leftkern)) done = true end local rightkern = i.rightkern if rightkern and rightkern ~= 0 then -rightkern = rightkern * getscale(n) +rightkern = rightkern * getxscale(n) insert_node_after(replace,n,fontkern(rightkern)) done = true end @@ -1003,7 +990,7 @@ rightkern = rightkern * getscale(n) -- glyph|pre glyphs local rightkern = i.rightkern if rightkern and rightkern ~= 0 then -rightkern = rightkern * getscale(prevglyph) +rightkern = rightkern * getxscale(prevglyph) pre = insert_node_before(pre,pre,fontkern(rightkern)) done = true end @@ -1018,7 +1005,7 @@ rightkern = rightkern * getscale(prevglyph) -- glyph|replace glyphs local rightkern = i.rightkern if rightkern and rightkern ~= 0 then -rightkern = rightkern * getscale(prevglyph) +rightkern = rightkern * getxscale(prevglyph) replace = insert_node_before(replace,replace,fontkern(rightkern)) done = true end @@ -1165,8 +1152,8 @@ local function inject_everything(head,where) oy = oy + yoffset -- husayni needs it end end -ox = ox * getscale(p) -oy = oy * getscale(p) +ox = ox * getxscale(p) +oy = oy * getyscale(p) setoffsets(n,ox,oy) if trace_marks then showoffset(n,true) @@ -1176,10 +1163,7 @@ oy = oy * getscale(p) -- local base = nil -- bah, some arabic fonts have no mark anchoring -- end of temp fix -- while current do - -- local next = getnext(current) - -- local char, id = ischar(current) - -- local next, char, id = isnextchar(current) - local next, char, id = isnextglyph(current) + local next, char, id = isnextchar(current) if char then local p = rawget(properties,current) -- begin of temp fix -- @@ -1246,7 +1230,7 @@ oy = oy * getscale(p) else local yoffset = i.yoffset if yoffset and yoffset ~= 0 then -yoffset = yoffset * getscale(current) +yoffset = yoffset * getyscale(current) setoffsets(current,false,yoffset) end if hascursives then @@ -1274,7 +1258,7 @@ yoffset = yoffset * getscale(current) for i=maxc,minc,-1 do local ti = glyphs[i] ny = ny + properties[ti].cursivedy -* getscale(current) +* getyscale(current) setoffsets(ti,false,ny) -- why not add ? if trace_cursive then showoffset(ti) @@ -1291,7 +1275,7 @@ yoffset = yoffset * getscale(current) for i=maxc,minc,-1 do local ti = glyphs[i] ny = ny + properties[ti].cursivedy -* getscale(current) +* getyscale(current) setoffsets(ti,false,ny) -- why not add ? if trace_cursive then showoffset(ti) @@ -1306,7 +1290,7 @@ yoffset = yoffset * getscale(current) local leftkern = i.leftkern local rightkern = i.rightkern if leftkern and leftkern ~= 0 then -leftkern = leftkern * getscale(current) +leftkern = leftkern * getxscale(current) if rightkern and leftkern == -rightkern then setoffsets(current,leftkern,false) rightkern = 0 @@ -1321,7 +1305,7 @@ leftkern = leftkern * getscale(current) end end if rightkern and rightkern ~= 0 then -rightkern = rightkern * getscale(current) +rightkern = rightkern * getxscale(current) if next and getid(next) == glue_code then if useitalickerns then insert_node_after(head,current,italickern(rightkern)) @@ -1343,7 +1327,7 @@ rightkern = rightkern * getscale(current) if replace then -- error, we expect an empty one else -rightkern = rightkern * getscale(current) +rightkern = rightkern * getxscale(current) replace = fontkern(rightkern) done = true end @@ -1359,7 +1343,7 @@ rightkern = rightkern * getscale(current) if i then local leftkern = i.leftkern if leftkern and leftkern ~= 0 then -leftkern = leftkern * getscale(current) +leftkern = leftkern * getxscale(current) setlink(posttail,fontkern(leftkern)) done = true end @@ -1370,7 +1354,7 @@ leftkern = leftkern * getscale(current) if i then local leftkern = i.leftkern if leftkern and leftkern ~= 0 then -leftkern = leftkern * getscale(current) +leftkern = leftkern * getxscale(current) setlink(replacetail,fontkern(leftkern)) done = true end @@ -1380,7 +1364,7 @@ leftkern = leftkern * getscale(current) if i then local leftkern = i.leftkern if leftkern and leftkern ~= 0 then -leftkern = leftkern * getscale(current) +leftkern = leftkern * getxscale(current) replace = fontkern(leftkern) done = true end @@ -1398,7 +1382,7 @@ leftkern = leftkern * getscale(current) for i=maxc,minc,-1 do local ti = glyphs[i] ny = ny + properties[ti].cursivedy -* getscale(current) +* getyscale(current) local xi, yi = getoffsets(ti) setoffsets(ti,xi,yi + ny) -- can be mark, we could use properties end @@ -1429,13 +1413,13 @@ leftkern = leftkern * getscale(current) end local leftkern = i.leftkern if leftkern and leftkern ~= 0 then -leftkern = leftkern * getscale(n) +leftkern = leftkern * getxscale(n) pre = insert_node_before(pre,n,fontkern(leftkern)) done = true end local rightkern = i.rightkern if rightkern and rightkern ~= 0 then -rightkern = rightkern * getscale(n) +rightkern = rightkern * getxscale(n) insert_node_after(pre,n,fontkern(rightkern)) done = true end @@ -1462,13 +1446,13 @@ rightkern = rightkern * getscale(n) end local leftkern = i.leftkern if leftkern and leftkern ~= 0 then -leftkern = leftkern * getscale(n) +leftkern = leftkern * getsxcale(n) post = insert_node_before(post,n,fontkern(leftkern)) done = true end local rightkern = i.rightkern if rightkern and rightkern ~= 0 then -rightkern = rightkern * getscale(n) +rightkern = rightkern * getsxcale(n) insert_node_after(post,n,fontkern(rightkern)) done = true end @@ -1495,13 +1479,13 @@ rightkern = rightkern * getscale(n) end local leftkern = i.leftkern if leftkern and leftkern ~= 0 then -leftkern = leftkern * getscale(n) +leftkern = leftkern * getxscale(n) replace = insert_node_before(replace,n,fontkern(leftkern)) done = true end local rightkern = i.rightkern if rightkern and rightkern ~= 0 then -rightkern = rightkern * getscale(n) +rightkern = rightkern * getxscale(n) insert_node_after(replace,n,fontkern(rightkern)) done = true end @@ -1524,7 +1508,7 @@ rightkern = rightkern * getscale(n) -- glyph|pre glyphs local rightkern = i.rightkern if rightkern and rightkern ~= 0 then -rightkern = rightkern * getscale(prevglyph) +rightkern = rightkern * getxscale(prevglyph) pre = insert_node_before(pre,pre,fontkern(rightkern)) done = true end @@ -1539,7 +1523,7 @@ rightkern = rightkern * getscale(prevglyph) -- glyph|replace glyphs local rightkern = i.rightkern if rightkern and rightkern ~= 0 then -rightkern = rightkern * getscale(prevglyph) +rightkern = rightkern * getxscale(prevglyph) replace = insert_node_before(replace,replace,fontkern(rightkern)) done = true end @@ -1677,7 +1661,7 @@ local function injectspaces(head) local leftkern = false local rightkern = false -local scale = 1 +local xscale = 1 local function updatefont(font,trig) leftkerns = trig.left @@ -1701,7 +1685,7 @@ local scale = 1 if rightkerns then rightkern = rightkerns[nextchar] end - scale = getscale(next) +xscale = getxscale(next) end end if prevchar then @@ -1714,7 +1698,7 @@ local scale = 1 if leftkerns then leftkern = leftkerns[prevchar] end - scale = getscale(prev) +xscale = getxscale(prev) end end if leftkern then @@ -1727,8 +1711,8 @@ local scale = 1 if trace_spaces then report_spaces("%C [%p + %p + %p] %C",prevchar,lnew,old,rnew,nextchar) end -lnew = lnew * scale -rnew = rnew * scale +lnew = lnew * xscale +rnew = rnew * xscale head = insert_node_before(head,n,italickern(lnew)) insert_node_after(head,n,italickern(rnew)) else @@ -1745,11 +1729,11 @@ rnew = rnew * scale if trace_spaces then report_spaces("%C [%p + %p]",prevchar,old,new) end -new = new * scale +new = new * xscale insert_node_after(head,n,italickern(new)) -- tricky with traverse but ok else -- local new = old + leftkern * factor -local new = old + leftkern * factor * scale +local new = old + leftkern * factor * xscale if trace_spaces then report_spaces("%C [%p -> %p]",prevchar,old,new) end @@ -1763,14 +1747,14 @@ local new = old + leftkern * factor * scale if old > threshold then if useitalickerns then local new = rightkern * factor -new = new * scale +new = new * xscale if trace_spaces then report_spaces("[%p + %p] %C",old,new,nextchar) end insert_node_after(head,n,italickern(new)) else -- local new = old + rightkern * factor -local new = old + rightkern * factor * scale +local new = old + rightkern * factor * xscale if trace_spaces then report_spaces("[%p -> %p] %C",old,new,nextchar) end diff --git a/tex/context/base/mkxl/font-ots.lmt b/tex/context/base/mkxl/font-ots.lmt index bd70d6d47..478dc700d 100644 --- a/tex/context/base/mkxl/font-ots.lmt +++ b/tex/context/base/mkxl/font-ots.lmt @@ -205,7 +205,8 @@ local setlink = nuts.setlink local getwidth = nuts.getwidth local getglyphdata = nuts.getglyphdata -local getscale = nuts.getscale +local getscales = nuts.getscales +local getwhatever = nuts.getwhatever --------------------------------------------------------------------------------------- @@ -295,6 +296,8 @@ local marks = false local classes = false local currentfont = false local currentattr = false +local currentxscale = false +local currentyscale = false local factor = 0 local threshold = 0 local checkmarks = false @@ -761,7 +764,7 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip local startchar = getchar(start) if skiphash and skiphash[startchar] then while current do - local nxt, char = isnextchar(current,currentfont,currentattr) + local nxt, char = isnextchar(current,currentfont,currentxscale,currentyscale) if char then local lg = ligature[char] if lg then @@ -795,7 +798,7 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip local discfound = false local hasmarks = marks[startchar] while current do - local nxt, char, id = isnextchar(current,currentfont,currentattr) + local nxt, char, id = isnextchar(current,currentfont,currentxscale,currentyscale) if char then if skiphash and skiphash[char] then current = nxt @@ -830,20 +833,20 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip local pre, post, replace = getdisc(discfound) local match if replace then - local char = ischar(replace,currentfont,currentattr) + local char = ischar(replace,currentfont,currentxscale,currentyscale) if char and ligature[char] then match = true end end if not match and pre then - local char = ischar(pre,currentfont,currentattr) + local char = ischar(pre,currentfont,currentxscale,currentyscale) if char and ligature[char] then match = true end end if not match and not pre or not replace then local n = getnext(discfound) - local char = ischar(n,currentfont,currentattr) + local char = ischar(n,currentfont,currentxscale,currentyscale) if char and ligature[char] then match = true end @@ -947,7 +950,7 @@ function handlers.gpos_pair(head,start,dataset,sequence,kerns,rlmode,skiphash,st else local prev = start while snext do - local nextchar = ischar(snext,currentfont,currentattr) + local nextchar = ischar(snext,currentfont,currentxscale,currentyscale) if nextchar then if skiphash and skiphash[nextchar] then -- includes marks too when flag prev = snext @@ -1013,13 +1016,13 @@ function handlers.gpos_mark2base(head,start,dataset,sequence,markanchors,rlmode, if marks[markchar] then local base = getprev(start) -- [glyph] [start=mark] if base then - local basechar = ischar(base,currentfont,currentattr) + local basechar = ischar(base,currentfont,currentxscale,currentyscale) if basechar then if marks[basechar] then while base do base = getprev(base) if base then - basechar = ischar(base,currentfont,currentattr) + basechar = ischar(base,currentfont,currentxscale,currentyscale) if basechar then if not marks[basechar] then break @@ -1068,13 +1071,13 @@ function handlers.gpos_mark2ligature(head,start,dataset,sequence,markanchors,rlm if marks[markchar] then local base = getprev(start) -- [glyph] [optional marks] [start=mark] if base then - local basechar = ischar(base,currentfont,currentattr) + local basechar = ischar(base,currentfont,currentxscale,currentyscale) if basechar then if marks[basechar] then while base do base = getprev(base) if base then - basechar = ischar(base,currentfont,currentattr) + basechar = ischar(base,currentfont,currentxscale,currentyscale) if basechar then if not marks[basechar] then break @@ -1144,7 +1147,7 @@ function handlers.gpos_mark2mark(head,start,dataset,sequence,markanchors,rlmode, end end if base then - local basechar = ischar(base,currentfont,currentattr) + local basechar = ischar(base,currentfont,currentxscale,currentyscale) if basechar then -- subtype test can go local ba = markanchors[1][basechar] -- slot 1 has been made copy of the class hash if ba then @@ -1173,7 +1176,7 @@ function handlers.gpos_cursive(head,start,dataset,sequence,exitanchors,rlmode,sk else local nxt = getnext(start) while nxt do - local nextchar = ischar(nxt,currentfont,currentattr) + local nextchar = ischar(nxt,currentfont,currentxscale,currentyscale) if not nextchar then break elseif marks[nextchar] then -- always sequence.flags[1] @@ -1501,7 +1504,7 @@ function chainprocs.gsub_ligature(head,start,stop,dataset,sequence,currentlookup -- end -- end -- - local nxt, schar, id = isnextchar(current,currentfont,currentattr) + local nxt, schar, id = isnextchar(current,currentfont,currentxscale,currentyscale) if schar then if skiphash and skiphash[schar] then -- marks -- if current == stop then -- maybe add this @@ -1610,7 +1613,7 @@ function chainprocs.gpos_pair(head,start,stop,dataset,sequence,currentlookup,rlm if kerns then local prev = start while snext do - local nextchar = ischar(snext,currentfont,currentattr) + local nextchar = ischar(snext,currentfont,currentxscale,currentyscale) if not nextchar then break end @@ -1679,13 +1682,13 @@ function chainprocs.gpos_mark2base(head,start,stop,dataset,sequence,currentlooku if markanchors then local base = getprev(start) -- [glyph] [start=mark] if base then - local basechar = ischar(base,currentfont,currentattr) + local basechar = ischar(base,currentfont,currentxscale,currentyscale) if basechar then if marks[basechar] then while base do base = getprev(base) if base then - local basechar = ischar(base,currentfont,currentattr) + local basechar = ischar(base,currentfont,currentxscale,currentyscale) if basechar then if not marks[basechar] then break @@ -1744,13 +1747,13 @@ function chainprocs.gpos_mark2ligature(head,start,stop,dataset,sequence,currentl if markanchors then local base = getprev(start) -- [glyph] [optional marks] [start=mark] if base then - local basechar = ischar(base,currentfont,currentattr) + local basechar = ischar(base,currentfont,currentxscale,currentyscale) if basechar then if marks[basechar] then while base do base = getprev(base) if base then - local basechar = ischar(base,currentfont,currentattr) + local basechar = ischar(base,currentfont,currentxscale,currentyscale) if basechar then if not marks[basechar] then break @@ -1824,7 +1827,7 @@ function chainprocs.gpos_mark2mark(head,start,stop,dataset,sequence,currentlooku end end if base then -- subtype test can go - local basechar = ischar(base,currentfont,currentattr) + local basechar = ischar(base,currentfont,currentxscale,currentyscale) if basechar then local ba = markanchors[1][basechar] if ba then @@ -1870,7 +1873,7 @@ function chainprocs.gpos_cursive(head,start,stop,dataset,sequence,currentlookup, else local nxt = getnext(start) while nxt do - local nextchar = ischar(nxt,currentfont,currentattr) + local nextchar = ischar(nxt,currentfont,currentxscale,currentyscale) if not nextchar then break elseif marks[nextchar] then @@ -2045,7 +2048,7 @@ local function chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck) while start do if skiphash then -- hm, so we know we skip some while start do - local char = ischar(start,currentfont,currentattr) + local char = ischar(start,currentfont,currentxscale,currentyscale) if char then if skiphash and skiphash[char] then start = getnext(start) @@ -2306,7 +2309,7 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) local insertedmarks = 0 while cprev do - local char = ischar(cf,currentfont,currentattr) + local char = ischar(cf,currentfont,currentxscale,currentyscale) if char and marks[char] then insertedmarks = insertedmarks + 1 cf = cprev @@ -2372,7 +2375,7 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) local insertedmarks = 0 while cnext do - local char = ischar(cnext,currentfont,currentattr) + local char = ischar(cnext,currentfont,currentxscale,currentyscale) if char and marks[char] then insertedmarks = insertedmarks + 1 cl = cnext @@ -2481,8 +2484,9 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s end checkdisc = getprev(head) end - local currentfont = currentfont - local currentattr = currentattr + local currentfont = currentfont -- really ? + local currentxscale = currentxscale -- really ? + local currentyscale = currentyscale -- really ? local skipped -- = false @@ -2501,7 +2505,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s local nofcontexts = contexts.n -- #contexts - local startchar = nofcontext == 1 or ischar(start,currentfont,currentattr) -- only needed in a chain + local startchar = nofcontext == 1 or ischar(start,currentfont,currentxscale,currentyscale) -- only needed in a chain for k=1,nofcontexts do -- does this disc mess work well with n > 1 @@ -2535,7 +2539,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s end if last then -- local char, id = ischar(last,currentfont) - local nxt, char, id = isnextchar(last,currentfont,currentattr) + local nxt, char, id = isnextchar(last,currentfont,currentxscale,currentyscale) if char then if skiphash and skiphash[char] then skipped = true @@ -2648,7 +2652,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s while n >= 1 do if prev then -- local char, id = ischar(prev,currentfont) - local prv, char, id = isprevchar(prev,currentfont,currentattr) + local prv, char, id = isprevchar(prev,currentfont,currentxscale,currentyscale) if char then if skiphash and skiphash[char] then skipped = true @@ -2786,7 +2790,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s while n <= s do if current then -- local char, id = ischar(current,currentfont) - local nxt, char, id = isnextchar(current,currentfont,currentattr) + local nxt, char, id = isnextchar(current,currentfont,currentxscale,currentyscale) if char then if skiphash and skiphash[char] then skipped = true @@ -3423,48 +3427,6 @@ local function c_run_single(head,font,attr,lookupcache,step,dataset,sequence,rlm return head, done end --- local function c_run_single(head,font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler) --- local done = false --- local sweep = sweephead[head] --- local start --- if sweep then --- start = sweep --- -- sweephead[head] = nil --- sweephead[head] = false --- else --- start = head --- end --- while start do --- local nxt, char, id = isnextchar(start,font,currentattribute) --- if char then --- local lookupmatch = lookupcache[char] --- if lookupmatch then --- local ok --- head, start, ok = handler(head,start,dataset,sequence,lookupmatch,rlmode,skiphash,step) --- if ok then --- done = true --- end --- if start then --- start = getnext(start) --- end --- else --- start = nxt --- end --- elseif char == false then --- return head, done --- elseif sweep then --- -- else we loose the rest --- return head, done --- else --- -- in disc component --- start = nxt --- end --- end --- return head, done --- end - --- only replace? - local function t_run_single(start,stop,font,attr,lookupcache) local lastd = nil while start ~= stop do @@ -3860,18 +3822,19 @@ do nesting = nesting + 1 if nesting == 1 then - currentfont = font - currentattr = attr -currentattr = false - tfmdata = fontdata[font] - descriptions = tfmdata.descriptions -- only needed in gref so we could pass node there instead - characters = tfmdata.characters -- but this branch is not entered that often anyway - local resources = tfmdata.resources - marks = resources.marks - classes = resources.classes + currentfont = font + currentattr = attr + currentxscale = false + currentyscale = false + tfmdata = fontdata[font] + descriptions = tfmdata.descriptions -- only needed in gref so we could pass node there instead + characters = tfmdata.characters -- but this branch is not entered that often anyway + local resources = tfmdata.resources + marks = resources.marks + classes = resources.classes threshold, - factor = getthreshold(font) - checkmarks = tfmdata.properties.checkmarks + factor = getthreshold(font) + checkmarks = tfmdata.properties.checkmarks if not otfdataset then otfdataset = otf.dataset @@ -3908,7 +3871,6 @@ currentattr = false initialrl = -1 end - -- local done = false local datasets = otfdataset(tfmdata,font,attr) local dirstack = { nil } -- could move outside function but we can have local runs sweephead = { } @@ -3939,9 +3901,6 @@ currentattr = false -- are not frozen as we might extend or change this. Is this used at all apart from some -- experiments? local h, ok = handler(head,dataset,sequence,initialrl,font,attr) -- less arguments now - -- if ok then - -- done = true - -- end if h and h ~= head then head = h end @@ -3955,20 +3914,24 @@ currentattr = false local rlmode = 0 -- how important is this .. do we need to check for dir? local merged = steps.merged while start do - local char = ischar(start,font) +-- local prv, char, id = isprevchar(start,font) + local prv, char, id = isprevchar(start,font) if char then local m = merged[char] if m then - local a -- happens often so no assignment is faster - if attr then - a = getglyphdata(start) - end - if not a or (a == attr) then -currentattr = getscale(start) +-- local a -- happens often so no assignment is faster +-- if attr then +-- a = getglyphdata(start) +-- end +-- if not a or (a == attr) then +-- currentxscale, currentyscale = getscales(start) + + local a + a, currentxscale, currentyscale = getwhatever(start,attr,attribute) + if a then + for i=m[1],m[2] do local step = steps[i] - -- for i=1,#m do - -- local step = m[i] local lookupcache = step.coverage local lookupmatch = lookupcache[char] if lookupmatch then @@ -3984,13 +3947,13 @@ currentattr = getscale(start) start = getprev(start) end else - start = getprev(start) + start = prv end else - start = getprev(start) + start = prv end else - start = getprev(start) + start = prv end end else @@ -4000,47 +3963,45 @@ currentattr = getscale(start) local step = steps[1] local lookupcache = step.coverage while start do - -- local char, id = ischar(start,font) local nxt, char, id = isnextchar(start,font) if char then if skiphash and skiphash[char] then -- we never needed it here but let's try - -- start = getnext(start) start = nxt else local lookupmatch = lookupcache[char] if lookupmatch then - local a -- happens often so no assignment is faster - if attr then - if getglyphdata(start) == attr and (not attribute or getstate(start,attribute)) then - a = true - end - elseif not attribute or getstate(start,attribute) then - a = true - end +-- local a -- happens often so no assignment is faster +-- if attr then +-- if getglyphdata(start) == attr and (not attribute or getstate(start,attribute)) then +-- a = true +-- end +-- elseif not attribute or getstate(start,attribute) then +-- a = true +-- end +-- if a then +-- currentxscale, currentyscale = getscales(start) + + local a + a, currentxscale, currentyscale = getwhatever(start,attr,attribute) if a then -currentattr = getscale(start) + local ok, df head, start, ok, df = handler(head,start,dataset,sequence,lookupmatch,rlmode,skiphash,step) - -- if ok then - -- done = true - -- end if df then -- print("restart 1",typ) elseif start then start = getnext(start) -- can be a new start end else - -- start = getnext(start) start = nxt end else - -- start = getnext(start) start = nxt end + end elseif char == false or id == glue_code then -- a different font|state or glue (happens often) - -- start = getnext(start) start = nxt elseif id == disc_code then if not discs or discs[start] == true then @@ -4056,51 +4017,48 @@ currentattr = getscale(start) -- done = true -- end else - -- start = getnext(start) start = nxt end elseif id == math_code then start = getnext(end_of_math(start)) elseif id == dir_code then topstack, rlmode = txtdirstate(start,dirstack,topstack,rlparmode) - -- start = getnext(start) start = nxt -- elseif id == par_code and start_of_par(start) then -- rlparmode, rlmode = pardirstate(start) - -- -- start = getnext(start) -- start = nxt else - -- start = getnext(start) start = nxt end end else local merged = steps.merged while start do - -- local char, id = ischar(start,font) local nxt, char, id = isnextchar(start,font) if char then if skiphash and skiphash[char] then -- we never needed it here but let's try - -- start = getnext(start) start = nxt else local m = merged[char] if m then - local a -- happens often so no assignment is faster - if attr then - if getglyphdata(start) == attr and (not attribute or getstate(start,attribute)) then - a = true - end - elseif not attribute or getstate(start,attribute) then - a = true - end +-- local a -- happens often so no assignment is faster +-- if attr then +-- if getglyphdata(start) == attr and (not attribute or getstate(start,attribute)) then +-- a = true +-- end +-- elseif not attribute or getstate(start,attribute) then +-- a = true +-- end +-- if a then +-- currentxscale, currentyscale = getscales(start) + + local a + a, currentxscale, currentyscale = getwhatever(start,attr,attribute) if a then -currentattr = getscale(start) + local ok, df for i=m[1],m[2] do local step = steps[i] - -- for i=1,#m do - -- local step = m[i] local lookupcache = step.coverage local lookupmatch = lookupcache[char] if lookupmatch then @@ -4110,7 +4068,6 @@ currentattr = getscale(start) if df then break elseif ok then - -- done = true break elseif not start then -- don't ask why ... shouldn't happen @@ -4124,17 +4081,14 @@ currentattr = getscale(start) start = getnext(start) -- can be a new next end else - -- start = getnext(start) start = nxt end else - -- start = getnext(start) start = nxt end end elseif char == false or id == glue_code then -- a different font|state or glue (happens often) - -- start = getnext(start) start = nxt elseif id == disc_code then if not discs or discs[start] == true then @@ -4146,24 +4100,18 @@ currentattr = getscale(start) else start, ok = comprun(start,c_run_multiple, font,attr,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) end - -- if ok then - -- done = true - -- end else - -- start = getnext(start) start = nxt end elseif id == math_code then start = getnext(end_of_math(start)) elseif id == dir_code then topstack, rlmode = txtdirstate(start,dirstack,topstack,rlparmode) - -- start = getnext(start) start = nxt -- elseif id == par_code and start_of_par(start) then -- rlparmode, rlmode = pardirstate(start) - -- start = getnext(start) + -- start = nxt else - -- start = getnext(start) start = nxt end end @@ -4178,7 +4126,6 @@ currentattr = getscale(start) nesting = nesting - 1 - -- return head, done return head end @@ -4188,7 +4135,8 @@ currentattr = getscale(start) function otf.datasetpositionprocessor(head,font,direction,dataset) currentfont = font - currentattr = false + currentxscale = false + currentyscale = false tfmdata = fontdata[font] descriptions = tfmdata.descriptions -- only needed in gref so we could pass node there instead characters = tfmdata.characters -- but this branch is not entered that often anyway diff --git a/tex/context/base/mkxl/lpdf-lmt.lmt b/tex/context/base/mkxl/lpdf-lmt.lmt index dd64f0107..545649243 100644 --- a/tex/context/base/mkxl/lpdf-lmt.lmt +++ b/tex/context/base/mkxl/lpdf-lmt.lmt @@ -42,7 +42,7 @@ local loaddata = io.loaddata local bpfactor = number.dimenfactors.bp -local md5HEX = md5.HEX +-- local md5HEX = md5.HEX local osuuid = os.uuid local zlibcompress = (xzip or zlib).compress @@ -106,7 +106,7 @@ local pdf_h, pdf_v local need_tm, need_tf, cur_tmrx, cur_factor, cur_f, cur_e local need_width, need_mode, done_width, done_mode local mode -local f_pdf_cur, f_pdf, fs_cur, fs, f_cur, f_scale +local f_pdf_cur, f_pdf, fs_cur, fs, f_cur, f_x_scale, f_y_scale local tj_delta, cw local usedfonts, usedxforms, usedximages, usedxgroups local getxformname, getximagename @@ -145,7 +145,8 @@ local function reset_variables(specification) f_pdf = 0 -- nullfont fs_cur = 0 fs = 0 - f_scale = 1.0 + f_x_scale = 1.0 + f_y_scale = 1.0 cur_factor = 0 cur_f = false cur_e = false @@ -470,7 +471,7 @@ local flushcharacter do return v end) - local function setup_fontparameters(font,factor,f,e,s) + local function setup_fontparameters(font,factor,f,e,sx,sy) local slant = fontparameters.slantfactor or 0 local extend = fontparameters.extendfactor or 1 local squeeze = fontparameters.squeezefactor or 1 @@ -491,7 +492,8 @@ local flushcharacter do cur_f = f cur_e = e tj_delta = 0 - f_scale = 1.0 + f_x_scale = 1.0 + f_y_scale = 1.0 fs = fontparameters.size * bpfactor if f then fs = fs * f @@ -501,9 +503,14 @@ local flushcharacter do fs = fs * 1000 / fontparameters.units -- can we avoid this ? end -- -f_scale = s -if f_scale ~= 1.0 then - fs = fs * f_scale +f_x_scale = sx +if f_x_scale ~= 1.0 then +-- fs = fs * f_x_scale + tmrx = tmrx * f_x_scale +end +f_y_scale = sy +if f_y_scale ~= 1.0 then + tmry = tmry * f_y_scale end -- naturalwidth = naturalwidths[font] @@ -586,29 +593,16 @@ end -- luatex (a precursor to lmtx and also for comparison) but only in lmtx now so ... -- time to move on I guess. - local getscale = nuts.getscale - - flushcharacter = function(current,pos_h,pos_v,pos_r,font,char,data,f,e,factor) -- ,naturalwidth,width) + local getscales = nuts.getscales -local s -if current then - s = getscale(current) - if s == 1000 or s == 0 then - s = 1.0 - else - s = s / 1000 - end -else - s = f_scale -end + flushcharacter = function(current,pos_h,pos_v,pos_r,font,char,data,f,e,factor,sx,sy) -- ,naturalwidth,width) --- if need_tf or font ~= f_cur or f_pdf ~= f_pdf_cur or fs ~= fs_cur or mode == "page" then - if s ~= f_scale or need_tf or font ~= f_cur or f_pdf ~= f_pdf_cur or fs ~= fs_cur or mode == "page" then + if sx ~= f_x_scale or sy ~= f_y_scale or need_tf or font ~= f_cur or f_pdf ~= f_pdf_cur or fs ~= fs_cur or mode == "page" then pdf_goto_textmode() - setup_fontparameters(font,factor,f,e,s) + setup_fontparameters(font,factor,f,e,sx,sy) set_font() elseif cur_tmrx ~= tmrx or cur_factor ~= factor or cur_f ~= f or cur_e ~= e then - setup_fontparameters(font,factor,f,e,s) + setup_fontparameters(font,factor,f,e,sx,sy) need_tm = true end @@ -650,7 +644,7 @@ end end if move then local d = tj_delta * scalefactor - / f_scale + / f_x_scale if d <= -0.5 or d >= 0.5 then if mode == "char" then end_charmode() @@ -665,12 +659,9 @@ end begin_charmode() end --- cw = cw + naturalwidth[char] * tmef -cw = cw + naturalwidth[char] * tmef * f_scale - --- if f_scale ~= 1.0 then --- cw = cw * f_scale --- end +-- cw = cw + naturalwidth[char] * tmef + cw = cw + naturalwidth[char] * tmef +* f_x_scale local index = data.index or char @@ -2457,9 +2448,9 @@ local openfile, closefile do local catalog = lpdf.getcatalog() local info = lpdf.getinfo() if trailerid == true then - trailerid = md5HEX(osuuid()) + trailerid = md5.HEX(osuuid()) elseif trailerid and #trailerid > 32 then - trailerid = md5HEX(trailerid) + trailerid = md5.HEX(trailerid) else trailerid = false end diff --git a/tex/context/base/mkxl/meta-ini.mkxl b/tex/context/base/mkxl/meta-ini.mkxl index fbbf95fc8..70fab112b 100644 --- a/tex/context/base/mkxl/meta-ini.mkxl +++ b/tex/context/base/mkxl/meta-ini.mkxl @@ -378,7 +378,7 @@ \fi} \permanent\tolerant\def\startMPdrawing[#1]% todo: use pickup #: - {\meta_start_drawing#1} + {\meta_start_drawing{#1}} \def\meta_start_drawing#1#2\stopMPdrawing {\relax diff --git a/tex/context/base/mkxl/node-nut.lmt b/tex/context/base/mkxl/node-nut.lmt index f3926de7f..6f1afe74c 100644 --- a/tex/context/base/mkxl/node-nut.lmt +++ b/tex/context/base/mkxl/node-nut.lmt @@ -97,8 +97,12 @@ local nuts = { getnormalizedline = direct.getnormalizedline, getnucleus = direct.getnucleus, getoffsets = direct.getoffsets, - getscale = direct.getscale, + getscales = direct.getscales, + getxscale = direct.getxscale, + getyscale = direct.getyscale, + getxyscales = direct.getxyscales, getorientation = direct.getorientation, + getwhatever = direct.getwhatever, -- experimental hook getoptions = direct.getoptions, getpenalty = direct.getpenalty, getpost = direct.getpost, @@ -183,6 +187,7 @@ local nuts = { setlist = direct.setlist, setnext = direct.setnext, setnucleus = direct.setnucleus, + setscales = direct.setscales, setoffsets = direct.setoffsets, setorientation = direct.setorientation, setoptions = direct.setoptions, diff --git a/tex/context/base/mkxl/strc-des.mklx b/tex/context/base/mkxl/strc-des.mklx index 5ff375e49..0f4e7bcb5 100644 --- a/tex/context/base/mkxl/strc-des.mklx +++ b/tex/context/base/mkxl/strc-des.mklx @@ -110,17 +110,25 @@ \expandafter\strc_descriptions_start_reference \fi[#2]} +% we could use this: +% +% \def\strc_descriptions_preset +% {\setdescriptionparameter\c!label{\descriptionparameter\c!text}% +% \resetdescriptionparameter\c!bookmark +% \resetdescriptionparameter\c!list +% \resetdescriptionparameter\c!referencetext} + \protected\def\strc_descriptions_start_setups[#1]% {\setfalse\c_strc_constructions_title_state - \strc_constructions_register[][\c!label={\descriptionparameter\c!text},\c!reference=,\c!title=,\c!bookmark=,\c!list=,#1]% + \strc_constructions_register[][\c!label={\descriptionparameter\c!text},\c!reference=,\c!title=,\c!bookmark=,\c!list=,\c!referencetext=,#1]% \csname\??constructionstarthandler\currentconstructionhandler\endcsname} \protected\tolerant\def\strc_descriptions_start_title[#1]#*#=% - {\strc_constructions_register[][\c!label={\descriptionparameter\c!text},\c!reference={#1},\c!title={#2},\c!bookmark=,\c!list=]% + {\strc_constructions_register[][\c!label={\descriptionparameter\c!text},\c!reference={#1},\c!title={#2},\c!bookmark=,\c!list=,\c!referencetext=]% \csname\??constructionstarthandler\currentconstructionhandler\endcsname} \protected\def\strc_descriptions_start_reference[#1]% - {\strc_constructions_register[][\c!label={\descriptionparameter\c!text},\c!reference={#1},\c!title=,\c!bookmark=,\c!list=]% + {\strc_constructions_register[][\c!label={\descriptionparameter\c!text},\c!reference={#1},\c!title=,\c!bookmark=,\c!list=,\c!referencetext=]% \csname\??constructionstarthandler\currentconstructionhandler\endcsname} \protected\def\strc_descriptions_stop @@ -142,15 +150,15 @@ \protected\def\strc_descriptions_command_setups[#1]% {\setfalse\c_strc_constructions_title_state - \strc_constructions_register[][\c!label={\descriptionparameter\c!text},\c!reference=,\c!title=,\c!bookmark=,\c!list=,#1]% + \strc_constructions_register[][\c!label={\descriptionparameter\c!text},\c!reference=,\c!title=,\c!bookmark=,\c!list=,\c!referencetext=,#1]% \csname\??constructioncommandhandler\currentconstructionhandler\endcsname} \protected\tolerant\def\strc_descriptions_command_title[#1]#:#*#=% - {\strc_constructions_register[][\c!label={\descriptionparameter\c!text},\c!reference={#1},\c!title={#2},\c!bookmark=,\c!list=]% + {\strc_constructions_register[][\c!label={\descriptionparameter\c!text},\c!reference={#1},\c!title={#2},\c!bookmark=,\c!list=,\c!referencetext=]% \csname\??constructioncommandhandler\currentconstructionhandler\endcsname} \protected\def\strc_descriptions_command_reference[#1]% - {\strc_constructions_register[][\c!label={\descriptionparameter\c!text},\c!reference={#1},\c!title=,\c!bookmark=,\c!list=]% + {\strc_constructions_register[][\c!label={\descriptionparameter\c!text},\c!reference={#1},\c!title=,\c!bookmark=,\c!list=,\c!referencetext=]% \csname\??constructioncommandhandler\currentconstructionhandler\endcsname} %D Handlers: diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 1499dd908..3e239c7d7 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 : 2020-12-22 22:09 +-- merge date : 2020-12-24 12:12 do -- begin closure to overcome local limits and interference @@ -37124,7 +37124,7 @@ local rules={ "FractionRuleThickness", "UnderbarRuleThickness", } -local function setmathparameters(tfmdata,characters,mathparameters,dx,dy,squeeze) +local function setmathparameters(tfmdata,characters,mathparameters,dx,dy,squeeze,multiplier) if delta~=0 then for i=1,#rules do local name=rules[i] @@ -37245,7 +37245,7 @@ local function manipulateeffect(tfmdata) end end if mathparameters then - setmathparameters(tfmdata,characters,mathparameters,dx,dy,squeeze) + setmathparameters(tfmdata,characters,mathparameters,dx,dy,squeeze,multiplier) setmathcharacters(tfmdata,characters,mathparameters,dx,dy,squeeze,wdelta,hdelta,ddelta) end parameters.factor=factor |