From 51156ffe8b1434d9c1896f12a59554cbe877ee3d Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Sun, 7 May 2023 16:54:07 +0200 Subject: 2023-05-07 16:28:00 --- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/publ-imp-apa.mkvi | 29 +- tex/context/base/mkiv/publ-imp-aps.mkvi | 2 +- tex/context/base/mkiv/publ-imp-list.mkvi | 2 +- tex/context/base/mkiv/publ-ini.mkiv | 3 +- tex/context/base/mkiv/status-files.pdf | Bin 24657 -> 24669 bytes tex/context/base/mkiv/status-lua.pdf | Bin 271357 -> 271458 bytes tex/context/base/mkiv/util-zip.lua | 308 ++++++++++++++++----- tex/context/base/mkxl/back-exp.lmt | 4 +- tex/context/base/mkxl/cont-new.mkxl | 2 +- tex/context/base/mkxl/context.mkxl | 2 +- tex/context/base/mkxl/driv-shp.lmt | 16 +- tex/context/base/mkxl/lpdf-emb.lmt | 9 +- tex/context/base/mkxl/lpdf-lmt.lmt | 25 +- tex/context/base/mkxl/math-act.lmt | 89 ++---- tex/context/base/mkxl/math-dld.mklx | 30 +- tex/context/base/mkxl/math-fnt.lmt | 19 +- tex/context/base/mkxl/publ-ini.mkxl | 2 + tex/context/fonts/mkiv/antykwa-math.lfg | 5 +- tex/context/fonts/mkiv/iwona-math.lfg | 3 + tex/context/fonts/mkiv/kurier-math.lfg | 3 + tex/context/fonts/mkiv/pagella-math.lfg | 6 +- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 26 files changed, 360 insertions(+), 209 deletions(-) (limited to 'tex') diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index b19283ff1..121b11c87 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{2023.05.05 18:36} +\newcontextversion{2023.05.07 16:25} %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 f5ef6f059..de8d469ab 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{2023.05.05 18:36} +\edef\contextversion{2023.05.07 16:25} %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 a3bc4164e..866adbbe3 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{2023.05.05 18:36} +\newcontextversion{2023.05.07 16:25} %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 1ef4503ab..7c688a91c 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -49,7 +49,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2023.05.05 18:36} +\edef\contextversion{2023.05.07 16:25} %D Kind of special: diff --git a/tex/context/base/mkiv/publ-imp-apa.mkvi b/tex/context/base/mkiv/publ-imp-apa.mkvi index b8038bd96..65f33fa9f 100644 --- a/tex/context/base/mkiv/publ-imp-apa.mkvi +++ b/tex/context/base/mkiv/publ-imp-apa.mkvi @@ -909,7 +909,7 @@ \setmode{btx:apa:title-placed} % we make the title active, opening "file" \btxdoifelse {file} { - \texdefinition{btx:format:inject} + \texdefinition{btx:format:goto} {url(file:\btxflush{file})} { \texdefinition{btx:apa:composed-title}{title} @@ -1071,8 +1071,7 @@ \starttexdefinition mutable protected btx:apa:authoryear % we make the authoryear active, pointing to the citation - \texdefinition{btx:format:inject} - {internal(\currentbtxinternal)} + \texdefinition{btx:format:gotointernal} { \doifelsesetups{apa:list:sameauthor} { \btxdoifelsesameasprevious {author} { @@ -1287,15 +1286,11 @@ \starttexdefinition mutable protected btx:apa:url \begingroup \setbreakpoints[doi] - \ifconditional\btxinteractive - \goto { - \hyphenatedurl{\btxflush{url}} - } [ - url(\btxflush{url}) - ] - \else + \texdefinition {btx:format:goto} { + url(\btxflush{url}) + } { \hyphenatedurl{\btxflush{url}} - \fi + } \endgroup \stoptexdefinition @@ -1304,15 +1299,11 @@ \starttexdefinition mutable protected btx:apa:doi \begingroup \setbreakpoints[doi] - \ifconditional\btxinteractive - \goto { - \hyphenatedurl{doi:\btxflush{doi}} - } [ - url(http://dx.doi.org/\btxflush{doi}) - ] - \else + \texdefinition {btx:format:goto} { + url(http://dx.doi.org/\btxflush{doi}) + } { \hyphenatedurl{doi:\btxflush{doi}} - \fi + } \endgroup \stoptexdefinition diff --git a/tex/context/base/mkiv/publ-imp-aps.mkvi b/tex/context/base/mkiv/publ-imp-aps.mkvi index f6f118ada..da84c312e 100644 --- a/tex/context/base/mkiv/publ-imp-aps.mkvi +++ b/tex/context/base/mkiv/publ-imp-aps.mkvi @@ -615,7 +615,7 @@ \btxdoif {title} { % we make the title active, opening file \btxdoifelse {file} { - \texdefinition{btx:format:inject} + \texdefinition{btx:format:goto} {url(file:\btxflush{file})} { \texdefinition{btx:aps:composed-title}{title} diff --git a/tex/context/base/mkiv/publ-imp-list.mkvi b/tex/context/base/mkiv/publ-imp-list.mkvi index 5b4331eed..15ed8df82 100644 --- a/tex/context/base/mkiv/publ-imp-list.mkvi +++ b/tex/context/base/mkiv/publ-imp-list.mkvi @@ -48,7 +48,7 @@ \starttexdefinition mutable protected btx:list:numbering #variant \btxstartstyleandcolor [\currentbtxspecification:\s!list:\s!numbering:#variant] - \btxusecommand[\currentbtxspecification:\s!list:\s!numbering:#variant] { + \btxusecommand [\currentbtxspecification:\s!list:\s!numbering:#variant] { \fastsetup{\s!btx:\s!list:\s!numbering} } \btxstopstyleandcolor diff --git a/tex/context/base/mkiv/publ-ini.mkiv b/tex/context/base/mkiv/publ-ini.mkiv index fafefa781..d75006b18 100644 --- a/tex/context/base/mkiv/publ-ini.mkiv +++ b/tex/context/base/mkiv/publ-ini.mkiv @@ -1143,7 +1143,7 @@ {\the\t_btx_reference_inject \strc_lists_inject_direct % todo: make like \btx_list_reference_inject_now with { } [\s!btx]% - [\c!type=\s!btx,\c!location=\v!here]% + [\c!type=\s!btx]% \c!location=\v!none [\ifx\currentbtxdataset\v!default\else\s!btxset=\currentbtxdataset,\fi% \s!btxref=\currentbtxtag,% %\ifx\currentbtxcombis \empty\else\s!btxcom={\currentbtxcombis},\fi% @@ -1997,6 +1997,7 @@ \c!separator:juniors={\btxspace}, \c!separator:vons={\btxspace}, \c!separator:initials={\btxspace}, + \c!connector:initials={-}, \c!stopper:initials={.}, %\c!surnamesep={\btxcomma}, % is this used anywhere? \c!separator:invertedinitials={\btxcomma}, diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index d4b423224..7d6a106d1 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 ee377dae7..f0e2e8ef0 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/mkiv/util-zip.lua b/tex/context/base/mkiv/util-zip.lua index 4ceec7afd..84539492c 100644 --- a/tex/context/base/mkiv/util-zip.lua +++ b/tex/context/base/mkiv/util-zip.lua @@ -34,11 +34,13 @@ end local files = utilities.files local openfile = files.open local closefile = files.close +local getsize = files.size local readstring = files.readstring local readcardinal2 = files.readcardinal2le local readcardinal4 = files.readcardinal4le local setposition = files.setposition local getposition = files.getposition +local skipbytes = files.skip local band = bit32.band local rshift = bit32.rshift @@ -69,6 +71,158 @@ local openzipfile, closezipfile, unzipfile, foundzipfile, getziphash, getziplist } end + -- https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT + +-- local function collect(z) +-- if not z.list then +-- local list = { } +-- local hash = { } +-- local position = 0 +-- local index = 0 +-- local handle = z.handle +-- while true do +-- setposition(handle,position) +-- local signature = readstring(handle,4) +-- if signature == "PK\3\4" then +-- -- [local file header 1] +-- -- [encryption header 1] +-- -- [file data 1] +-- -- [data descriptor 1] +-- local version = readcardinal2(handle) +-- local flag = readcardinal2(handle) +-- local method = readcardinal2(handle) +-- local filetime = readcardinal2(handle) +-- local filedate = readcardinal2(handle) +-- local crc32 = readcardinal4(handle) +-- local compressed = readcardinal4(handle) +-- local uncompressed = readcardinal4(handle) +-- local namelength = readcardinal2(handle) +-- local extralength = readcardinal2(handle) +-- local filename = readstring(handle,namelength) +-- local descriptor = band(flag,8) ~= 0 +-- local encrypted = band(flag,1) ~= 0 +-- local acceptable = method == 0 or method == 8 +-- -- 30 bytes of header including the signature +-- local skipped = 0 +-- local size = 0 +-- if encrypted then +-- size = readcardinal2(handle) +-- skipbytes(handle,size) +-- skipped = skipped + size + 2 +-- skipbytes(8) +-- skipped = skipped + 8 +-- size = readcardinal2(handle) +-- skipbytes(handle,size) +-- skipped = skipped + size + 2 +-- size = readcardinal4(handle) +-- skipbytes(handle,size) +-- skipped = skipped + size + 4 +-- size = readcardinal2(handle) +-- skipbytes(handle,size) +-- skipped = skipped + size + 2 +-- end +-- position = position + 30 + namelength + extralength + skipped +-- -- if descriptor then +-- -- -- where is this one located +-- -- setposition(handle,position + compressed) +-- -- crc32 = readcardinal4(handle) +-- -- compressed = readcardinal4(handle) +-- -- uncompressed = readcardinal4(handle) +-- -- end +-- if acceptable then +-- index = index + 1 +-- local data = { +-- filename = filename, +-- index = index, +-- position = position, +-- method = method, +-- compressed = compressed, +-- uncompressed = uncompressed, +-- crc32 = crc32, +-- encrypted = encrypted, +-- } +-- hash[filename] = data +-- list[index] = data +-- else +-- -- maybe a warning when encrypted +-- end +-- position = position + compressed +-- else +-- break +-- end +-- z.list = list +-- z.hash = hash +-- end +-- end +-- end +-- end + +-- end +-- end + + local function update(handle,data) + position = data.offset + setposition(handle,position) + local signature = readstring(handle,4) + if signature == "PK\3\4" then -- 0x04034B50 + -- [local file header 1] + -- [encryption header 1] + -- [file data 1] + -- [data descriptor 1] + local version = readcardinal2(handle) + local flag = readcardinal2(handle) + local method = readcardinal2(handle) + skipbytes(handle,4) + ----- filetime = readcardinal2(handle) + ----- filedate = readcardinal2(handle) + local crc32 = readcardinal4(handle) + local compressed = readcardinal4(handle) + local uncompressed = readcardinal4(handle) + local namelength = readcardinal2(handle) + local extralength = readcardinal2(handle) + local filename = readstring(handle,namelength) + local descriptor = band(flag,8) ~= 0 + local encrypted = band(flag,1) ~= 0 + local acceptable = method == 0 or method == 8 + -- 30 bytes of header including the signature + local skipped = 0 + local size = 0 + if encrypted then + size = readcardinal2(handle) + skipbytes(handle,size) + skipped = skipped + size + 2 + skipbytes(8) + skipped = skipped + 8 + size = readcardinal2(handle) + skipbytes(handle,size) + skipped = skipped + size + 2 + size = readcardinal4(handle) + skipbytes(handle,size) + skipped = skipped + size + 4 + size = readcardinal2(handle) + skipbytes(handle,size) + skipped = skipped + size + 2 + end + if acceptable then + if filename ~= data.filename then + -- elseif method ~= data.method then + -- elseif encrypted ~= data.encrypted then + -- elseif crc32 ~= 0 and crc32 ~= data.crc32 then + -- elseif uncompressed ~= 0 and uncompressed ~= data.uncompressed then + -- elseif compressed ~= 0 and compressed ~= data.compressed then + else + position = position + 30 + namelength + extralength + skipped + data.position = position + return position + end + else + -- maybe a warning when encrypted + end + end + data.position = false + return false + end + local function collect(z) if not z.list then local list = { } @@ -76,78 +230,88 @@ local openzipfile, closezipfile, unzipfile, foundzipfile, getziphash, getziplist local position = 0 local index = 0 local handle = z.handle - while true do - setposition(handle,position) - local signature = readstring(handle,4) - if signature == "PK\3\4" then - -- [local file header 1] - -- [encryption header 1] - -- [file data 1] - -- [data descriptor 1] - local version = readcardinal2(handle) - local flag = readcardinal2(handle) - local method = readcardinal2(handle) - local filetime = readcardinal2(handle) - local filedate = readcardinal2(handle) - local crc32 = readcardinal4(handle) - local compressed = readcardinal4(handle) - local uncompressed = readcardinal4(handle) - local namelength = readcardinal2(handle) - local extralength = readcardinal2(handle) - local filename = readstring(handle,namelength) - local descriptor = band(flag,8) ~= 0 - local encrypted = band(flag,1) ~= 0 - local acceptable = method == 0 or method == 8 - -- 30 bytes of header including the signature - local skipped = 0 - local size = 0 - if encrypted then - size = readcardinal2(handle) - skipbytes(size) - skipped = skipped + size + 2 - skipbytes(8) - skipped = skipped + 8 - size = readcardinal2(handle) - skipbytes(size) - skipped = skipped + size + 2 - size = readcardinal4(handle) - skipbytes(size) - skipped = skipped + size + 4 - size = readcardinal2(handle) - skipbytes(size) - skipped = skipped + size + 2 - end - position = position + 30 + namelength + extralength + skipped - if descriptor then - setposition(handle,position + compressed) - crc32 = readcardinal4(handle) - compressed = readcardinal4(handle) - uncompressed = readcardinal4(handle) - end - if acceptable then - index = index + 1 - local data = { - filename = filename, - index = index, - position = position, - method = method, - compressed = compressed, - uncompressed = uncompressed, - crc32 = crc32, - encrypted = encrypted, - } - hash[filename] = data - list[index] = data - else - -- maybe a warning when encrypted + local size = getsize(handle) + -- + -- Not all files have the compressed into set so we need to get the directory + -- first. We only handle single disk zip files. + -- + for i=size-4,size-64*1024,-1 do + setposition(handle,i) + local enddirsignature = readcardinal4(handle) + if enddirsignature == 0x06054B50 then + local thisdisknumber = readcardinal2(handle) + local centraldisknumber = readcardinal2(handle) + local thisnofentries = readcardinal2(handle) + local totalnofentries = readcardinal2(handle) + local centralsize = readcardinal4(handle) + local centraloffset = readcardinal4(handle) + local commentlength = readcardinal2(handle) + local comment = readstring(handle,length) + if size - i >= 22 then + if thisdisknumber == centraldisknumber then + setposition(handle,centraloffset) + while true do + if readcardinal4(handle) == 0x02014B50 then + skipbytes(handle,4) + ----- versionmadeby = readcardinal2(handle) + ----- versionneeded = readcardinal2(handle) + local flag = readcardinal2(handle) + local method = readcardinal2(handle) + skipbytes(handle,4) + ----- filetime = readcardinal2(handle) + ----- filedate = readcardinal2(handle) + local crc32 = readcardinal4(handle) + local compressed = readcardinal4(handle) + local uncompressed = readcardinal4(handle) + local namelength = readcardinal2(handle) + local extralength = readcardinal2(handle) + local commentlength = readcardinal2(handle) + skipbytes(handle,8) + ----- disknumber = readcardinal2(handle) + ----- intattributes = readcardinal2(handle) + ----- extattributes = readcardinal4(handle) + local headeroffset = readcardinal4(handle) + local filename = readstring(handle,namelength) + skipbytes(handle,extralength+commentlength) + ----- extradata = readstring(handle,extralength) + ----- comment = readstring(handle,commentlength) + -- + local descriptor = band(flag,8) ~= 0 + local encrypted = band(flag,1) ~= 0 + local acceptable = method == 0 or method == 8 + if acceptable then + index = index + 1 + local data = { + filename = filename, + index = index, + position = nil, + method = method, + compressed = compressed, + uncompressed = uncompressed, + crc32 = crc32, + encrypted = encrypted, + offset = headeroffset, + } + hash[filename] = data + list[index] = data + end + else + break + end + end + end + break end - position = position + compressed - else - break end - z.list = list - z.hash = hash end + -- for i=1,index do -- delayed + -- local data = list[i] + -- if not data.position then + -- update(handle,list[i]) + -- end + -- end + z.list = list + z.hash = hash end end @@ -156,6 +320,7 @@ local openzipfile, closezipfile, unzipfile, foundzipfile, getziphash, getziplist if not list then collect(z) end + -- inspect(z.list) return z.list end @@ -193,7 +358,10 @@ local openzipfile, closezipfile, unzipfile, foundzipfile, getziphash, getziplist local handle = z.handle local position = data.position local compressed = data.compressed - if compressed > 0 then + if position == nil then + position = update(handle,data) + end + if position and compressed > 0 then setposition(handle,position) local result = readstring(handle,compressed) if data.method == 8 then diff --git a/tex/context/base/mkxl/back-exp.lmt b/tex/context/base/mkxl/back-exp.lmt index e5e2e9dab..ada1fe98c 100644 --- a/tex/context/base/mkxl/back-exp.lmt +++ b/tex/context/base/mkxl/back-exp.lmt @@ -1576,9 +1576,9 @@ local collectresults do -- too many locals otherwise if s then c = s end - if c == 0 then + if c == 0 or c == 0xFFFD then if trace_export then - report_export("%w",currentdepth) + report_export("%w",currentdepth,c) end elseif c == 0x20 then local a = getattr(n,a_characters) diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 030a373aa..1e3f06e43 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{2023.05.05 18:36} +\newcontextversion{2023.05.07 16:25} %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 4cfa73091..292118662 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{2023.05.05 18:36} +\immutable\edef\contextversion{2023.05.07 16:25} %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 0048f4bb8..be156affb 100644 --- a/tex/context/base/mkxl/driv-shp.lmt +++ b/tex/context/base/mkxl/driv-shp.lmt @@ -289,6 +289,8 @@ local flush_character do end end + -- virtual t3 fonts have negative font index + for i=1,#vfcommands do local packet = vfcommands[i] if packet then @@ -297,16 +299,14 @@ local flush_character do local chr = packet[2] local csx = packet[3] local csy = packet[4] or csx - pos_h = pos_h + flushchar(fnt,chr,csx,csy) -* sx + pos_h = pos_h + flushchar(fnt,chr,csx,csy) * sx elseif command == "slot" then local index = packet[2] local chr = packet[3] local csx = packet[4] local csy = packet[5] or csx if index == 0 then - pos_h = pos_h + flushchar(font,chr,csx,csy) -* sx + pos_h = pos_h + flushchar(font,chr,csx,csy) * sx else local okay = fonts and fonts[index] if okay then @@ -315,13 +315,11 @@ local flush_character do if fnt == 0 then fnt = font end - pos_h = pos_h + flushchar(fnt,chr,csx,csy) -* sx + pos_h = pos_h + flushchar(fnt,chr,csx,csy) * sx end else -- safeguard, we assume the font itself (often index 1) - pos_h = pos_h + flushchar(font,chr,csx,csy) -* sx + pos_h = pos_h + flushchar(font,chr,csx,csy) * sx end end elseif command == "use" then @@ -394,6 +392,7 @@ local flush_character do if v and v ~= 0 then pos_v = pos_v + v * sy end +print("6>",fnt) flushchar(fnt,c,csx,csy) pos_h = ph pos_v = pv @@ -525,6 +524,7 @@ local flush_character do local okay = fonts and fonts[index] if okay then fnt = okay.id or fnt -- or maybe just return +print("7>",fnt) end elseif command == "lua" then local code = packet[2] diff --git a/tex/context/base/mkxl/lpdf-emb.lmt b/tex/context/base/mkxl/lpdf-emb.lmt index f63dcf6ef..303704aa7 100644 --- a/tex/context/base/mkxl/lpdf-emb.lmt +++ b/tex/context/base/mkxl/lpdf-emb.lmt @@ -2173,8 +2173,6 @@ local noffonts = 0 local getstreamhash = fonts.handlers.otf.getstreamhash local loadstreamdata = fonts.handlers.otf.loadstreamdata --- we can actually now number upwards (so not use fontid in /F) - local objects = setmetatableindex(lpdf.usedfontobjects,function(t,k) -- defined in lpdf-lmt.lmt local v if type(k) == "number" then @@ -2227,13 +2225,13 @@ function lpdf.flushfonts() -- don't have the id. -- we can combine the two for loops .. todo + -- inspect(lpdf.usedcharacters) for fontid, used in sortedhash(lpdf.usedcharacters) do -- for a bitmap we need a different hash unless we stick to a fixed high -- resolution which makes much sense - local hash = getstreamhash(fontid) if hash then local parent = mainfonts[hash] @@ -2263,7 +2261,7 @@ function lpdf.flushfonts() end end end - if rawdata then +-- if rawdata then -- we don't have these when we nest vf's (as in antykwa) parent = { hash = hash, fontdata = fontdata, @@ -2281,7 +2279,7 @@ function lpdf.flushfonts() } mainfonts[hash] = parent noffonts = noffonts + 1 - end +-- end end -- print("after ",fontid,hash,parent) if parent then @@ -2297,6 +2295,7 @@ function lpdf.flushfonts() -- this is no not yet ok for tfm / type 1 .. we need to move the nested blobs ourside the loop for hash, details in sortedhash(mainfonts) do + -- the filename can be somewhat weird if we have a virtual font that starts out with some local filename = details.filename if next(details.indices) then local properties = details.properties diff --git a/tex/context/base/mkxl/lpdf-lmt.lmt b/tex/context/base/mkxl/lpdf-lmt.lmt index 7f3e53f28..5f900fc35 100644 --- a/tex/context/base/mkxl/lpdf-lmt.lmt +++ b/tex/context/base/mkxl/lpdf-lmt.lmt @@ -243,6 +243,7 @@ local threshold = 655360 local tjfactor = 100 / 65536 function flushers.updatefontstate(font) + -- virtual t3 fonts have negative font index fontcharacters = characters[font] -- fontdescriptions = descriptions[font] fontparameters = parameters[font] @@ -2227,25 +2228,25 @@ local finalize do -- resources can be indirect -if state == "ignore" or state == false then + if state == "ignore" or state == false then -else + else - registerpage(pageattributes) + registerpage(pageattributes) - lpdf.finalizepage(true) + lpdf.finalizepage(true) - local TrimBox = pageattributes.TrimBox - local CropBox = pageattributes.CropBox - local BleedBox = pageattributes.BleedBox + local TrimBox = pageattributes.TrimBox + local CropBox = pageattributes.CropBox + local BleedBox = pageattributes.BleedBox - -- Indirect objects don't work in all viewers. + -- Indirect objects don't work in all viewers. - if TrimBox then pageattributes.TrimBox = pdfsharedobject(checkedbox(bbox,TrimBox,"TrimBox")) end - if CropBox then pageattributes.CropBox = pdfsharedobject(checkedbox(bbox,CropBox,"CropBox")) end - if BleedBox then pageattributes.BleedBox = pdfsharedobject(checkedbox(bbox,BleedBox,"BleedBox")) end + if TrimBox then pageattributes.TrimBox = pdfsharedobject(checkedbox(bbox,TrimBox,"TrimBox")) end + if CropBox then pageattributes.CropBox = pdfsharedobject(checkedbox(bbox,CropBox,"CropBox")) end + if BleedBox then pageattributes.BleedBox = pdfsharedobject(checkedbox(bbox,BleedBox,"BleedBox")) end -end + end else diff --git a/tex/context/base/mkxl/math-act.lmt b/tex/context/base/mkxl/math-act.lmt index ee9e56f8f..a5ad102ec 100644 --- a/tex/context/base/mkxl/math-act.lmt +++ b/tex/context/base/mkxl/math-act.lmt @@ -922,16 +922,14 @@ end do - local nps = fonts.helpers.newprivateslot - local list = { - { 0x2032, nps("delimited ghost 0x2032"), 1 }, - { 0x2033, nps("delimited ghost 0x2033"), 2, 0x2032 }, - { 0x2034, nps("delimited ghost 0x2034"), 3, 0x2032 }, - { 0x2057, nps("delimited ghost 0x2057"), 4, 0x2032 }, - { 0x2035, nps("delimited ghost 0x2035"), 1 }, - { 0x2036, nps("delimited ghost 0x2036"), 2, 0x2035 }, - { 0x2037, nps("delimited ghost 0x2037"), 3, 0x2035 }, + { 0x2032, 1 }, + { 0x2033, 2, 0x2032 }, + { 0x2034, 3, 0x2032 }, + { 0x2057, 4, 0x2032 }, + { 0x2035, 1 }, + { 0x2036, 2, 0x2035 }, + { 0x2037, 3, 0x2035 }, } datasets.fixprimes = list @@ -943,7 +941,7 @@ do for i=1,#list do local entry = list[i] local unicode = entry[1] - local count = entry[3] + local count = entry[2] local used = fonts.handlers.otf.getsubstitution(target,unicode,"ssty",true,"math","dflt") or unicode local data = targetcharacters[used] if data then @@ -960,10 +958,10 @@ do if fake then for i=1,#list do local entry = list[i] - local count = entry[3] + local count = entry[2] if count > 1 then local unicode = entry[1] - local original = entry[4] + local original = entry[3] local data = targetcharacters[original] if data then local oldwidth = data.width @@ -986,51 +984,6 @@ do end end - function mathtweaks.addprimed(target,original,parameters) - local characters = target.characters - for i=1,#list do - local entry = list[i] - local basecode = entry[1] - local movecode = entry[2] - local basedata = characters[basecode] - if basedata then - local baseheight = basedata.height or 0 - local basewidth = basedata.width or 0 - local used = baseheight - local total = baseheight - characters[movecode] = { -- todo:share - width = basewidth, - height = used, - unicode = basecode, -- 0xFFFD or space or so - -- callback = "devirtualize", - commands = { - downcommand[used], - { "rule", used, 0 }, - }, - } - basedata.partsorientation = "vertical" - basedata.parts = { - { - advance = used, - ["end"] = used, - extender = 1, - glyph = movecode, - start = used, - }, - { - advance = total, - ["end"] = 0, - glyph = basecode, - start = total, - }, - } - if trace_tweaking then - report_tweak("primed %U added",target,original,basecode) - end - end - end - end - end do @@ -3246,6 +3199,14 @@ do { 0x0303, nps("delimited right tilde"), nps("delimited ghost tilde") }, { 0x20DB, nps("delimited right dddot"), nps("delimited ghost dddot") }, + { 0x2032, nps("delimited right prime"), nps("delimited ghost prime"), false, 1 }, + { 0x2033, nps("delimited right dprime"), nps("delimited ghost dprime"), false, 1 }, + { 0x2034, nps("delimited right tprime"), nps("delimited ghost tprime"), false, 1 }, + { 0x2057, nps("delimited right qprime"), nps("delimited ghost qprime"), false, 1 }, + { 0x2035, nps("delimited right rprime"), nps("delimited ghost rprime"), false, 1 }, + { 0x2036, nps("delimited right drprime"), nps("delimited ghost rdprime"), false, 1 }, + { 0x2037, nps("delimited right dtprime"), nps("delimited ghost rtprime"), false, 1 }, + { 0x231C, nps("delimited left upper corner"), nps("delimited ghost upper corner") }, { 0x231D, nps("delimited right upper corner"), nps("delimited ghost upper corner") }, { 0x231E, nps("delimited left lower corner"), nps("delimited ghost lower corner"), true }, @@ -3307,8 +3268,7 @@ do characters[movecode] = { width = basewidth, height = used, - unicode = basecode, - -- callback = "devirtualize", + unicode = 0xFFFD, commands = { downcommand[used], { "rule", used, 0 }, @@ -3319,13 +3279,13 @@ do advance = used, ["end"] = used, extender = 1, - glyph = movecode, + glyph = movecode, -- bottom start = used, }, { advance = total, ["end"] = 0, - glyph = fouriercode, + glyph = fouriercode, -- top start = total, }, } @@ -3334,15 +3294,16 @@ do end characters[fouriercode] = { width = basewidth, - height = baseheight, + height = baseheight, -- somehow no \primed antykwa (unless we double the height) depth = basedepth, unicode = basecode, - -- callback = "devirtualize", commands = { scale == 1 and charcommand[basecode] or { "slot", 0, basecode, scale, scale }, }, partsorientation = "vertical", - parts = parts, + parts = parts, +-- keepvirtual = basechar.commands and true or false, + -- callback = "devirtualize", } if trace_tweaking then report_tweak("fourier %U added using %U",target,original,basecode,fouriercode) diff --git a/tex/context/base/mkxl/math-dld.mklx b/tex/context/base/mkxl/math-dld.mklx index 281ccedb2..4f8cf8fb4 100644 --- a/tex/context/base/mkxl/math-dld.mklx +++ b/tex/context/base/mkxl/math-dld.mklx @@ -250,13 +250,29 @@ % $ \autofences \fourier{(z+\frac12)} + \courier{(z+\frac12)} + \xourier{(z+\frac12)} $ -\definemathdelimited [primed] [\c!right="2032,\c!size=1,\c!topoffset=.2\exheight] -\definemathdelimited [doubleprimed] [primed] [\c!right="2033] -\definemathdelimited [tripleprimed] [primed] [\c!right="2034] -\definemathdelimited [quadrupleprimed] [primed] [\c!right="2057] -\definemathdelimited [reverseprimed] [primed] [\c!right="2035] -\definemathdelimited [doublereverseprimed] [primed] [\c!right="2036] -\definemathdelimited [triplereverseprimed] [primed] [\c!right="2037] +\integerdef\delimitedrightprimeuc \privatecharactercode{delimited right prime} +\integerdef\delimitedrightdprimeuc \privatecharactercode{delimited right dprime} +\integerdef\delimitedrighttprimeuc \privatecharactercode{delimited right tprime} +\integerdef\delimitedrightqprimeuc \privatecharactercode{delimited right qprime} +\integerdef\delimitedrightrprimeuc \privatecharactercode{delimited right rprime} +\integerdef\delimitedrightrdprimeuc \privatecharactercode{delimited right rdprime} +\integerdef\delimitedrightrtprimeuc \privatecharactercode{delimited right rtprime} + +%definemathdelimited [primed] [\c!right="2032,\c!size=1,\c!topoffset=.2\exheight] +%definemathdelimited [doubleprimed] [primed] [\c!right="2033] +%definemathdelimited [tripleprimed] [primed] [\c!right="2034] +%definemathdelimited [quadrupleprimed] [primed] [\c!right="2057] +%definemathdelimited [reverseprimed] [primed] [\c!right="2035] +%definemathdelimited [doublereverseprimed] [primed] [\c!right="2036] +%definemathdelimited [triplereverseprimed] [primed] [\c!right="2037] + +\definemathdelimited [primed] [\c!right=\delimitedrightprimeuc,\c!topoffset=.2\exheight,\c!size=1] +\definemathdelimited [doubleprimed] [primed] [\c!right=\delimitedrightdprimeuc] +\definemathdelimited [tripleprimed] [primed] [\c!right=\delimitedrighttprimeuc] +\definemathdelimited [quadrupleprimed] [primed] [\c!right=\delimitedrightqprimeuc] +\definemathdelimited [reverseprimed] [primed] [\c!right=\delimitedrightrprimeuc] +\definemathdelimited [doublereverseprimed] [primed] [\c!right=\delimitedrightrdprimeuc] +\definemathdelimited [triplereverseprimed] [primed] [\c!right=\delimitedrightrtprimeuc] % diff --git a/tex/context/base/mkxl/math-fnt.lmt b/tex/context/base/mkxl/math-fnt.lmt index 87dfe16e5..d829c342e 100644 --- a/tex/context/base/mkxl/math-fnt.lmt +++ b/tex/context/base/mkxl/math-fnt.lmt @@ -6,6 +6,9 @@ if not modules then modules = { } end modules ['math-fnt'] = { license = "see context related readme files" } +-- It is a pitty that we don't have a unicode character that can be used but that never +-- gets copied when we cut and paste. Not all pdf viewers ignore 0xFFFD for instance. + local round = math.round local setmetatableindex = table.setmetatableindex @@ -62,11 +65,11 @@ local function register_extensible(font,char,style,box) local fontdata = chardata[font] local oldchar = fontdata[char] if oldchar and not oldchar.keepvirtual then -if enabled == true or enabled == "both" or oldchar.partsorientation == enabled then - -- we're okay -else - return -end + if enabled == true or enabled == "both" or oldchar.partsorientation == enabled then + -- we're okay + else + return + end local bx = tonut(box) -- actually we don't want colors and such so if we do finalize we -- should be more selctive: @@ -76,8 +79,8 @@ end local id = getid(bx) local al = getattrlst(bx) local wd, ht, dp = getwhd(bx) - local unicode = oldchar.unicode or char - -- we cannot have self referencing t3 fonts + local unicode = oldchar.unicode or char + -- we cannot have self referencing t3 fonts .. see devirtualize code local oldcommands = oldchar.oldcommands local newcommands = oldchar.commands if oldcommands then @@ -123,7 +126,7 @@ end -- height = ht, -- depth = dp, -- } - -- local p = oldchar.vparts + -- local p = oldchar.parts -- if p then -- local first = fontdata[p[#p].glyph] -- local last = fontdata[p[ 1].glyph] diff --git a/tex/context/base/mkxl/publ-ini.mkxl b/tex/context/base/mkxl/publ-ini.mkxl index f120c55fb..3ed15ad98 100644 --- a/tex/context/base/mkxl/publ-ini.mkxl +++ b/tex/context/base/mkxl/publ-ini.mkxl @@ -438,6 +438,7 @@ \permanent\protected\def\btxrightbracket {\removeunwantedspaces]\space} \permanent\protected\def\btxrightbracketperiod {\removeunwantedspaces].\space} \permanent\protected\def\btxrightbracketcomma {\removeunwantedspaces],\space} +\permanent\protected\def\btxhyphen {\removeunwantedspaces-} %D Variables: @@ -1995,6 +1996,7 @@ \c!separator:juniors={\btxspace}, \c!separator:vons={\btxspace}, \c!separator:initials={\btxspace}, + \c!connector:initials={\btxhyphen}, \c!stopper:initials={.}, %\c!surnamesep={\btxcomma}, % is this used anywhere? \c!separator:invertedinitials={\btxcomma}, diff --git a/tex/context/fonts/mkiv/antykwa-math.lfg b/tex/context/fonts/mkiv/antykwa-math.lfg index 975ada70e..90ec9bbc8 100644 --- a/tex/context/fonts/mkiv/antykwa-math.lfg +++ b/tex/context/fonts/mkiv/antykwa-math.lfg @@ -163,12 +163,15 @@ if common then tweak = "addequals", force = true, }, + { + tweak = "addfourier", + }, { tweak = "keepbases", -- list = { 0x302 } list = "default" }, -} + } common.mathematics.helpers.copyrecipes(recipes) diff --git a/tex/context/fonts/mkiv/iwona-math.lfg b/tex/context/fonts/mkiv/iwona-math.lfg index 2754e1577..76131ad8e 100644 --- a/tex/context/fonts/mkiv/iwona-math.lfg +++ b/tex/context/fonts/mkiv/iwona-math.lfg @@ -95,6 +95,9 @@ if common then factor = 1.0, -- accent base height fake = 0.9, -- replace multiples with this width proportion }, + { + tweak = "addfourier", + }, { tweak = "addequals", force = true, diff --git a/tex/context/fonts/mkiv/kurier-math.lfg b/tex/context/fonts/mkiv/kurier-math.lfg index a7290d0ca..96154194a 100644 --- a/tex/context/fonts/mkiv/kurier-math.lfg +++ b/tex/context/fonts/mkiv/kurier-math.lfg @@ -95,6 +95,9 @@ if common then factor = 1.0, -- accent base height fake = 0.9, -- replace multiples with this width proportion }, + { + tweak = "addfourier", + }, { tweak = "addequals", force = true, diff --git a/tex/context/fonts/mkiv/pagella-math.lfg b/tex/context/fonts/mkiv/pagella-math.lfg index 05e6fad81..ea8fdb8fe 100644 --- a/tex/context/fonts/mkiv/pagella-math.lfg +++ b/tex/context/fonts/mkiv/pagella-math.lfg @@ -231,9 +231,9 @@ return { tweak = "addfourier", variant = 1, }, - { - tweak = "addprimed", - }, +-- { +-- tweak = "addprimed", +-- }, { tweak = "kernpairs", list = { diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 5441fa004..86f683ce2 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 : 2023-05-05 18:36 +-- merge date : 2023-05-07 16:25 do -- begin closure to overcome local limits and interference -- cgit v1.2.3