From dfdf39bed2e7dda3f2d59c8bf71cf0fb80a317dd Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Tue, 22 Dec 2020 22:30:22 +0100 Subject: 2020-12-22 22:12:00 --- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkiv/anch-pos.lua | 2 +- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/font-dsp.lua | 2 +- tex/context/base/mkiv/mult-prm.lua | 2 + tex/context/base/mkiv/status-files.pdf | Bin 26100 -> 26083 bytes tex/context/base/mkiv/status-lua.pdf | Bin 253608 -> 253562 bytes tex/context/base/mkxl/anch-pos.lmt | 2 +- tex/context/base/mkxl/cldf-int.lmt | 4 +- tex/context/base/mkxl/cont-new.mkxl | 2 +- tex/context/base/mkxl/context.mkxl | 2 +- tex/context/base/mkxl/driv-shp.lmt | 11 +- tex/context/base/mkxl/font-ini.mklx | 15 ++ tex/context/base/mkxl/font-lib.mklx | 1 + tex/context/base/mkxl/font-otj.lmt | 143 ++++++++------- tex/context/base/mkxl/font-ots.lmt | 192 ++++++++++++++++----- tex/context/base/mkxl/lpdf-lmt.lmt | 48 +++++- tex/context/base/mkxl/lpdf-rul.lmt | 4 +- tex/context/base/mkxl/luat-usr.mkxl | 8 +- tex/context/base/mkxl/mlib-ran.lmt | 2 +- tex/context/base/mkxl/node-nut.lmt | 3 + tex/context/base/mkxl/syst-fnt.mkxl | 30 ++-- tex/generic/context/luatex/luatex-fonts-merged.lua | 4 +- 25 files changed, 332 insertions(+), 153 deletions(-) (limited to 'tex') diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 256006f2f..15c0a415a 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.21 09:32} +\newcontextversion{2020.12.22 22:09} %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 e0b7329fd..ea2ab00dc 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.21 09:32} +\edef\contextversion{2020.12.22 22:09} %D For those who want to use this: diff --git a/tex/context/base/mkiv/anch-pos.lua b/tex/context/base/mkiv/anch-pos.lua index b2ad5b8b5..77bf09e39 100644 --- a/tex/context/base/mkiv/anch-pos.lua +++ b/tex/context/base/mkiv/anch-pos.lua @@ -254,7 +254,7 @@ local nofpages = nil -- beware ... we're not sparse here as lua will reserve slots for the nilled -local getpos, gethpos, getvpos +local getpos, gethpos, getvpos, getrpos function jobpositions.registerhandlers(t) getpos = t and t.getpos or function() return 0, 0 end diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 0497d4005..0de515f2f 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.21 09:32} +\newcontextversion{2020.12.22 22:09} %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 73324b92f..f0a1b127c 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.21 09:32} +\edef\contextversion{2020.12.22 22:09} %D Kind of special: diff --git a/tex/context/base/mkiv/font-dsp.lua b/tex/context/base/mkiv/font-dsp.lua index 0cff896e8..91ee83b19 100644 --- a/tex/context/base/mkiv/font-dsp.lua +++ b/tex/context/base/mkiv/font-dsp.lua @@ -823,7 +823,7 @@ end -- quite often 0, 1, 2 -function readarray(f,offset) +local function readarray(f,offset) if offset then setposition(f,offset) end diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua index 38e13aa3e..e2b12f05c 100644 --- a/tex/context/base/mkiv/mult-prm.lua +++ b/tex/context/base/mkiv/mult-prm.lua @@ -299,6 +299,7 @@ return { "glyphdatafield", "glyphdimensionsmode", "glyphoptions", + "glyphscale", "glyphscriptfield", "glyphstatefield", "gtoksapp", @@ -801,6 +802,7 @@ return { "righthyphenmin", "rightskip", "romannumeral", + "scaledfontdimen", "scriptfont", "scriptscriptfont", "scriptscriptstyle", diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index 2c9f519e0..f6badb99a 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index 06cc3bd93..f277ec894 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ diff --git a/tex/context/base/mkxl/anch-pos.lmt b/tex/context/base/mkxl/anch-pos.lmt index e1d9bd752..e804dbdf6 100644 --- a/tex/context/base/mkxl/anch-pos.lmt +++ b/tex/context/base/mkxl/anch-pos.lmt @@ -254,7 +254,7 @@ local nofpages = nil -- beware ... we're not sparse here as lua will reserve slots for the nilled -local getpos, gethpos, getvpos +local getpos, gethpos, getvpos, getrpos function jobpositions.registerhandlers(t) getpos = t and t.getpos or function() return 0, 0 end diff --git a/tex/context/base/mkxl/cldf-int.lmt b/tex/context/base/mkxl/cldf-int.lmt index 4f486221b..4a60b469a 100644 --- a/tex/context/base/mkxl/cldf-int.lmt +++ b/tex/context/base/mkxl/cldf-int.lmt @@ -39,7 +39,7 @@ local close = byte(']') local equal = byte('=') local comma = byte(',') -function scanhash(scanners) +local function scanhash(scanners) if peekchar() == open then local data = { } scanskip() @@ -77,7 +77,7 @@ function scanhash(scanners) end end -function scanarray() +local function scanarray() if peekchar() == open then local data = { } local d = 0 diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 448809e0f..354f089c1 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.21 09:32} +\newcontextversion{2020.12.22 22:09} %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 90fe9c913..b59d6982c 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.21 09:32} +\immutable\edef\contextversion{2020.12.22 22:09} %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 7a385d7ab..124f95bb3 100644 --- a/tex/context/base/mkxl/driv-shp.lmt +++ b/tex/context/base/mkxl/driv-shp.lmt @@ -192,7 +192,7 @@ updaters.register("backend.update",function() stopcolor = fonts.vfcommands.stopcolor end) -local function flush_vf_packet(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) if nesting > 100 then return @@ -212,13 +212,16 @@ local function flush_vf_packet(pos_h,pos_v,pos_r,font,char,data,factor,vfcommand local fonts = data.fonts local siz = (data.parameters.factor or 1)/65536 +-- siz = siz * data.parameters.size / 1000 + local function flushchar(font,char,fnt,chr,f,e) if fnt then local nest = char ~= chr or font ~= fnt if fnt == 0 then fnt = main end - return flush_character(false,fnt,chr,factor,nest,pos_h,pos_v,pos_r,f,e) +-- return flush_character(false,fnt,chr,factor,nest,pos_h,pos_v,pos_r,f,e) + return flush_character(current,fnt,chr,factor,nest,pos_h,pos_v,pos_r,f,e) else return 0 end @@ -433,7 +436,7 @@ flush_character = function(current,font,char,factor,vfcommands,pos_h,pos_v,pos_r pos_h = pos_h - width -- here ? end if vfcommands then - flush_vf_packet(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) -- also f ? else -- kind of messy that we do orientation here and offsets elsewhere local orientation = data.orientation @@ -717,7 +720,7 @@ local hlist_out, vlist_out do else if tospace and subtype == spaceskip_code then -- todo: flush_space - flush_character(false,getfont(current),32,false,true,pos_h,pos_v,pos_r) + flush_character(false,getfont(current),32,false,true,pos_h,pos_v,pos_r) -- we need tp pass current for scale? end cur_h = cur_h + gluewidth end diff --git a/tex/context/base/mkxl/font-ini.mklx b/tex/context/base/mkxl/font-ini.mklx index b186b8a02..59dea4024 100644 --- a/tex/context/base/mkxl/font-ini.mklx +++ b/tex/context/base/mkxl/font-ini.mklx @@ -2512,4 +2512,19 @@ \permanent\protected\def\usefontpath[#1]% {\clf_addfontpath{#1}} +%D Experiment: + +\installcorenamespace{scaledfont} + +\installcommandhandler \??scaledfont {scaledfont} \??scaledfont + +\appendtoks + \frozen\protected\edefcsname\currentscaledfont\endcsname + {\glyphscale\scaledfontparameter\c!scale\relax + \begincsname\scaledfontparameter\c!style\endcsname} +\to \everydefinescaledfont + +\setupscaledfont + [\c!scale=1000] + \protect \endinput diff --git a/tex/context/base/mkxl/font-lib.mklx b/tex/context/base/mkxl/font-lib.mklx index 1d7d4d1e5..940141fe7 100644 --- a/tex/context/base/mkxl/font-lib.mklx +++ b/tex/context/base/mkxl/font-lib.mklx @@ -44,6 +44,7 @@ \registerctxluafile{font-otj}{autosuffix,optimize} \registerctxluafile{font-oup}{} \registerctxluafile{font-ota}{autosuffix} +% \registerctxluafile{font-ots-pre-scale}{autosuffix,optimize} \registerctxluafile{font-ots}{autosuffix,optimize} \registerctxluafile{font-otd}{optimize} \registerctxluafile{font-otc}{} diff --git a/tex/context/base/mkxl/font-otj.lmt b/tex/context/base/mkxl/font-otj.lmt index 7661695b5..77e6707f3 100644 --- a/tex/context/base/mkxl/font-otj.lmt +++ b/tex/context/base/mkxl/font-otj.lmt @@ -58,7 +58,7 @@ fonts = fonts local hashes = fonts.hashes local fontdata = hashes.identifiers local fontmarks = hashes.marks ------ parameters = fonts.hashes.parameters -- not in generic +local parameters = fonts.hashes.parameters -- not in generic ----- resources = fonts.hashes.resources -- not in generic nodes.injections = nodes.injections or { } @@ -87,12 +87,14 @@ local getid = nuts.getid local getfont = nuts.getfont local getchar = nuts.getchar local getoffsets = nuts.getoffsets +local getscale = nuts.getscale 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 @@ -110,8 +112,8 @@ local insert_node_after = nuts.insert_after local properties = nodes.properties.data -local fontkern = nuts.pool and nuts.pool.fontkern -- context -local italickern = nuts.pool and nuts.pool.italickern -- context +local fontkern = nuts.pool and nuts.pool.fontkern +local italickern = nuts.pool and nuts.pool.italickern local useitalickerns = false -- context only @@ -122,34 +124,6 @@ directives.register("fonts.injections.useitalics", function(v) useitalickerns = v end) -if not fontkern then -- generic - - local thekern = nuts.new("kern",0) -- fontkern - local setkern = nuts.setkern - local copy_node = nuts.copy_node - - fontkern = function(k) - local n = copy_node(thekern) - setkern(n,k) - return n - end - -end - -if not italickern then -- generic - - local thekern = nuts.new("kern",3) -- italiccorrection - local setkern = nuts.setkern - local copy_node = nuts.copy_node - - italickern = function(k) - local n = copy_node(thekern) - setkern(n,k) - return n - end - -end - function injections.installnewkern() end -- obsolete local nofregisteredkerns = 0 @@ -641,6 +615,10 @@ 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") @@ -659,7 +637,8 @@ local function inject_kerns_only(head,where) while current do -- local next = getnext(current) -- local char, id = ischar(current) - local next, char, id = isnextchar(current) + -- local next, char, id = isnextchar(current) + local next, char, id = isnextglyph(current) if char then local p = rawget(properties,current) if p then @@ -668,6 +647,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) if prev and getid(prev) == glue_code then if useitalickerns then head = insert_node_before(head,current,italickern(leftkern)) @@ -686,6 +666,7 @@ local function inject_kerns_only(head,where) if i then local leftkern = i.leftkern if leftkern and leftkern ~= 0 then +leftkern = leftkern * getscale(current) setlink(posttail,fontkern(leftkern)) done = true end @@ -696,6 +677,7 @@ local function inject_kerns_only(head,where) if i then local leftkern = i.leftkern if leftkern and leftkern ~= 0 then +leftkern = leftkern * getscale(current) setlink(replacetail,fontkern(leftkern)) done = true end @@ -706,6 +688,7 @@ local function inject_kerns_only(head,where) -- glyph|disc|glyph (special case) local leftkern = i.leftkern if leftkern and leftkern ~= 0 then +leftkern = leftkern * getscale(current) replace = fontkern(leftkern) done = true end @@ -734,6 +717,7 @@ local function inject_kerns_only(head,where) if i then local leftkern = i.leftkern if leftkern and leftkern ~= 0 then +leftkern = leftkern * getscale(n) pre = insert_node_before(pre,n,fontkern(leftkern)) done = true end @@ -750,6 +734,7 @@ local function inject_kerns_only(head,where) if i then local leftkern = i.leftkern if leftkern and leftkern ~= 0 then +leftkern = leftkern * getscale(n) post = insert_node_before(post,n,fontkern(leftkern)) done = true end @@ -766,6 +751,7 @@ local function inject_kerns_only(head,where) if i then local leftkern = i.leftkern if leftkern and leftkern ~= 0 then +leftkern = leftkern * getscale(n) replace = insert_node_before(replace,n,fontkern(leftkern)) done = true end @@ -815,7 +801,8 @@ local function inject_positions_only(head,where) while current do -- local next = getnext(current) -- local char, id = ischar(current) - local next, char, id = isnextchar(current) + -- local next, char, id = isnextchar(current) + local next, char, id = isnextglyph(current) if char then local p = rawget(properties,current) if p then @@ -824,11 +811,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) setoffsets(current,false,yoffset) end local leftkern = i.leftkern local rightkern = i.rightkern if leftkern and leftkern ~= 0 then +leftkern = leftkern * getscale(current) if rightkern and leftkern == -rightkern then setoffsets(current,leftkern,false) rightkern = 0 @@ -843,6 +832,7 @@ local function inject_positions_only(head,where) end end if rightkern and rightkern ~= 0 then +rightkern = rightkern * getscale(current) if next and getid(next) == glue_code then if useitalickerns then insert_node_after(head,current,italickern(rightkern)) @@ -864,6 +854,7 @@ local function inject_positions_only(head,where) -- error, we expect an empty one else -- KE setfield(next,"replace",fontkern(rightkern)) -- maybe also leftkern +rightkern = rightkern * getscale(current) replace = fontkern(rightkern) -- maybe also leftkern done = true --KE end @@ -878,6 +869,7 @@ local function inject_positions_only(head,where) if i then local leftkern = i.leftkern if leftkern and leftkern ~= 0 then +leftkern = leftkern * getscale(current) setlink(posttail,fontkern(leftkern)) done = true end @@ -888,6 +880,7 @@ local function inject_positions_only(head,where) if i then local leftkern = i.leftkern if leftkern and leftkern ~= 0 then +leftkern = leftkern * getscale(current) setlink(replacetail,fontkern(leftkern)) done = true end @@ -898,6 +891,7 @@ local function inject_positions_only(head,where) -- new .. okay? local leftkern = i.leftkern if leftkern and leftkern ~= 0 then +leftkern = leftkern * getscale(current) replace = fontkern(leftkern) done = true end @@ -925,15 +919,18 @@ local function inject_positions_only(head,where) if i then local yoffset = i.yoffset if yoffset and yoffset ~= 0 then +yoffset = yoffset * getscale(current) setoffsets(n,false,yoffset) end local leftkern = i.leftkern if leftkern and leftkern ~= 0 then +leftkern = leftkern * getscale(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) insert_node_after(pre,n,fontkern(rightkern)) done = true end @@ -950,15 +947,18 @@ local function inject_positions_only(head,where) if i then local yoffset = i.yoffset if yoffset and yoffset ~= 0 then +yoffset = yoffset * getscale(current) setoffsets(n,false,yoffset) end local leftkern = i.leftkern if leftkern and leftkern ~= 0 then +leftkern = leftkern * getscale(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) insert_node_after(post,n,fontkern(rightkern)) done = true end @@ -975,15 +975,18 @@ local function inject_positions_only(head,where) if i then local yoffset = i.yoffset if yoffset and yoffset ~= 0 then +yoffset = yoffset * getscale(current) setoffsets(n,false,yoffset) end local leftkern = i.leftkern if leftkern and leftkern ~= 0 then +leftkern = leftkern * getscale(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) insert_node_after(replace,n,fontkern(rightkern)) done = true end @@ -1000,6 +1003,7 @@ local function inject_positions_only(head,where) -- glyph|pre glyphs local rightkern = i.rightkern if rightkern and rightkern ~= 0 then +rightkern = rightkern * getscale(prevglyph) pre = insert_node_before(pre,pre,fontkern(rightkern)) done = true end @@ -1014,6 +1018,7 @@ local function inject_positions_only(head,where) -- glyph|replace glyphs local rightkern = i.rightkern if rightkern and rightkern ~= 0 then +rightkern = rightkern * getscale(prevglyph) replace = insert_node_before(replace,replace,fontkern(rightkern)) done = true end @@ -1160,6 +1165,8 @@ local function inject_everything(head,where) oy = oy + yoffset -- husayni needs it end end +ox = ox * getscale(p) +oy = oy * getscale(p) setoffsets(n,ox,oy) if trace_marks then showoffset(n,true) @@ -1171,7 +1178,8 @@ local function inject_everything(head,where) while current do -- local next = getnext(current) -- local char, id = ischar(current) - local next, char, id = isnextchar(current) + -- local next, char, id = isnextchar(current) + local next, char, id = isnextglyph(current) if char then local p = rawget(properties,current) -- begin of temp fix -- @@ -1238,6 +1246,7 @@ local function inject_everything(head,where) else local yoffset = i.yoffset if yoffset and yoffset ~= 0 then +yoffset = yoffset * getscale(current) setoffsets(current,false,yoffset) end if hascursives then @@ -1265,6 +1274,7 @@ local function inject_everything(head,where) for i=maxc,minc,-1 do local ti = glyphs[i] ny = ny + properties[ti].cursivedy +* getscale(current) setoffsets(ti,false,ny) -- why not add ? if trace_cursive then showoffset(ti) @@ -1281,6 +1291,7 @@ local function inject_everything(head,where) for i=maxc,minc,-1 do local ti = glyphs[i] ny = ny + properties[ti].cursivedy +* getscale(current) setoffsets(ti,false,ny) -- why not add ? if trace_cursive then showoffset(ti) @@ -1295,6 +1306,7 @@ local function inject_everything(head,where) local leftkern = i.leftkern local rightkern = i.rightkern if leftkern and leftkern ~= 0 then +leftkern = leftkern * getscale(current) if rightkern and leftkern == -rightkern then setoffsets(current,leftkern,false) rightkern = 0 @@ -1309,6 +1321,7 @@ local function inject_everything(head,where) end end if rightkern and rightkern ~= 0 then +rightkern = rightkern * getscale(current) if next and getid(next) == glue_code then if useitalickerns then insert_node_after(head,current,italickern(rightkern)) @@ -1330,6 +1343,7 @@ local function inject_everything(head,where) if replace then -- error, we expect an empty one else +rightkern = rightkern * getscale(current) replace = fontkern(rightkern) done = true end @@ -1345,6 +1359,7 @@ local function inject_everything(head,where) if i then local leftkern = i.leftkern if leftkern and leftkern ~= 0 then +leftkern = leftkern * getscale(current) setlink(posttail,fontkern(leftkern)) done = true end @@ -1355,6 +1370,7 @@ local function inject_everything(head,where) if i then local leftkern = i.leftkern if leftkern and leftkern ~= 0 then +leftkern = leftkern * getscale(current) setlink(replacetail,fontkern(leftkern)) done = true end @@ -1364,6 +1380,7 @@ local function inject_everything(head,where) if i then local leftkern = i.leftkern if leftkern and leftkern ~= 0 then +leftkern = leftkern * getscale(current) replace = fontkern(leftkern) done = true end @@ -1381,6 +1398,7 @@ local function inject_everything(head,where) for i=maxc,minc,-1 do local ti = glyphs[i] ny = ny + properties[ti].cursivedy +* getscale(current) local xi, yi = getoffsets(ti) setoffsets(ti,xi,yi + ny) -- can be mark, we could use properties end @@ -1411,11 +1429,13 @@ local function inject_everything(head,where) end local leftkern = i.leftkern if leftkern and leftkern ~= 0 then +leftkern = leftkern * getscale(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) insert_node_after(pre,n,fontkern(rightkern)) done = true end @@ -1442,11 +1462,13 @@ local function inject_everything(head,where) end local leftkern = i.leftkern if leftkern and leftkern ~= 0 then +leftkern = leftkern * getscale(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) insert_node_after(post,n,fontkern(rightkern)) done = true end @@ -1473,11 +1495,13 @@ local function inject_everything(head,where) end local leftkern = i.leftkern if leftkern and leftkern ~= 0 then +leftkern = leftkern * getscale(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) insert_node_after(replace,n,fontkern(rightkern)) done = true end @@ -1500,6 +1524,7 @@ local function inject_everything(head,where) -- glyph|pre glyphs local rightkern = i.rightkern if rightkern and rightkern ~= 0 then +rightkern = rightkern * getscale(prevglyph) pre = insert_node_before(pre,pre,fontkern(rightkern)) done = true end @@ -1514,6 +1539,7 @@ local function inject_everything(head,where) -- glyph|replace glyphs local rightkern = i.rightkern if rightkern and rightkern ~= 0 then +rightkern = rightkern * getscale(prevglyph) replace = insert_node_before(replace,replace,fontkern(rightkern)) done = true end @@ -1585,35 +1611,16 @@ function nodes.injections.setspacekerns(font,sequence) end end -local getthreshold - -if context then +local threshold = 1 -- todo: add a few methods for context - local threshold = 1 -- todo: add a few methods for context - local parameters = fonts.hashes.parameters - - directives.register("otf.threshold", function(v) threshold = tonumber(v) or 1 end) - - getthreshold = function(font) - local p = parameters[font] - local f = p.factor - local s = p.spacing - local t = threshold * (s and s.width or p.space or 0) - 2 - return t > 0 and t or 0, f - end - -else - - injections.threshold = 0 - - getthreshold = function(font) - local p = fontdata[font].parameters - local f = p.factor - local s = p.spacing - local t = injections.threshold * (s and s.width or p.space or 0) - 2 - return t > 0 and t or 0, f - end +directives.register("otf.threshold", function(v) threshold = tonumber(v) or 1 end) +local getthreshold = function(font) + local p = parameters[font] + local f = p.factor + local s = p.spacing + local t = threshold * (s and s.width or p.space or 0) - 2 + return t > 0 and t or 0, f end injections.getthreshold = getthreshold @@ -1670,6 +1677,8 @@ local function injectspaces(head) local leftkern = false local rightkern = false +local scale = 1 + local function updatefont(font,trig) leftkerns = trig.left rightkerns = trig.right @@ -1692,6 +1701,7 @@ local function injectspaces(head) if rightkerns then rightkern = rightkerns[nextchar] end + scale = getscale(next) end end if prevchar then @@ -1704,6 +1714,7 @@ local function injectspaces(head) if leftkerns then leftkern = leftkerns[prevchar] end + scale = getscale(prev) end end if leftkern then @@ -1716,6 +1727,8 @@ local function injectspaces(head) if trace_spaces then report_spaces("%C [%p + %p + %p] %C",prevchar,lnew,old,rnew,nextchar) end +lnew = lnew * scale +rnew = rnew * scale head = insert_node_before(head,n,italickern(lnew)) insert_node_after(head,n,italickern(rnew)) else @@ -1732,9 +1745,11 @@ local function injectspaces(head) if trace_spaces then report_spaces("%C [%p + %p]",prevchar,old,new) end +new = new * scale insert_node_after(head,n,italickern(new)) -- tricky with traverse but ok else - local new = old + leftkern * factor +-- local new = old + leftkern * factor +local new = old + leftkern * factor * scale if trace_spaces then report_spaces("%C [%p -> %p]",prevchar,old,new) end @@ -1748,12 +1763,14 @@ local function injectspaces(head) if old > threshold then if useitalickerns then local new = rightkern * factor +new = new * scale 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 +local new = old + rightkern * factor * scale 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 b34dfa847..bd70d6d47 100644 --- a/tex/context/base/mkxl/font-ots.lmt +++ b/tex/context/base/mkxl/font-ots.lmt @@ -205,6 +205,7 @@ local setlink = nuts.setlink local getwidth = nuts.getwidth local getglyphdata = nuts.getglyphdata +local getscale = nuts.getscale --------------------------------------------------------------------------------------- @@ -293,6 +294,7 @@ local descriptions = false local marks = false local classes = false local currentfont = false +local currentattr = false local factor = 0 local threshold = 0 local checkmarks = false @@ -759,8 +761,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 char = ischar(current,currentfont) - local nxt, char = isnextchar(current,currentfont) + local nxt, char = isnextchar(current,currentfont,currentattr) if char then local lg = ligature[char] if lg then @@ -794,10 +795,10 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip local discfound = false local hasmarks = marks[startchar] while current do - local char, id = ischar(current,currentfont) + local nxt, char, id = isnextchar(current,currentfont,currentattr) if char then if skiphash and skiphash[char] then - current = getnext(current) + current = nxt else local lg = ligature[char] if lg then @@ -806,7 +807,7 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip end stop = current -- needed for fake so outside then ligature = lg - current = getnext(current) + current = nxt else break end @@ -829,20 +830,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) + local char = ischar(replace,currentfont,currentattr) if char and ligature[char] then match = true end end if not match and pre then - local char = ischar(pre,currentfont) + local char = ischar(pre,currentfont,currentattr) 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) + local char = ischar(n,currentfont,currentattr) if char and ligature[char] then match = true end @@ -946,7 +947,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) + local nextchar = ischar(snext,currentfont,currentattr) if nextchar then if skiphash and skiphash[nextchar] then -- includes marks too when flag prev = snext @@ -1012,13 +1013,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) + local basechar = ischar(base,currentfont,currentattr) if basechar then if marks[basechar] then while base do base = getprev(base) if base then - basechar = ischar(base,currentfont) + basechar = ischar(base,currentfont,currentattr) if basechar then if not marks[basechar] then break @@ -1067,13 +1068,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) + local basechar = ischar(base,currentfont,currentattr) if basechar then if marks[basechar] then while base do base = getprev(base) if base then - basechar = ischar(base,currentfont) + basechar = ischar(base,currentfont,currentattr) if basechar then if not marks[basechar] then break @@ -1143,7 +1144,7 @@ function handlers.gpos_mark2mark(head,start,dataset,sequence,markanchors,rlmode, end end if base then - local basechar = ischar(base,currentfont) + local basechar = ischar(base,currentfont,currentattr) 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 @@ -1172,7 +1173,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) + local nextchar = ischar(nxt,currentfont,currentattr) if not nextchar then break elseif marks[nextchar] then -- always sequence.flags[1] @@ -1462,23 +1463,51 @@ function chainprocs.gsub_ligature(head,start,stop,dataset,sequence,currentlookup local nofreplacements = 1 while current do -- todo: ischar ... can there really be disc nodes here? - local id = getid(current) - if id == disc_code then - if not discfound then - discfound = current - end - if current == stop then - break -- okay? or before the disc - else - current = getnext(current) - end - else - local schar = getchar(current) +-- local id = getid(current) +-- if id == disc_code then +-- if not discfound then +-- discfound = current +-- end +-- if current == stop then +-- break -- okay? or before the disc +-- else +-- current = getnext(current) +-- end +-- else +-- local schar = getchar(current) +-- if skiphash and skiphash[schar] then -- marks +-- -- if current == stop then -- maybe add this +-- -- break +-- -- else +-- current = getnext(current) +-- -- end +-- else +-- local lg = ligatures[schar] +-- if lg then +-- ligatures = lg +-- last = current +-- nofreplacements = nofreplacements + 1 +-- if marks[char] then +-- hasmarks = true +-- end +-- if current == stop then +-- break +-- else +-- current = getnext(current) +-- end +-- else +-- break +-- end +-- end +-- end + -- + local nxt, schar, id = isnextchar(current,currentfont,currentattr) + if schar then if skiphash and skiphash[schar] then -- marks -- if current == stop then -- maybe add this -- break -- else - current = getnext(current) + current = nxt -- end else local lg = ligatures[schar] @@ -1492,13 +1521,25 @@ function chainprocs.gsub_ligature(head,start,stop,dataset,sequence,currentlookup if current == stop then break else - current = getnext(current) + current = nxt end else break end end + elseif id == disc_code then + if not discfound then + discfound = current + end + if current == stop then + break -- okay? or before the disc + else + current = nxt + end + else + break end + -- end local ligature = ligatures.ligature if ligature then @@ -1569,7 +1610,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) + local nextchar = ischar(snext,currentfont,currentattr) if not nextchar then break end @@ -1638,13 +1679,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) + local basechar = ischar(base,currentfont,currentattr) if basechar then if marks[basechar] then while base do base = getprev(base) if base then - local basechar = ischar(base,currentfont) + local basechar = ischar(base,currentfont,currentattr) if basechar then if not marks[basechar] then break @@ -1703,13 +1744,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) + local basechar = ischar(base,currentfont,currentattr) if basechar then if marks[basechar] then while base do base = getprev(base) if base then - local basechar = ischar(base,currentfont) + local basechar = ischar(base,currentfont,currentattr) if basechar then if not marks[basechar] then break @@ -1783,7 +1824,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) + local basechar = ischar(base,currentfont,currentattr) if basechar then local ba = markanchors[1][basechar] if ba then @@ -1829,7 +1870,7 @@ function chainprocs.gpos_cursive(head,start,stop,dataset,sequence,currentlookup, else local nxt = getnext(start) while nxt do - local nextchar = ischar(nxt,currentfont) + local nextchar = ischar(nxt,currentfont,currentattr) if not nextchar then break elseif marks[nextchar] then @@ -2004,7 +2045,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) + local char = ischar(start,currentfont,currentattr) if char then if skiphash and skiphash[char] then start = getnext(start) @@ -2265,7 +2306,7 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) local insertedmarks = 0 while cprev do - local char = ischar(cf,currentfont) + local char = ischar(cf,currentfont,currentattr) if char and marks[char] then insertedmarks = insertedmarks + 1 cf = cprev @@ -2331,7 +2372,7 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) local insertedmarks = 0 while cnext do - local char = ischar(cnext,currentfont) + local char = ischar(cnext,currentfont,currentattr) if char and marks[char] then insertedmarks = insertedmarks + 1 cl = cnext @@ -2441,6 +2482,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s checkdisc = getprev(head) end local currentfont = currentfont + local currentattr = currentattr local skipped -- = false @@ -2459,7 +2501,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) -- only needed in a chain + local startchar = nofcontext == 1 or ischar(start,currentfont,currentattr) -- only needed in a chain for k=1,nofcontexts do -- does this disc mess work well with n > 1 @@ -2493,7 +2535,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) + local nxt, char, id = isnextchar(last,currentfont,currentattr) if char then if skiphash and skiphash[char] then skipped = true @@ -2606,7 +2648,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) + local prv, char, id = isprevchar(prev,currentfont,currentattr) if char then if skiphash and skiphash[char] then skipped = true @@ -2744,7 +2786,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) + local nxt, char, id = isnextchar(current,currentfont,currentattr) if char then if skiphash and skiphash[char] then skipped = true @@ -3381,6 +3423,46 @@ 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) @@ -3496,6 +3578,24 @@ local function k_run_single(sub,injection,last,font,attr,lookupcache,step,datase end end +-- local function k_run_single(sub,injection,last,font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler) +-- for n in nextnode, sub do -- only gpos +-- if n == last then +-- break +-- end +-- local char = ischar(n,font,attr) +-- if char then +-- local lookupmatch = lookupcache[char] +-- if lookupmatch then +-- local h, d, ok = handler(sub,n,dataset,sequence,lookupmatch,rlmode,skiphash,step,injection) +-- if ok then +-- return true +-- end +-- end +-- end +-- end +-- end + local function c_run_multiple(head,font,attr,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) local done = false local sweep = sweephead[head] @@ -3761,6 +3861,8 @@ do 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 @@ -3862,6 +3964,7 @@ do a = getglyphdata(start) end if not a or (a == attr) then +currentattr = getscale(start) for i=m[1],m[2] do local step = steps[i] -- for i=1,#m do @@ -3915,6 +4018,7 @@ do a = true end 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 @@ -3991,6 +4095,7 @@ do a = true end if a then +currentattr = getscale(start) local ok, df for i=m[1],m[2] do local step = steps[i] @@ -4083,6 +4188,7 @@ do function otf.datasetpositionprocessor(head,font,direction,dataset) currentfont = font + 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 diff --git a/tex/context/base/mkxl/lpdf-lmt.lmt b/tex/context/base/mkxl/lpdf-lmt.lmt index 28cfff41d..dd64f0107 100644 --- a/tex/context/base/mkxl/lpdf-lmt.lmt +++ b/tex/context/base/mkxl/lpdf-lmt.lmt @@ -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 +local f_pdf_cur, f_pdf, fs_cur, fs, f_cur, f_scale local tj_delta, cw local usedfonts, usedxforms, usedximages, usedxgroups local getxformname, getximagename @@ -145,6 +145,7 @@ local function reset_variables(specification) f_pdf = 0 -- nullfont fs_cur = 0 fs = 0 + f_scale = 1.0 cur_factor = 0 cur_f = false cur_e = false @@ -193,6 +194,7 @@ local function updatefontstate(font) pdfcharacters = usedcharacters[font] horizontalmode = fontparameters.writingmode ~= "vertical" scalefactor = (designsize/size) * tjfactor + -- local fthreshold = fontproperties.threshold threshold = (fthreshold and (size * fthreshold / 100)) or 655360 -- when we bolden the threshold should be smaller .. a hack .. i need to redo all this @@ -468,7 +470,7 @@ local flushcharacter do return v end) - local function setup_fontparameters(font,factor,f,e) + local function setup_fontparameters(font,factor,f,e,s) local slant = fontparameters.slantfactor or 0 local extend = fontparameters.extendfactor or 1 local squeeze = fontparameters.squeezefactor or 1 @@ -489,6 +491,7 @@ local flushcharacter do cur_f = f cur_e = e tj_delta = 0 + f_scale = 1.0 fs = fontparameters.size * bpfactor if f then fs = fs * f @@ -498,6 +501,11 @@ 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 +end + -- naturalwidth = naturalwidths[font] -- hshift = fontparameters.hshift @@ -578,17 +586,35 @@ local flushcharacter do -- 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) - if need_tf or font ~= f_cur or f_pdf ~= f_pdf_cur or fs ~= fs_cur or mode == "page" then + +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 + +-- 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 pdf_goto_textmode() - setup_fontparameters(font,factor,f,e) + setup_fontparameters(font,factor,f,e,s) 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) + setup_fontparameters(font,factor,f,e,s) need_tm = true end + local move = calc_pdfpos(pos_h,pos_v) + -- if trace_threshold then -- report( -- "font %i, char %C, factor %i, naturalwidth %p, move %l, tm %l, hpos %p, delta %p, threshold %p, cw %p", @@ -624,6 +650,7 @@ local flushcharacter do end if move then local d = tj_delta * scalefactor + / f_scale if d <= -0.5 or d >= 0.5 then if mode == "char" then end_charmode() @@ -638,7 +665,12 @@ local flushcharacter do begin_charmode() end - cw = cw + naturalwidth[char] * tmef +-- cw = cw + naturalwidth[char] * tmef +cw = cw + naturalwidth[char] * tmef * f_scale + +-- if f_scale ~= 1.0 then +-- cw = cw * f_scale +-- end local index = data.index or char @@ -2843,7 +2875,7 @@ do -- updaters.register("backend.update.lpdf",function() flushimage(index,wd,ht,dp,pos_h,pos_v) end - local function pdfvfimage(wd,ht,dp,data,name) + function lpdf.pdfvfimage(wd,ht,dp,data,name) if type(data) == "number" then return { "lua", function(font,char,pos_h,pos_v) vfimage_n(name,data,wd,ht,dp,pos_h,pos_v) @@ -2856,8 +2888,6 @@ do -- updaters.register("backend.update.lpdf",function() end end - lpdf.vfimage = pdfvfimage - end -- ) -- The driver. diff --git a/tex/context/base/mkxl/lpdf-rul.lmt b/tex/context/base/mkxl/lpdf-rul.lmt index b3df0f0b7..ae2142a8e 100644 --- a/tex/context/base/mkxl/lpdf-rul.lmt +++ b/tex/context/base/mkxl/lpdf-rul.lmt @@ -101,7 +101,7 @@ def RuleColor = %color% enddef ; local initialized = false ; - rule_mp = function(p,h,v,i,n) + local rule_mp = function(p,h,v,i,n) local name = p.name or "fake:rest" local code = (predefined[name] or predefined["fake:rest"]) { data = p.data or "", @@ -134,7 +134,7 @@ def RuleColor = %color% enddef ; end updaters.register("backend.update.lpdf",function() - ruleactions.mp = rule_mp + ruleactions.mp = rule_mp end) end diff --git a/tex/context/base/mkxl/luat-usr.mkxl b/tex/context/base/mkxl/luat-usr.mkxl index 8c43a5a72..c32a030b2 100644 --- a/tex/context/base/mkxl/luat-usr.mkxl +++ b/tex/context/base/mkxl/luat-usr.mkxl @@ -79,9 +79,11 @@ % \definenamedlua[module][module instance] % not needed -\definenamedlua[user] [private user] -\definenamedlua[third] [third party module] -\definenamedlua[isolated][isolated] +\appendtoks + \definenamedlua[user] [private user] + \definenamedlua[third] [third party module] + \definenamedlua[isolated][isolated] +\to \everyjob %D In practice this works out as follows: %D diff --git a/tex/context/base/mkxl/mlib-ran.lmt b/tex/context/base/mkxl/mlib-ran.lmt index cb8645e8d..a6d4fbe5b 100644 --- a/tex/context/base/mkxl/mlib-ran.lmt +++ b/tex/context/base/mkxl/mlib-ran.lmt @@ -128,7 +128,7 @@ local f_macros = { [4] = formatters["%s(%N,%N,%i,%i);"], } -function grid_to_mp(t,f,n) +local function grid_to_mp(t,f,n) local grid = t.grid local count = t.count local result = { } diff --git a/tex/context/base/mkxl/node-nut.lmt b/tex/context/base/mkxl/node-nut.lmt index 61c9a9739..f3926de7f 100644 --- a/tex/context/base/mkxl/node-nut.lmt +++ b/tex/context/base/mkxl/node-nut.lmt @@ -97,6 +97,7 @@ local nuts = { getnormalizedline = direct.getnormalizedline, getnucleus = direct.getnucleus, getoffsets = direct.getoffsets, + getscale = direct.getscale, getorientation = direct.getorientation, getoptions = direct.getoptions, getpenalty = direct.getpenalty, @@ -133,6 +134,8 @@ local nuts = { ischar = direct.is_char, isprevchar = direct.is_prev_char, isnextchar = direct.is_next_char, + isprevglyph = direct.is_prev_glyph, + isnextglyph = direct.is_next_glyph, isglyph = direct.is_glyph, kerning = direct.kerning, last_node = direct.last_node, diff --git a/tex/context/base/mkxl/syst-fnt.mkxl b/tex/context/base/mkxl/syst-fnt.mkxl index f0f023f6e..e6029d805 100644 --- a/tex/context/base/mkxl/syst-fnt.mkxl +++ b/tex/context/base/mkxl/syst-fnt.mkxl @@ -15,21 +15,21 @@ \unprotect -\immutable\protected\def\fontslantperpoint {\fontdimen\plusone } -\immutable\protected\def\fontinterwordspace {\fontdimen\plustwo } -\immutable\protected\def\fontinterwordstretch{\fontdimen\plusthree} -\immutable\protected\def\fontinterwordshrink {\fontdimen\plusfour } -\immutable\protected\def\fontexheight {\fontdimen\plusfive } -\immutable\protected\def\fontemwidth {\fontdimen\plussix } -\immutable\protected\def\fontextraspace {\fontdimen\plusseven} - -\immutable\protected\def\slantperpoint {\fontdimen\plusone \font} -\immutable\protected\def\interwordspace {\fontdimen\plustwo \font} -\immutable\protected\def\interwordstretch {\fontdimen\plusthree\font} -\immutable\protected\def\interwordshrink {\fontdimen\plusfour \font} -\immutable\protected\def\exheight {\fontdimen\plusfive \font} -\immutable\protected\def\emwidth {\fontdimen\plussix \font} -\immutable\protected\def\extraspace {\fontdimen\plusseven\font} +\immutable\protected\def\fontslantperpoint {\scaledfontdimen\plusone } +\immutable\protected\def\fontinterwordspace {\scaledfontdimen\plustwo } +\immutable\protected\def\fontinterwordstretch{\scaledfontdimen\plusthree} +\immutable\protected\def\fontinterwordshrink {\scaledfontdimen\plusfour } +\immutable\protected\def\fontexheight {\scaledfontdimen\plusfive } +\immutable\protected\def\fontemwidth {\scaledfontdimen\plussix } +\immutable\protected\def\fontextraspace {\scaledfontdimen\plusseven} + +\immutable\protected\def\slantperpoint {\scaledfontdimen\plusone \font} +\immutable\protected\def\interwordspace {\scaledfontdimen\plustwo \font} +\immutable\protected\def\interwordstretch {\scaledfontdimen\plusthree\font} +\immutable\protected\def\interwordshrink {\scaledfontdimen\plusfour \font} +\immutable\protected\def\exheight {\scaledfontdimen\plusfive \font} +\immutable\protected\def\emwidth {\scaledfontdimen\plussix \font} +\immutable\protected\def\extraspace {\scaledfontdimen\plusseven\font} \aliased\let\mathaxisheight\Umathaxis % takes style diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 2b9335285..1499dd908 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-21 09:32 +-- merge date : 2020-12-22 22:09 do -- begin closure to overcome local limits and interference @@ -16850,7 +16850,7 @@ local function readfirst(f,offset) end return { readushort(f) } end -function readarray(f,offset) +local function readarray(f,offset) if offset then setposition(f,offset) end -- cgit v1.2.3