From 898d8e12e219efa15e367285cee56cab77f84339 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Wed, 4 Aug 2021 18:47:30 +0200 Subject: 2021-08-04 17:50:00 --- tex/generic/context/luatex/luatex-fonts-merged.lua | 21 ++++++++++++++++----- tex/generic/context/luatex/luatex-mplib.lua | 5 +++-- 2 files changed, 19 insertions(+), 7 deletions(-) (limited to 'tex/generic') diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index a87c6272c..415ca193a 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 : 2021-07-30 00:41 +-- merge date : 2021-08-04 17:48 do -- begin closure to overcome local limits and interference @@ -2255,9 +2255,12 @@ function io.copydata(source,target,action) flush() end end -function io.savedata(filename,data,joiner) - local f=open(filename,"wb") +function io.savedata(filename,data,joiner,append) + local f=open(filename,append and "ab" or "wb") if f then + if append and joiner and f:seek("end")>0 then + f:write(joiner) + end if type(data)=="table" then f:write(concat(data,joiner or "")) elseif type(data)=="function" then @@ -3118,7 +3121,7 @@ if not modules then modules={} end modules ['util-str']={ utilities=utilities or {} utilities.strings=utilities.strings or {} local strings=utilities.strings -local format,gsub,rep,sub,find=string.format,string.gsub,string.rep,string.sub,string.find +local format,gsub,rep,sub,find,char=string.format,string.gsub,string.rep,string.sub,string.find,string.char local load,dump=load,string.dump local tonumber,type,tostring,next,setmetatable=tonumber,type,tostring,next,setmetatable local unpack,concat=table.unpack,table.concat @@ -3471,12 +3474,20 @@ local template=[[ return function(%s) return %s end ]] local pattern=Cs(Cc('"')*( - (1-S('"\\\n\r'))^1+P('"')/'\\"'+P('\\')/'\\\\'+P('\n')/'\\n'+P('\r')/'\\r' + (1-S('"\\\n\r'))^1+P('"')/'\\034'+P('\\')/'\\020'+P('\n')/'\\013'+P('\r')/'\\010' )^0*Cc('"')) patterns.escapedquotes=pattern function string.escapedquotes(s) return lpegmatch(pattern,s) end +local pattern=(1-P("\\"))^1;pattern=Cs ( + pattern*((P("\\")/""*(digit^-3/function(s) return char(tonumber(s)) end))+pattern )^1 +) +patterns.unescapedquotes=pattern +function string.unescapedquotes(s) + return lpegmatch(pattern,s) or s +end +string.texnewlines=lpeg.replacer(patterns.newline,"\r",true) local preamble="" local environment={ global=global or _G, diff --git a/tex/generic/context/luatex/luatex-mplib.lua b/tex/generic/context/luatex/luatex-mplib.lua index c251d88c3..1839c44ee 100644 --- a/tex/generic/context/luatex/luatex-mplib.lua +++ b/tex/generic/context/luatex/luatex-mplib.lua @@ -350,8 +350,9 @@ else if how == "image" then tex.sprint(format("\\MPLIBpdftext{%s}{%s}",what,depth)) else - text = gsub(text,".","\\hbox{%1}") -- kerning happens in metapost - tex.sprint(format("\\MPLIBtextext{%s}{%s}{%s}{%s}",font,size,text,depth)) + -- text = gsub(text,".","\\hbox{%1}") -- kerning happens in metapost + -- tex.sprint(format("\\MPLIBtextext{%s}{%s}{%s}{%s}",font,size,text,depth)) + tex.sprint(format("\\MPLIBtextext{%s}{%s}{\\hpack{\\detokenize{%s}}}{%s}",font,size,text,depth)) end end -- cgit v1.2.3