diff options
Diffstat (limited to 'tex')
47 files changed, 1068 insertions, 259 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index ce3ef17ee..2370467b3 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{2018.07.20 21:20} +\newcontextversion{2018.07.25 19:41} %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 ba5135d80..0fe486458 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{2018.07.20 21:20} +\edef\contextversion{2018.07.25 19:41} %D For those who want to use this: diff --git a/tex/context/base/mkiv/back-exp.lua b/tex/context/base/mkiv/back-exp.lua index 41e3cbbf8..28929bc57 100644 --- a/tex/context/base/mkiv/back-exp.lua +++ b/tex/context/base/mkiv/back-exp.lua @@ -2050,6 +2050,41 @@ do end +do + + local usedpublications = { } + local tagsindatasets = setmetatableindex("table") + local serialize = false + + function structurestags.setpublication(dataset,tag,rendering) + usedpublications[locatedtag("publication")] = { + dataset = dataset, + tag = tag, + rendering = rendering + } + tagsindatasets[dataset][tag] = true + if not serialize then + structures.tags.registerextradata("btx",function() + local t = { "<btxdata>"} + for dataset, used in sortedhash(tagsindatasets) do + t[#t+1] = publications.converttoxml(dataset,true,false,true,false,true) + end + t[#t+1] = "</btxdata>" + return concat(t,"\n") + end) + end + end + + function extras.publication(di,element,n,fulltag) + local hash = usedpublications[fulltag] + if hash then + setattribute(di,"dataset",hash.dataset) + setattribute(di,"tag",hash.tag) + end + end + +end + -- flusher do @@ -3840,6 +3875,22 @@ local htmltemplate = [[ local result = allcontent(tree,embedmath) -- embedfile is for testing + -- ugly but so be it: + + local extradata = structures.tags.getextradata() + if extradata then + local t = { "" } + t[#t+1] = "<extradata>" + for name, action in sortedhash(extradata) do + t[#t+1] = action() + end + t[#t+1] = "</extradata>" + t[#t+1] = "</document>" + result = gsub(result,"</document>",concat(t,"\n")) + end + + -- done with ugly + if onlyxml then os.remove(defaultfilename) @@ -3959,8 +4010,8 @@ local htmltemplate = [[ -- looking at identity is somewhat redundant as we also inherit from interaction -- at the tex end - local identity = interactions.general.getidentity() - local metadata = structures.tags.getmetadata() + local identity = interactions.general.getidentity() + local metadata = structures.tags.getmetadata() local specification = { name = usedname, @@ -4196,3 +4247,9 @@ implement { actions = structurestags.setlist, arguments = "integer" } + +implement { + name = "settagpublication", + actions = structurestags.setpublication, + arguments = "2 strings" +} diff --git a/tex/context/base/mkiv/back-exp.mkiv b/tex/context/base/mkiv/back-exp.mkiv index 8220aca66..03dbe709a 100644 --- a/tex/context/base/mkiv/back-exp.mkiv +++ b/tex/context/base/mkiv/back-exp.mkiv @@ -255,6 +255,13 @@ {\iftrialtypesetting\else\clf_settagmargintext#1\relax\fi}% \to \everyenableelements +\appendtoks + \unexpanded\def\dotagpublication#1#2% + {\iftrialtypesetting\else + \clf_settagpublication{#1}{#2}\relax + \fi}% +\to \everyenableelements + % The action: \setupbackend[export=yes] % or filename % maybe xhtml css settings will move to setupexport diff --git a/tex/context/base/mkiv/char-ini.mkiv b/tex/context/base/mkiv/char-ini.mkiv index 229e07633..0519aaf91 100644 --- a/tex/context/base/mkiv/char-ini.mkiv +++ b/tex/context/base/mkiv/char-ini.mkiv @@ -66,6 +66,18 @@ \normalstartimath\char#1\normalstopimath \fi\fi} +\unexpanded\def\textormathchars#1% + {{\font_text_or_mathchars#1\relax}} + +\unexpanded\def\font_text_or_mathchars#1#2\relax + {\relax\ifmmode + #1#2% + \else\iffontchar\font`#1\relax + #1#2\relax + \else + \normalstartimath#1#2\normalstopimath + \fi\fi} + %D The codes are stored in the format, so we don't need to reinitialize %D them (unless of course we have adapted the table). It is on the agenda %D to do this with \type {tex.lccode} cum suis once they're available. diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 7d09bd5aa..1acfee799 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2018.07.20 21:20} +\newcontextversion{2018.07.25 19:41} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/mkiv/cont-run.mkiv b/tex/context/base/mkiv/cont-run.mkiv index b650be67d..f841ce530 100644 --- a/tex/context/base/mkiv/cont-run.mkiv +++ b/tex/context/base/mkiv/cont-run.mkiv @@ -25,19 +25,29 @@ \let\synctexsetfilename \clf_synctexsetfilename \let\synctexresetfilename\clf_synctexresetfilename \let\synctexblockfilename\clf_synctexblockfilename -\let\synctexpause \clf_synctexpause -\let\synctexresume \clf_synctexresume -\appendtoks\clf_synctexpause \to\everybeforeoutput -\appendtoks\clf_synctexresume\to\everyafteroutput +\let\synctexpause \donothing +\let\synctexresume \donothing +\let\synctexpushline\donothing +\let\synctexpopline \donothing + +\appendtoks\synctexpause \to\everybeforeoutput +\appendtoks\synctexresume\to\everyafteroutput \unexpanded\def\setupsynctex[#1]% {\begingroup \getdummyparameters[\c!state=\v!stop,\c!method=\v!max,#1]% + \edef\p_state{\dummyparameter\c!state}% \clf_setupsynctex - state {\dummyparameter\c!state}% + state {\p_state}% method {\dummyparameter\c!method}% \relax + \ifx\p_state\v!start + \glet\synctexpause \clf_synctexpause + \glet\synctexresume \clf_synctexresume + \glet\synctexpushline\clf_synctexpushline + \glet\synctexpopline \clf_synctexpopline + \fi \endgroup} \unexpanded\def\blocksynctexfile[#1]% diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index f3b9915ae..086eceada 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -42,7 +42,7 @@ %D has to match \type {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2018.07.20 21:20} +\edef\contextversion{2018.07.25 19:41} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/core-con.mkiv b/tex/context/base/mkiv/core-con.mkiv index b4f247fcb..d0e53833d 100644 --- a/tex/context/base/mkiv/core-con.mkiv +++ b/tex/context/base/mkiv/core-con.mkiv @@ -805,61 +805,119 @@ \ifdefined\symbol \else \def\symbol[#1]{#1} \fi % todo +% \defineconversion +% [set 0] +% [{\symbol[bullet]}, +% {\symbol[dash]}, +% {\symbol[star]}, +% {\symbol[triangle]}, +% {\symbol[circle]}, +% {\symbol[medcircle]}, +% {\symbol[bigcircle]}, +% {\symbol[square]}, +% {\symbol[checkmark]}] + +% \defineconversion +% [set 1] +% [\mathematics{\star}, +% \mathematics{\star\star}, +% \mathematics{\star\star\star}, +% \mathematics{\ddagger}, +% \mathematics{\ddagger\ddagger}, +% \mathematics{\ddagger\ddagger\ddagger}, +% \mathematics{\ast}, +% \mathematics{\ast\ast}, +% \mathematics{\ast\ast\ast}] +% +% \defineconversion +% [set 2] +% [\mathematics{\ast}, +% \mathematics{\dag}, +% \mathematics{\ddag}, +% \mathematics{\ast\ast}, +% \mathematics{\dag\dag}, +% \mathematics{\ddag\ddag}, +% \mathematics{\ast\ast\ast}, +% \mathematics{\dag\dag\dag}, +% \mathematics{\ddag\ddag\ddag}, +% \mathematics{\ast\ast\ast\ast}, +% \mathematics{\dag\dag\dag\dag}, +% \mathematics{\ddag\ddag\ddag\ddag}] +% +% \defineconversion +% [set 3] +% [\mathematics{\star}, +% \mathematics{\star\star}, +% \mathematics{\star\star\star}, +% \mathematics{\ddagger}, +% \mathematics{\ddagger\ddagger}, +% \mathematics{\ddagger\ddagger\ddagger}, +% \mathematics{\P}, +% \mathematics{\P\P}, +% \mathematics{\P\P\P}, +% \mathematics{\S}, +% \mathematics{\S\S}, +% \mathematics{\S\S\S}, +% \mathematics{\ast}, +% \mathematics{\ast\ast}, +% \mathematics{\ast\ast\ast}] + \defineconversion [set 0] - [{\symbol[bullet]}, - {\symbol[dash]}, - {\symbol[star]}, - {\symbol[triangle]}, - {\symbol[circle]}, - {\symbol[medcircle]}, - {\symbol[bigcircle]}, - {\symbol[square]}] + [\symbol{bullet}, + \symbol{dash}, + \symbol{star}, + \symbol{triangle}, + \symbol{circle}, + \symbol{medcircle}, + \symbol{bigcircle}, + \symbol{square}, + \symbol{checkmark}] \defineconversion [set 1] - [\mathematics{\star}, - \mathematics{\star\star}, - \mathematics{\star\star\star}, - \mathematics{\ddagger}, - \mathematics{\ddagger\ddagger}, - \mathematics{\ddagger\ddagger\ddagger}, - \mathematics{\ast}, - \mathematics{\ast\ast}, - \mathematics{\ast\ast\ast}] + [\textormathchars{⋆}, + \textormathchars{⋆⋆}, + \textormathchars{⋆⋆⋆}, + \textormathchars{‡}, + \textormathchars{‡‡}, + \textormathchars{‡‡‡}, + \textormathchars{∗}, + \textormathchars{∗∗}, + \textormathchars{∗∗∗}] \defineconversion [set 2] - [\mathematics{*}, - \mathematics{\dag}, - \mathematics{\ddag}, - \mathematics{**}, - \mathematics{\dag\dag}, - \mathematics{\ddag\ddag}, - \mathematics{***}, - \mathematics{\dag\dag\dag}, - \mathematics{\ddag\ddag\ddag}, - \mathematics{****}, - \mathematics{\dag\dag\dag\dag}, - \mathematics{\ddag\ddag\ddag\ddag}] + [\textormathchars{∗}, + \textormathchars{†}, + \textormathchars{‡}, + \textormathchars{∗∗}, + \textormathchars{††}, + \textormathchars{‡‡}, + \textormathchars{∗∗∗}, + \textormathchars{†††}, + \textormathchars{‡‡‡}, + \textormathchars{∗∗∗∗}, + \textormathchars{††††}, + \textormathchars{‡‡‡‡}] \defineconversion [set 3] - [\mathematics{\star}, - \mathematics{\star\star}, - \mathematics{\star\star\star}, - \mathematics{\ddagger}, - \mathematics{\ddagger\ddagger}, - \mathematics{\ddagger\ddagger\ddagger}, - \mathematics{\P}, - \mathematics{\P\P}, - \mathematics{\P\P\P}, - \mathematics{\S}, - \mathematics{\S\S}, - \mathematics{\S\S\S}, - \mathematics{\ast}, - \mathematics{\ast\ast}, - \mathematics{\ast\ast\ast}] + [\textormathchars{⋆}, + \textormathchars{⋆⋆}, + \textormathchars{⋆⋆⋆}, + \textormathchars{‡}, + \textormathchars{‡‡}, + \textormathchars{‡‡‡}, + \textormathchars{¶}, + \textormathchars{¶¶}, + \textormathchars{¶¶¶}, + \textormathchars{§}, + \textormathchars{§§}, + \textormathchars{§§§}, + \textormathchars{∗}, + \textormathchars{∗∗}, + \textormathchars{∗∗∗}] %D Iteration of suggestion by WS on mailinglist 2010.12.22: %D diff --git a/tex/context/base/mkiv/core-env.mkiv b/tex/context/base/mkiv/core-env.mkiv index fb9e15292..fac34a1aa 100644 --- a/tex/context/base/mkiv/core-env.mkiv +++ b/tex/context/base/mkiv/core-env.mkiv @@ -663,6 +663,24 @@ \dodoglobal\undefinevalue{\??setup:#1}% \fi} +% \unexpanded\def\resetsetups[#1]% see x-fo for usage +% {\dodoglobal\expandafter\let\csname\??setup +% \ifgridsnapping\ifcsname\??setup\v!grid:#1\endcsname\v!grid\fi +% :#1\endcsname\undefined} + +\unexpanded\def\copysetups + {\dodoubleargument\syst_setups_copy} + +% \def\syst_setups_copy[#1][#2]% +% {\ifcsname\??setup:#2\endcsname +% \expandafter\let\csname\??setup:#1\expandafter\endcsname\csname\??setup:#2\endcsname +% \fi} + +\def\syst_setups_copy[#1][#2]% + {\ifcsname\??setup:#2\endcsname + \expandafter\let\csname\??setup:#1\expandafter\endcsname\lastnamedcs + \fi} + \unexpanded\def\showsetupsdefinition[#1]% {\showvalue{\??setup:#1}} % temp hack for debugging diff --git a/tex/context/base/mkiv/export-example.css b/tex/context/base/mkiv/export-example.css index 812873afc..f831d14a5 100644 --- a/tex/context/base/mkiv/export-example.css +++ b/tex/context/base/mkiv/export-example.css @@ -34,8 +34,9 @@ @namespace context url('http://www.pragma-ade.com/context/export') ; -/* ignore : mixed */ -/* metadata: display */ +/* ignore : mixed */ +/* metadata : display */ +/* extradata: display */ ignore, context|div.ignore { @@ -57,6 +58,11 @@ context|div.xmetavariable { display : none ; } +extradata, +context|div.extradata { + display : none ; +} + /* document : display */ document:before, @@ -679,6 +685,7 @@ context|div.combinationcaption { /* listcontent : mixed */ /* listdata : mixed */ /* listpage : mixed */ +/* listtext : inline */ list, context|div.list { @@ -758,6 +765,11 @@ context|div.listpage { display : none ; } +listtext, +context|div.listtext { + display : inline ; +} + /* delimitedblock : display */ /* delimited : inline */ /* delimitedsymbol : inline */ @@ -1024,6 +1036,20 @@ context|div.math-display { margin : 1ex 0ex 1em 3em ; } +/* publication : inline */ +/* pubfld : inline */ + +publication, +context|div.publication { + display : inline ; +} + +pubfld[detail="title"], +context|div.pubfld.title { + display : inline ; + font-weight : italic ; +} + /* quantity : inline */ /* unit : inline */ /* number : inline */ diff --git a/tex/context/base/mkiv/font-con.lua b/tex/context/base/mkiv/font-con.lua index d6fe55c65..e8bcd56a2 100644 --- a/tex/context/base/mkiv/font-con.lua +++ b/tex/context/base/mkiv/font-con.lua @@ -473,7 +473,8 @@ function constructors.scale(tfmdata,specification) local psname = properties.psname or tfmdata.psname local name = properties.name or tfmdata.name -- - -- the psname used in pdf file as well as for selecting subfont in ttc + -- The psname used in pdf file as well as for selecting subfont in ttc although + -- we don't need that subfont look up here (mapfile stuff). -- local psname, psfixed = fixedpsname(psname,fontname or fullname or file.nameonly(filename)) -- diff --git a/tex/context/base/mkiv/font-one.lua b/tex/context/base/mkiv/font-one.lua index a3dc7b038..85b9d406e 100644 --- a/tex/context/base/mkiv/font-one.lua +++ b/tex/context/base/mkiv/font-one.lua @@ -86,7 +86,7 @@ function afm.load(filename) local name = file.removesuffix(file.basename(filename)) local data = containers.read(afm.cache,name) local attr = lfs.attributes(filename) - local size, time = attr.size or 0, attr.modification or 0 + local size, time = attr and attr.size or 0, attr and attr.modification or 0 -- local pfbfile = file.replacesuffix(name,"pfb") local pfbname = resolvers.findfile(pfbfile,"pfb") or "" diff --git a/tex/context/base/mkiv/font-ota.lua b/tex/context/base/mkiv/font-ota.lua index fd58a6e43..48ec6b976 100644 --- a/tex/context/base/mkiv/font-ota.lua +++ b/tex/context/base/mkiv/font-ota.lua @@ -111,6 +111,8 @@ analyzers.useunicodemarks = false -- todo: analyzers per script/lang, cross font, so we need an font id hash -> script -- e.g. latin -> hyphenate, arab -> 1/2/3 analyze -- its own namespace +-- done can go away as can tonut + function analyzers.setstate(head,font) local useunicodemarks = analyzers.useunicodemarks local tfmdata = fontdata[font] diff --git a/tex/context/base/mkiv/font-otl.lua b/tex/context/base/mkiv/font-otl.lua index a71e3ad98..4ddbcf8b4 100644 --- a/tex/context/base/mkiv/font-otl.lua +++ b/tex/context/base/mkiv/font-otl.lua @@ -405,6 +405,7 @@ local function copytotfm(data,cache_id) local fontname = metadata.fontname local fullname = metadata.fullname or fontname local psname = fontname or fullname + local subfont = metadata.subfontindex local units = metadata.units or 1000 -- if units == 0 then -- catch bugs in fonts @@ -499,6 +500,7 @@ local function copytotfm(data,cache_id) properties.fullname = fullname properties.psname = psname properties.name = filename or fullname + properties.subfont = subfont -- -- properties.name = specification.name -- properties.sub = specification.sub diff --git a/tex/context/base/mkiv/font-pre.mkiv b/tex/context/base/mkiv/font-pre.mkiv index 01e580ac5..c1c24b854 100644 --- a/tex/context/base/mkiv/font-pre.mkiv +++ b/tex/context/base/mkiv/font-pre.mkiv @@ -53,10 +53,7 @@ script=auto, % on speed; 'base' just doesn't play well with dynamics; some day we can even autoscript=position, autolanguage=position, -% ccmp=yes, kern=yes, % consider skipping the base passes when no base mode is used -% palt=yes, -% pwid=yes, mark=yes, mkmk=yes, curs=yes] @@ -323,6 +320,22 @@ \definefontfeature [tamil-two] [tamil-one] [script=tml2] \definefontfeature [telugu-two] [telugu-one] [script=tel2] +% tibetan + +\definefontfeature + [tibetan] + [always] + [script=tibt, + language=dflt, + locl=yes, + ccmp=yes, + abvs=yes, + blws=yes, + calt=yes, + liga=yes, + abvm=yes, + blwm=yes] + % cjk \definefontfeature diff --git a/tex/context/base/mkiv/lang-mis.mkiv b/tex/context/base/mkiv/lang-mis.mkiv index 17149b37a..f2c837f54 100644 --- a/tex/context/base/mkiv/lang-mis.mkiv +++ b/tex/context/base/mkiv/lang-mis.mkiv @@ -156,7 +156,8 @@ \ifx\postwordbreak\undefined \unexpanded\def\postwordbreak {\penalty\zerocount \hskip\zeropoint\relax} \fi \ifx\hspaceamount \undefined \def\hspaceamount#1#2{.16667\emwidth} \fi % language specific -\unexpanded\def\permithyphenation{\ifhmode\prewordbreak\fi} % doesn't remove spaces +%unexpanded\def\permithyphenation{\ifhmode\prewordbreak\fi} % doesn't remove spaces +\unexpanded\def\permithyphenation{\ifhmode\wordboundary\fi} % doesn't remove spaces %D \macros %D {beginofsubsentence,endofsubsentence, @@ -209,15 +210,14 @@ {% if direct if, we need \relax for lookahead in math mode \csname\??discretionarymode \ifcase\discretionarymode - n% \csstring\lang_discretionaries_process_none + n% \else\ifmmode - m% \csstring\lang_discretionaries_process_math + m% \else - t% \csstring\lang_discretionaries_process_text + t% \fi\fi \endcsname} -% \def\lang_discretionaries_process_none#1% \setvalue{\??discretionarymode n}#1% {\detokenize{#1}} @@ -230,19 +230,22 @@ \newconditional\punctafterdiscretionary \newconditional\spaceafterdiscretionary -\def\lang_discretionaries_check_before +\def\lang_discretionaries_check_before %i sused grouped {\ifvmode \dontleavehmode \fi \ifhmode - \begingroup - \setbox\scratchbox\lastbox - \ifzeropt\wd\scratchbox - \let\postwordbreak\prewordbreak - \fi - \box\scratchbox\relax - \endgroup - \fi} + %\begingroup + %\setbox\scratchbox\lastbox + %\ifzeropt\wd\scratchbox + % \box\scratchbox\relax + % \endgroup + % \let\postwordbreak\prewordbreak + %\else + % \box\scratchbox\relax + % \endgroup + %\fi + \fi} \def\lang_discretionaries_check_after {\setfalse\punctafterdiscretionary @@ -254,10 +257,8 @@ \ifx :\nextnext \settrue \punctafterdiscretionary \else \ifx ;\nextnext \settrue \punctafterdiscretionary \fi\fi\fi\fi\fi\fi} -%let\lang_discretionaries_process_math\handlemathmodediscretionary \letvalue{\??discretionarymode m}\handlemathmodediscretionary -% \def\lang_discretionaries_process_text#1% grouped ! \setvalue{\??discretionarymode t}#1% {\bgroup \let\nextnextnext\egroup @@ -278,39 +279,47 @@ \ifcsname\??discretionaryaction\string#1\endcsname \lastnamedcs \else\ifconditional\spaceafterdiscretionary - \prewordbreak\hbox{\string#1}\relax + %\prewordbreak\hbox{\string#1}\relax + \wordboundary\hbox{\string#1}\relax \else\ifconditional\punctafterdiscretionary - \prewordbreak\hbox{\string#1}\relax + %\prewordbreak\hbox{\string#1}\relax + \wordboundary\hbox{\string#1}\wordboundary \else - \prewordbreak\hbox{\string#1}\prewordbreak + %\prewordbreak\hbox{\string#1}\prewordbreak + \wordboundary\hbox{\string#1}\wordboundary \fi\fi\fi \def\nextnextnext{\afterassignment\egroup\let\next=}% \else \lang_discretionaries_check_before % the next line has been changed (20050203) - % \prewordbreak\hbox{\textmodediscretionary\nextnext}\allowbreak\postwordbreak + % \prewordbreak\hbox{\textmodediscretionary\nextnext}\postwordbreak % but an hbox blocks a possible \discretionary \ifcsname\??discretionaryaction\endcsname \lastnamedcs \else\ifconditional\spaceafterdiscretionary - \prewordbreak\textmodediscretionary\relax + %\prewordbreak\textmodediscretionary\relax + \wordboundary\textmodediscretionary\relax \else\ifconditional\punctafterdiscretionary - \prewordbreak\textmodediscretionary\relax + %\prewordbreak\textmodediscretionary\relax + \wordboundary\textmodediscretionary\relax \else - \prewordbreak\textmodediscretionary\prewordbreak + %\prewordbreak\textmodediscretionary\prewordbreak + \wordboundary\textmodediscretionary\wordboundary \fi\fi\fi - % \prewordbreak\textmodediscretionary\nextnext\allowbreak\postwordbreak \fi \else\ifcsname\??discretionaryaction\discretionarytoken\endcsname \lastnamedcs \else \lang_discretionaries_check_before \ifconditional\spaceafterdiscretionary - \prewordbreak\hbox{#2}\relax + %\prewordbreak\hbox{#2}\relax + \wordboundary\hbox{#2}\relax \else\ifconditional\punctafterdiscretionary - \prewordbreak\hbox{#2}\relax + %\prewordbreak\hbox{#2}\relax + \wordboundary\hbox{#2}\relax \else - \prewordbreak\discretionary{\hbox{#2}}{}{\hbox{#2}}\allowbreak\postwordbreak + %\prewordbreak\discretionary{\hbox{#2}}{}{\hbox{#2}}\postwordbreak + \wordboundary\discretionary{\hbox{#2}}{}{\hbox{#2}}\wordboundary \fi\fi \fi\fi \nextnextnext} @@ -324,35 +333,33 @@ \unexpanded\def\directdiscretionary {\csname\??discretionarymode \ifcase\discretionarymode - n% \csstring\lang_discretionaries_process_none + n% \else - d% \csstring\lang_discretionaries_process_direct + d% \fi \endcsname} \unexpanded\def\indirectdiscretionary {\csname\??discretionarymode \ifcase\discretionarymode - n% \csstring\lang_discretionaries_process_none + n% \else - i% \csstring\lang_discretionaries_process_indirect + i% \fi \endcsname} -% \unexpanded\def\lang_discretionaries_process_direct#1% \setuvalue{\??discretionarymode d}#1% {\edef\discretionarytoken{\detokenize{#1}}% \let\textmodediscretionary\compoundhyphen - %\executeifdefined{\??discretionaryaction\discretionarytoken}{\indirectdiscretionary{#1}}} \ifcsname\??discretionaryaction\discretionarytoken\endcsname \expandafter\lastnamedcs \else \expandafter\indirectdiscretionary \fi{#1}} -% \unexpanded\unexpanded\def\lang_discretionaries_process_indirect#1% \setuvalue{\??discretionarymode i}#1% - {\prewordbreak\discretionary{\hbox{#1}}{}{\hbox{#1}}\allowbreak\postwordbreak} + %{\prewordbreak\discretionary{\hbox{#1}}{}{\hbox{#1}}\postwordbreak} + {\wordboundary\discretionary{\hbox{#1}}{}{\hbox{#1}}\wordboundary} \unexpanded\def\definetextmodediscretionary #1 {\setvalue{\??discretionaryaction\detokenize{#1}}} @@ -376,11 +383,14 @@ \def\lang_discretionaries_hyphen_like#1#2% {\ifconditional\spaceafterdiscretionary - \prewordbreak\hbox{#1}\relax + %prewordbreak\hbox{#1}\relax + \wordboundary\hbox{#1}\relax \else\ifconditional\punctafterdiscretionary - \prewordbreak\hbox{#1}\relax + %prewordbreak\hbox{#1}\relax + \wordboundary\hbox{#1}\relax \else - \prewordbreak#2\postwordbreak % was prewordbreak + %\prewordbreak#2\postwordbreak % was prewordbreak + \wordboundary#2\wordboundary \fi\fi} \definetextmodediscretionary {} @@ -397,59 +407,65 @@ \definetextmodediscretionary ( {\ifdim\lastskip>\zeropoint - (\prewordbreak + %(\prewordbreak + (\wordboundary \else - \prewordbreak\discretionary{}{(-}{(}\prewordbreak + %\prewordbreak\discretionary{}{(-}{(}\prewordbreak + \wordboundary\discretionary{}{(-}{(}\wordboundary \fi} \definetextmodediscretionary ~ - {\prewordbreak\discretionary{-}{}{\thinspace}\postwordbreak} + %{\prewordbreak\discretionary{-}{}{\thinspace}\postwordbreak} + {\wordboundary\discretionary{-}{}{\thinspace}\wordboundary} \definetextmodediscretionary ' - {\prewordbreak\discretionary{-}{}{'}\postwordbreak} + %{\prewordbreak\discretionary{-}{}{'}\postwordbreak} + {\wordboundary\discretionary{-}{}{'}\wordboundary} \definetextmodediscretionary ^ - {\prewordbreak\discretionary{\hbox{\normalstartimath|\normalstopimath}}{}{\hbox{\normalstartimath|\normalstopimath}}% - \allowbreak\postwordbreak} % bugged - -% \definetextmodediscretionary < -% {\beginofsubsentence\prewordbreak\beginofsubsentencespacing} -% -% \definetextmodediscretionary > -% {\endofsubsentencespacing\prewordbreak\endofsubsentence} -% -% \definetextmodediscretionary = -% {\prewordbreak\midsentence\prewordbreak} + %{\prewordbreak\discretionary{\hbox{\normalstartimath|\normalstopimath}}{}{\hbox{\normalstartimath|\normalstopimath}}% + % \postwordbreak} % bugged + {\wordboundary\discretionary{\hbox{\normalstartimath|\normalstopimath}}{}{\hbox{\normalstartimath|\normalstopimath}}% + \wordboundary} % bugged \definetextmodediscretionary < - {\beginofsubsentence\prewordbreak\beginofsubsentencespacing + %{\beginofsubsentence\prewordbreak\beginofsubsentencespacing + {\beginofsubsentence\wordboundary\beginofsubsentencespacing \aftergroup\ignorespaces} % tricky, we need to go over the \nextnextnext \definetextmodediscretionary > {\removeunwantedspaces - \endofsubsentencespacing\prewordbreak\endofsubsentence} + %\endofsubsentencespacing\prewordbreak\endofsubsentence} + \endofsubsentencespacing\wordboundary\endofsubsentence} \definetextmodediscretionary = {\removeunwantedspaces - \prewordbreak\midsentence\prewordbreak + %\prewordbreak\midsentence\prewordbreak + \wordboundary\midsentence\wordboundary \aftergroup\ignorespaces} % french -\definetextmodediscretionary : {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{:}:} -\definetextmodediscretionary ; {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{;};} -\definetextmodediscretionary ? {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{?}?} -\definetextmodediscretionary ! {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{!}!} +%definetextmodediscretionary : {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{:}:} +%definetextmodediscretionary ; {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{;};} +%definetextmodediscretionary ? {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{?}?} +%definetextmodediscretionary ! {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{!}!} + +\definetextmodediscretionary : {\removeunwantedspaces\wordboundary\kern\hspaceamount\empty{:}:} +\definetextmodediscretionary ; {\removeunwantedspaces\wordboundary\kern\hspaceamount\empty{;};} +\definetextmodediscretionary ? {\removeunwantedspaces\wordboundary\kern\hspaceamount\empty{?}?} +\definetextmodediscretionary ! {\removeunwantedspaces\wordboundary\kern\hspaceamount\empty{!}!} -\definetextmodediscretionary * - {\prewordbreak\discretionary{-}{}{\kern.05em}\prewordbreak} +%definetextmodediscretionary * {\prewordbreak\discretionary{-}{}{\kern.05\emwidth}\prewordbreak} +\definetextmodediscretionary * {\wordboundary\discretionary{-}{}{\kern.05\emwidth}\wordboundary} % spanish -\definetextmodediscretionary ?? {\prewordbreak\questiondown} -\definetextmodediscretionary !! {\prewordbreak\exclamdown} +%definetextmodediscretionary ?? {\prewordbreak\questiondown} +%definetextmodediscretionary !! {\prewordbreak\exclamdown} -% \ifx\normalcompound\undefined \let\normalcompound=| \fi +\definetextmodediscretionary ?? {\wordboundary\questiondown} +\definetextmodediscretionary !! {\wordboundary\exclamdown} %D \installdiscretionary | + %D \installdiscretionary + = diff --git a/tex/context/base/mkiv/lang-spa.mkiv b/tex/context/base/mkiv/lang-spa.mkiv index e7cb0025f..7109ad051 100644 --- a/tex/context/base/mkiv/lang-spa.mkiv +++ b/tex/context/base/mkiv/lang-spa.mkiv @@ -41,17 +41,15 @@ %D Alternative discretionary handlers: -\definetextmodediscretionary : - {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentlanguage{:}:} +%definetextmodediscretionary : {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentlanguage{:}:} +%definetextmodediscretionary ; {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentlanguage{;};} +%definetextmodediscretionary ? {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentlanguage{?}?} +%definetextmodediscretionary ! {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentlanguage{!}!} -\definetextmodediscretionary ; - {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentlanguage{;};} - -\definetextmodediscretionary ? - {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentlanguage{?}?} - -\definetextmodediscretionary ! - {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentlanguage{!}!} +\definetextmodediscretionary : {\removeunwantedspaces\wordboundary\kern\hspaceamount\currentlanguage{:}:} +\definetextmodediscretionary ; {\removeunwantedspaces\wordboundary\kern\hspaceamount\currentlanguage{;};} +\definetextmodediscretionary ? {\removeunwantedspaces\wordboundary\kern\hspaceamount\currentlanguage{?}?} +\definetextmodediscretionary ! {\removeunwantedspaces\wordboundary\kern\hspaceamount\currentlanguage{!}!} %D \startbuffer %D \mainlanguage[en] \quotation{test \quotation{test} test}\par diff --git a/tex/context/base/mkiv/lpdf-tag.lua b/tex/context/base/mkiv/lpdf-tag.lua index 3eb9363e5..534519c8a 100644 --- a/tex/context/base/mkiv/lpdf-tag.lua +++ b/tex/context/base/mkiv/lpdf-tag.lua @@ -13,7 +13,8 @@ local settings_to_hash = utilities.parsers.settings_to_hash local sortedhash = table.sortedhash local formatters = string.formatters -local trace_tags = false trackers.register("structures.tags", function(v) trace_tags = v end) +local trace_tags = false trackers.register("structures.tags", function(v) trace_tags = v end) +local trace_info = false trackers.register("structures.tags.info", function(v) trace_info = v end) local report_tags = logs.reporter("backend","tags") @@ -316,6 +317,7 @@ end -- no need to adapt head, as we always operate on lists local EMCliteral = nil +local visualize = nil function nodeinjections.addtags(head) @@ -381,22 +383,30 @@ function nodeinjections.addtags(head) local noftop = 0 - local function inject(start,stop,list,literal) + local function inject(start,stop,list,literal,left,right) local prev = getprev(start) if prev then setlink(prev,literal) end - setlink(literal,start) + if left then + setlink(literal,left,start) + else + setlink(literal,start) + end if list and getlist(list) == start then setlist(list,literal) end local literal = copy_node(EMCliteral) -- use insert instead: - local next = getnext(stop) + local next = getnext(stop) if next then setlink(literal,next) end - setlink(stop,literal) + if right then + setlink(stop,right,literal) + else + setlink(stop,literal) + end end for i=1,#ranges do @@ -453,7 +463,18 @@ function nodeinjections.addtags(head) end if literal then - inject(start,stop,list,literal) + local left,right + if trace_info then + local name = specification.tagname + if name then + if not visualize then + visualize = nodes.visualizers.register("tags") + end + left = visualize(name) + right = visualize() + end + end + inject(start,stop,list,literal,left,right) end top = taglist diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua index 3d733aa2e..e456a0b89 100644 --- a/tex/context/base/mkiv/mult-low.lua +++ b/tex/context/base/mkiv/mult-low.lua @@ -12,7 +12,8 @@ return { ["constants"] = { -- "zerocount", "minusone", "minustwo", "plusone", "plustwo", "plusthree", "plusfour", "plusfive", - "plussix", "plusseven", "pluseight", "plusnine", "plusten", "plussixteen", "plushundred", "plustwohundred", + "plussix", "plusseven", "pluseight", "plusnine", "plusten", "plussixteen", + "plusfifty", "plushundred", "plusonehundred", "plustwohundred", "plusfivehundred", "plusthousand", "plustenthousand", "plustwentythousand", "medcard", "maxcard", "maxcardminusone", "zeropoint", "onepoint", "halfapoint", "onebasepoint", "maxcount", "maxdimen", "scaledpoint", "thousandpoint", "points", "halfpoint", @@ -155,6 +156,7 @@ return { "texdefinition", -- "doifelsesetups", "doifsetupselse", "doifsetups", "doifnotsetups", "setup", "setups", "texsetup", "xmlsetup", "luasetup", "directsetup", "fastsetup", + "copysetups", "resetsetups", "doifelsecommandhandler", "doifcommandhandlerelse", "doifnotcommandhandler", "doifcommandhandler", -- "newmode", "setmode", "resetmode", diff --git a/tex/context/base/mkiv/node-ini.lua b/tex/context/base/mkiv/node-ini.lua index 9b35f29f6..47c1b88e1 100644 --- a/tex/context/base/mkiv/node-ini.lua +++ b/tex/context/base/mkiv/node-ini.lua @@ -385,7 +385,7 @@ nodes.pdfliteralvalues = pdfliteralvalues dirvalues.lefttoright = 0 dirvalues.righttoleft = 1 -nodes.subtypes = { +nodes.subtypes = allocate { [nodecodes.accent] = accentcodes, [nodecodes.boundary] = boundarycodes, [nodecodes.dir] = dircodes, @@ -405,6 +405,12 @@ nodes.subtypes = { [nodecodes.whatsit] = whatcodes, } +table.setmetatableindex(nodes.subtypes,function(t,k) + local v = { } + t[k] = v + return v +end) + nodes.skipcodes = gluecodes -- more friendly nodes.directioncodes = dircodes -- more friendly nodes.whatsitcodes = whatcodes -- more official @@ -492,3 +498,30 @@ end if node.fix_node_lists then node.fix_node_lists(false) end + +-- a temp hack + +if LUATEXFUNCTIONALITY < 6866 then + + local texnest = tex.nest + local texlist = tex.list + + function tex.getnest(k) + if not k or k == "top" then + return texnest[texnest.ptr] + end + if k == "ptr" then + return texnest.ptr + end + return texnest[k] + end + + function tex.getlist(k) + return texlist[k] + end + + function tex.setlist(k,v) + texlist[k] = v + end + +end diff --git a/tex/context/base/mkiv/node-pro.lua b/tex/context/base/mkiv/node-pro.lua index 575ddbb28..5de3415f2 100644 --- a/tex/context/base/mkiv/node-pro.lua +++ b/tex/context/base/mkiv/node-pro.lua @@ -72,6 +72,8 @@ do local has_glyph = nodes.has_glyph local count_nodes = nodes.countall + local texget = tex.get + local tracer = processors.tracer local function pre_linebreak_filter(head,groupcode) -- ,size,packtype,direction @@ -95,6 +97,13 @@ do local function hpack_filter(head,groupcode,size,packtype,direction,attributes) local found = force_processors or has_glyph(head) if found then + -- + -- yes or no or maybe an option + -- + if not direction then + direction = texget("textdir") + end + -- if trace_callbacks then local before = count_nodes(head,true) head = actions(head,groupcode,size,packtype,direction,attributes) diff --git a/tex/context/base/mkiv/node-syn.lua b/tex/context/base/mkiv/node-syn.lua index efac2795a..153ab7eb2 100644 --- a/tex/context/base/mkiv/node-syn.lua +++ b/tex/context/base/mkiv/node-syn.lua @@ -24,7 +24,16 @@ if not modules then modules = { } end modules ['node-syn'] = { -- I only tested SumatraPDF with SciTE, for which one needs to configure in the -- viewer: -- --- InverseSearchCmdLine = c:\data\system\scite\wscite\scite.exe "%f" "-goto:%l" $ +-- InverseSearchCmdLine = c:\data\system\scite\wscite\scite.exe "%f" "-goto:%l" $ +-- +-- In fact, a way more powerful implementation would have been not to add a library +-- to a viewer, but letthe viewer call an external program: +-- +-- InverseSearchCmdLine = mtxrun.exe --script synctex --edit --name="%f" --line="%l" $ +-- +-- which would (re)launch the editor in the right spot. That way we can really +-- tune well to the macro package used and also avoid the fuzzy heuristics of +-- the library. -- -- Unfortunately syntex always removes the files at the end and not at the start -- (this happens in synctexterminate) so we need to work around that by using an @@ -124,6 +133,7 @@ local openfile, renamefile, removefile = io.open, os.rename, os.remove local report_system = logs.reporter("system") local tex = tex +local texget = tex.get local nuts = nodes.nuts @@ -166,7 +176,7 @@ local set_synctex_tag = tex.set_synctex_tag local force_synctex_tag = tex.force_synctex_tag local force_synctex_line = tex.force_synctex_line ----- get_synctex_tag = tex.get_synctex_tag ------ get_synctex_line = tex.get_synctex_line +local get_synctex_line = tex.get_synctex_line local set_synctex_mode = tex.set_synctex_mode local getpos = function() @@ -266,6 +276,34 @@ function synctex.resetfilename() end end +do + + local nesting = 0 + local ignored = false + + function synctex.pushline() + nesting = nesting + 1 + if nesting == 1 then + local l = get_synctex_line() + ignored = l and l > 0 + if not ignored then + force_synctex_line(texget("inputlineno")) + end + end + end + + function synctex.popline() + if nesting == 1 then + if not ignored then + force_synctex_line() + ignored = false + end + end + nesting = nesting - 1 + end + +end + -- the node stuff local filehandle = nil @@ -778,11 +816,21 @@ implement { } implement { - name = "synctexpause", - actions = synctex.pause, + name = "synctexpause", + actions = synctex.pause, } implement { - name = "synctexresume", - actions = synctex.resume, + name = "synctexresume", + actions = synctex.resume, } + +interfaces.implement { + name = "synctexpushline", + actions = synctex.pushline, +} +interfaces.implement { + name = "synctexpopline", + actions = synctex.popline, +} + diff --git a/tex/context/base/mkiv/publ-dat.lua b/tex/context/base/mkiv/publ-dat.lua index f2e57618b..cdcdf35b4 100644 --- a/tex/context/base/mkiv/publ-dat.lua +++ b/tex/context/base/mkiv/publ-dat.lua @@ -534,8 +534,12 @@ do end if normalized == "crossref" then setmetatableindex(entries,function(t,k) - local parent = luadata[value] - if parent then + local parent = rawget(luadata,value) + if parent == entries then + report_duplicates("bad parent %a for %a in dataset %s",value,hashtag,dataset.name) + setmetatableindex(entries,nil) + return entries + elseif parent then setmetatableindex(entries,parent) return entries[k] else @@ -717,22 +721,27 @@ do local compact = false -- can be a directive but then we also need to deal with newlines ... not now - function publications.converttoxml(dataset,nice,dontstore,usedonly,subset) -- we have fields ! + function publications.converttoxml(dataset,nice,dontstore,usedonly,subset,noversion) -- we have fields ! local current = datasets[dataset] local luadata = subset or (current and current.luadata) if luadata then statistics.starttiming(publications) -- local result, r, n = { }, 0, 0 - local usedonly = usedonly and publications.usedentries() + if usedonly then + usedonly = publications.usedentries() + usedonly = usedonly[current.name] + end -- r = r + 1 ; result[r] = "<?xml version='1.0' standalone='yes'?>" - r = r + 1 ; result[r] = "<bibtex>" + r = r + 1 ; result[r] = formatters["<bibtex dataset='%s'>"](current.name) -- if nice then -- will be default local f_entry_start = formatters[" <entry tag='%s' category='%s' index='%s'>"] local s_entry_stop = " </entry>" local f_field = formatters[" <field name='%s'>%s</field>"] + local f_cdata = formatters[" <field name='rawbibtex'><![CDATA[%s]]></field>"] + for tag, entry in sortedhash(luadata) do if not usedonly or usedonly[tag] then r = r + 1 ; result[r] = f_entry_start(tag,entry.category,entry.index) @@ -746,6 +755,9 @@ do end end end +local s = publications.savers.bib(current,false,{ [tag] = entry }) +s = utilities.strings.striplines(s,"prune and collapse") +r = r + 1 ; result[r] = f_cdata(xml.escaped(s)) r = r + 1 ; result[r] = s_entry_stop n = n + 1 end @@ -775,7 +787,7 @@ do -- r = r + 1 ; result[r] = "</bibtex>" -- - result = concat(result,nice and "\n" or nil) + result = concat(result,nice and "\n" or nil,noversion and 2 or 1,#result) -- if dontstore then -- indeed diff --git a/tex/context/base/mkiv/publ-ini.mkiv b/tex/context/base/mkiv/publ-ini.mkiv index 39e9308e9..ead46929d 100644 --- a/tex/context/base/mkiv/publ-ini.mkiv +++ b/tex/context/base/mkiv/publ-ini.mkiv @@ -391,6 +391,12 @@ \let\btxsetup\fastsetup +\def\btxfield #1{\dostarttagged\t!pubfld{#1}\clf_btxfield {\currentbtxdataset}{\currentbtxtag}{#1}\dostoptagged} +\def\btxdetail #1{\dostarttagged\t!pubfld{#1}\clf_btxdetail{\currentbtxdataset}{\currentbtxtag}{#1}\dostoptagged} +\def\btxflush #1{\dostarttagged\t!pubfld{#1}\clf_btxflush {\currentbtxdataset}{\currentbtxtag}{#1}\dostoptagged} +\def\btxdirect #1{\dostarttagged\t!pubfld{#1}\clf_btxdirect{\currentbtxdataset}{\currentbtxtag}{#1}\dostoptagged} +%def\btxauthorfield#1{\dostarttagged\t!pubfld{#1}\clf_btxauthorfield \currentbtxauthorindex{#1}\dostoptagged} + %D How complex will we go? Can we assume that e.g. an apa style will not be mixed %D with another one? I think this assumption is okay. For manuals we might want to %D mix but we can work around it. @@ -635,11 +641,13 @@ \unexpanded\def\btxnumberingsetup#1% {\begingroup + \dostarttagged\t!listtag\empty \setbtxparameterset{\c!list:\s!numbering}\currentbtxnumbering % brrrr \setbtxlist \btxparameter\c!left % \btxparameter\c!command{\publ_fast_setup\plusthree{\s!list:\s!numbering}{#1}}% \publ_fast_setup\plusthree{\s!list:\s!numbering}{#1}% \btxparameter\c!right + \dostoptagged \endgroup \btx_reset_numbering} % probably not needed @@ -661,21 +669,34 @@ \def\btx_entry_inject_list_text {\publ_fast_setup\plusfour\s!list\s!text} +\ifdefined\dotagpublication \else \let\dotagpublication \gobbletwoarguments \fi + \unexpanded\def\btx_entry_inject {\begingroup + \dostarttagged\t!publication\empty + \dotagpublication\currentbtxdataset\currentbtxtag \redoconvertfont % see (**) in strc-lst, this will become an configuration option \edef\currentbtxcategory{\btxfield{category}}% \ignorespaces \ifconditional\c_btx_list_texts + \dostarttagged\t!listtext\s!left \currentbtxbefore + \dostoptagged \fi + %\dostarttagged\t!listcontent\empty \btx_entry_inject_list_text + %\dostoptagged \ifconditional\c_btx_list_pages + \dostarttagged\t!listpage\empty \btx_entry_inject_pages + \dostoptagged \fi \ifconditional\c_btx_list_texts + \dostarttagged\t!listtext\s!right \currentbtxafter + \dostoptagged \fi + \dostoptagged \endgroup} \unexpanded\def\btxshowentryinline @@ -849,6 +870,8 @@ \expandafter\p_command\expandafter{\number\nofbtxlistentries}\relax \fi \else + \dostarttagged\t!publications\currentbtxrendering + \dostarttagged\t!list{btx}% \startpacked[\v!blank]% % sorting and so \clf_btxpreparelistentries{\currentbtxdataset}% could be put in collect @@ -871,6 +894,8 @@ {\let\currentbtxlistentry\recurselevel \clf_btxflushlistentry{\currentbtxdataset}\currentbtxlistentry\relax}% \stoppacked + \dostoptagged + \dostoptagged \fi \btxrenderingparameter\c!after \fi @@ -984,8 +1009,10 @@ \strc_lists_apply_renderingsetup} \def\btx_entry_indeed - {\btx_list_reference_inject - \btx_entry_inject} + {\dostarttagged\t!listcontent\empty + \btx_list_reference_inject + \btx_entry_inject + \dostoptagged} \def\btx_page_indeed {} @@ -1192,7 +1219,7 @@ \unexpanded\def\btxflushauthorinverted {\btx_flush_author{inverted}} % #1 \unexpanded\def\btxflushauthorinvertedshort{\btx_flush_author{invertedshort}} % #1 -\let\currentbtxauthorfield \s!author +\let\currentbtxauthorfield\s!author \unexpanded\def\btxsetauthorfield#1{\edef\currentbtxauthorfield{#1}} diff --git a/tex/context/base/mkiv/scrp-eth.lua b/tex/context/base/mkiv/scrp-eth.lua index 43cb2ff6a..2be77a2ce 100644 --- a/tex/context/base/mkiv/scrp-eth.lua +++ b/tex/context/base/mkiv/scrp-eth.lua @@ -65,17 +65,17 @@ local function space_glue(current) ) end -local function insert_space(head,current) - insert_node_before(head,current,space_glue(current)) +local function insert_space_before(head,current) + return insert_node_before(head,current,space_glue(current)) end -local function insert_zerowidthspace(head,current) - insert_node_before(head,current,new_glue(0)) +local function insert_zerowidthspace_before(head,current) + return insert_node_before(head,current,new_glue(0)) end -local function insert_nobreakspace(head,current) - insert_node_before(head,current,new_penalty(10000)) - insert_node_before(head,current,space_glue(current)) +local function insert_nobreakspace_before(head,current) + head, current = insert_node_before(head,current,new_penalty(10000)) + return insert_node_before(head,current,space_glue(current)) end -- syllable [zerowidthspace] syllable @@ -90,19 +90,19 @@ end local injectors = { -- [previous] [current] ethiopic_syllable = { - ethiopic_syllable = insert_zerowidthspace, - ethiopic_word = insert_nobreakspace, - ethiopic_sentence = insert_nobreakspace, + ethiopic_syllable = insert_zerowidthspace_before, + ethiopic_word = insert_nobreakspace_before, + ethiopic_sentence = insert_nobreakspace_before, }, ethiopic_word = { - ethiopic_syllable = insert_space, - ethiopic_word = insert_space, - ethiopic_sentence = insert_space, + ethiopic_syllable = insert_space_before, + ethiopic_word = insert_space_before, + ethiopic_sentence = insert_space_before, }, ethiopic_sentence = { - ethiopic_syllable = insert_space, - ethiopic_word = insert_space, - ethiopic_sentence = insert_space, + ethiopic_syllable = insert_space_before, + ethiopic_word = insert_space_before, + ethiopic_sentence = insert_space_before, }, } @@ -114,7 +114,7 @@ local function process(head,first,last) local id = getid(current) if id == glyph_code then local scriptstatus = getattr(current,a_scriptstatus) - local category = numbertocategory[scriptstatus] + local category = numbertocategory[scriptstatus] if injector then local action = injector[category] if action then diff --git a/tex/context/base/mkiv/scrp-ini.lua b/tex/context/base/mkiv/scrp-ini.lua index 0eee550ac..3cac3f9de 100644 --- a/tex/context/base/mkiv/scrp-ini.lua +++ b/tex/context/base/mkiv/scrp-ini.lua @@ -206,7 +206,9 @@ local hash = { -- we could put these presets in char-def.lua -- [0x1361] = "ethiopic_word", [0x1362] = "ethiopic_sentence", - -- + -- tibetan: + [0x0F0B] = "breaking_tsheg", + [0x0F0C] = "nonbreaking_tsheg", } local function provide(t,k) @@ -226,6 +228,7 @@ local function provide(t,k) elseif (k >= 0x01160 and k <= 0x011A7) then v = "jamo_medial" elseif (k >= 0x011A8 and k <= 0x011FF) then v = "jamo_final" elseif (k >= 0x01200 and k <= 0x0139F) then v = "ethiopic_syllable" + elseif (k >= 0x00F00 and k <= 0x00FFF) then v = "tibetan" else v = false end t[k] = v @@ -388,6 +391,8 @@ local scriptcolors = allocate { -- todo: just named colors ethiopic_syllable = "trace:1", ethiopic_word = "trace:2", ethiopic_sentence = "trace:3", + breaking_tsheg = "trace:1", + nonbreaking_tsheg = "trace:2", } scripts.colors = scriptcolors @@ -410,6 +415,8 @@ local numbertocategory = allocate { -- rather bound to cjk ... will be generaliz "ethiopic_syllable", "ethiopic_word", "ethiopic_sentence", + "breaking_tsheg", + "nonbreaking_tsheg", } local categorytonumber = allocate(table.swapped(numbertocategory)) -- could be one table diff --git a/tex/context/base/mkiv/scrp-ini.mkiv b/tex/context/base/mkiv/scrp-ini.mkiv index 4567e6791..f2d1da627 100644 --- a/tex/context/base/mkiv/scrp-ini.mkiv +++ b/tex/context/base/mkiv/scrp-ini.mkiv @@ -17,6 +17,7 @@ \registerctxluafile{scrp-cjk}{} \registerctxluafile{scrp-eth}{} \registerctxluafile{scrp-tha}{} +\registerctxluafile{scrp-tib}{} \definesystemattribute[scriptinjection][public,pickup] \definesystemattribute[scriptsplitting][public,pickup] @@ -86,6 +87,7 @@ \definescript [nihongo] [\c!method=nihongo] \definescript [ethiopic] [\c!method=ethiopic] \definescript [thai] [\c!method=thai] +\definescript [tibetan] [\c!method=tibetan] \definescript [latin] [\c!method=] % resets the attribute (also currentscript) diff --git a/tex/context/base/mkiv/scrp-tib.lua b/tex/context/base/mkiv/scrp-tib.lua new file mode 100644 index 000000000..2c4032f99 --- /dev/null +++ b/tex/context/base/mkiv/scrp-tib.lua @@ -0,0 +1,148 @@ +if not modules then modules = { } end modules ['scrp-tib'] = { + version = 1.001, + comment = "companion to scrp-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- at some point I will review the script code but for the moment we +-- do it this way; so space settings like with cjk yet + +local nuts = nodes.nuts + +local getnext = nuts.getnext +local getfont = nuts.getfont +----- getid = nuts.getid +local getattr = nuts.getattr +local ischar = nuts.ischar + +local insert_node_after = nuts.insert_after +local insert_node_before = nuts.insert_before + +local nodepool = nuts.pool + +local new_glue = nodepool.glue +local new_penalty = nodepool.penalty + +local nodecodes = nodes.nodecodes +local glyph_code = nodecodes.glyph + +local a_scriptstatus = attributes.private('scriptstatus') +local a_scriptinjection = attributes.private('scriptinjection') + +local categorytonumber = scripts.categorytonumber +local numbertocategory = scripts.numbertocategory +local hash = scripts.hash +local numbertodataset = scripts.numbertodataset + +-- can be shared: + +local fonthashes = fonts.hashes +local parameters = fonthashes.parameters + +local space, stretch, shrink, lastfont + +local inter_character_space_factor = 1 +local inter_character_stretch_factor = 1 +local inter_character_shrink_factor = 1 + +local function space_glue(current) + local data = numbertodataset[getattr(current,a_scriptinjection)] + if data then + inter_character_space_factor = data.inter_character_space_factor or 1 + inter_character_stretch_factor = data.inter_character_stretch_factor or 1 + inter_character_shrink_factor = data.inter_character_shrink_factor or 1 + end + local font = getfont(current) + if lastfont ~= font then + local pf = parameters[font] + space = pf.space + stretch = pf.space_stretch + shrink = pf.space_shrink + lastfont = font + end + return new_glue( + inter_character_space_factor * space, + inter_character_stretch_factor * stretch, + inter_character_shrink_factor * shrink + ) +end + +local function insert_space_after(head,current) + return insert_node_after(head,current,space_glue(current)) +end + +-- local function insert_space_before(head,current) +-- return insert_node_before(head,current,space_glue(current)) +-- end + +local function insert_zerowidthspace_before(head,current) + return insert_node_before(head,current,new_glue(0)) +end + +local function insert_nobreakspace_before(head,current) + head, current = insert_node_before(head,current,new_penalty(10000)) + return insert_node_before(head,current,space_glue(current)) +end + +-- more efficient is to check directly +-- +-- local b_tsheg = 0x0F0B -- breaking +-- local n_tsheg = 0x0F0C -- nonbreaking +-- +-- if char == b_tsheg then +-- head, current = insert_space_after(head,current) +-- end +-- +-- but this is more general + +local injectors = { + breaking_tsheg = insert_space_after, +} + +local function process(head,first,last) + if first ~= last then + local current = first + while current do + local char, id = ischar(current) + local scriptstatus = getattr(current,a_scriptstatus) + if scriptstatus and scriptstatus > 0 then + local category = numbertocategory[scriptstatus] + if category then + local injector = injectors[category] + if injector then + head, current = insert_space_after(head,current) + end + end + end + if current == last then + break + else + current = getnext(current) + end + end + end +end + +scripts.installmethod { + name = "tibetan", + injector = process, + datasets = { + default = { + inter_character_space_factor = 1, + inter_character_stretch_factor = 1, + inter_character_shrink_factor = 1, + }, + half = { + inter_character_space_factor = 0.5, + inter_character_stretch_factor = 0.5, + inter_character_shrink_factor = 0.5, + }, + quarter = { + inter_character_space_factor = 0.25, + inter_character_stretch_factor = 0.25, + inter_character_shrink_factor = 0.25, + }, + }, +} diff --git a/tex/context/base/mkiv/spac-ver.mkiv b/tex/context/base/mkiv/spac-ver.mkiv index e49784753..be1f7bdba 100644 --- a/tex/context/base/mkiv/spac-ver.mkiv +++ b/tex/context/base/mkiv/spac-ver.mkiv @@ -284,47 +284,50 @@ \unexpanded\def\smallbreak {\par - \ifdim\lastskip<\smallskipamount + \ifvmode\ifdim\lastskip<\smallskipamount \removelastskip - \penalty-50 + \penalty-\plusfifty \smallskip - \fi} + \fi\fi} \unexpanded\def\medbreak {\par - \ifdim\lastskip<\medskipamount + \ifvmode\ifdim\lastskip<\medskipamount \removelastskip - \penalty-100 + \penalty-\plusonehundred \medskip - \fi} + \fi\fi} \unexpanded\def\bigbreak {\par - \ifdim\lastskip<\bigskipamount + \ifvmode\ifdim\lastskip<\bigskipamount \removelastskip - \penalty-200 + \penalty-\plustwohundred \bigskip - \fi} + \fi\fi} -\unexpanded\def\break {\penalty-\plustenthousand} % can be hmode or vmode -\unexpanded\def\nobreak {\penalty \plustenthousand} % can be hmode or vmode -\unexpanded\def\allowbreak{\penalty \zeropoint} % can be hmode or vmode -\unexpanded\def\goodbreak {\par\penalty-500\relax} % forces vmode -\unexpanded\def\filbreak {\par\vfil\penalty-200\vfilneg} % forces vmode +\unexpanded\def\break {\penalty-\plustenthousand} % can be hmode or vmode +\unexpanded\def\nobreak {\penalty \plustenthousand} % can be hmode or vmode +\unexpanded\def\allowbreak{\penalty \zerocount} % can be hmode or vmode + +\unexpanded\def\goodbreak {\par\ifvmode\penalty-\plusfivehundred\relax\fi} % forces vmode +\unexpanded\def\filbreak {\par\ifvmode\vfil\penalty-\plustwohundred\vfilneg\fi} % forces vmode %D Made slightly more readable: \unexpanded\def\vglue {\afterassignment\spac_helpers_vglue_indeed\s_spac_lastskip=} \unexpanded\def\hglue {\afterassignment\spac_helpers_hglue_indeed\s_spac_lastskip=} -\unexpanded\def\topglue{\nointerlineskip\vglue-\topskip\vglue} +\unexpanded\def\topglue{\par\ifvmode\nointerlineskip\vglue-\topskip\vglue\fi} \def\spac_helpers_vglue_indeed {\par - \d_spac_prevdepth\prevdepth - \hrule\s!height\zeropoint - \nobreak - \vskip\s_spac_lastskip - \prevdepth\d_spac_prevdepth} + \ifvmode + \d_spac_prevdepth\prevdepth + \hrule\s!height\zeropoint + \nobreak + \vskip\s_spac_lastskip + \prevdepth\d_spac_prevdepth + \fi} \def\spac_helpers_hglue_indeed {\dontleavehmode diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 73d70bb17..407b77157 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 fd2363cb3..4e682b70b 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/strc-ren.mkiv b/tex/context/base/mkiv/strc-ren.mkiv index 526ae26c6..f34f897ae 100644 --- a/tex/context/base/mkiv/strc-ren.mkiv +++ b/tex/context/base/mkiv/strc-ren.mkiv @@ -197,14 +197,13 @@ \def\strc_rendering_start_placement {\bgroup \setsystemmode\currenthead - % \strc_rendering_initialize_alternatives \strc_rendering_initialize_dimensions - % \strc_rendering_initialize_line_state \reseteverypar % needed indeed \noindent % ipv \whitespace elders, na \forgetall ! \bgroup + \synctexpushline \edef\p_aligntitle{\headparameter\c!aligntitle}% \ifx\p_aligntitle\v!yes \strc_rendering_initialize_hsize_local @@ -372,6 +371,7 @@ \fi \fi \fi + \synctexpopline \egroup \egroup \ifconditional\headisdisplay diff --git a/tex/context/base/mkiv/strc-tag.lua b/tex/context/base/mkiv/strc-tag.lua index 889ed4608..eca886f3a 100644 --- a/tex/context/base/mkiv/strc-tag.lua +++ b/tex/context/base/mkiv/strc-tag.lua @@ -46,6 +46,7 @@ local lasttags = { } local stacksize = 0 local metadata = nil -- applied to the next element local documentdata = { } +local extradata = false local tags = structures.tags tags.taglist = taglist -- can best be hidden @@ -126,6 +127,7 @@ local properties = allocate { -- todo: more "record = true" to improve forma listcontent = { pdf = "P", nature = "mixed" }, listdata = { pdf = "P", nature = "mixed" }, listpage = { pdf = "Reference", nature = "mixed" }, + listtext = { pdf = "Span", nature = "inline" }, delimitedblock = { pdf = "BlockQuote", nature = "display" }, delimited = { pdf = "Quote", nature = "inline" }, @@ -206,6 +208,10 @@ local properties = allocate { -- todo: more "record = true" to improve forma combinationpair = { pdf = "Span", nature = "display" }, combinationcontent = { pdf = "Span", nature = "mixed" }, combinationcaption = { pdf = "Span", nature = "mixed" }, + + publications = { pdf = "Div", nature = "display" }, + publication = { pdf = "Div", nature = "mixed" }, + pubfld = { pdf = "Span", nature = "inline" }, } tags.properties = properties @@ -289,6 +295,20 @@ function tags.getmetadata() return documentdata or { } end +function tags.registerextradata(name,serializer) + if type(serializer) == "function" then + if extradata then + extradata[name] = serializer + else + extradata = { [name] = serializer } + end + end +end + +function tags.getextradata() + return extradata +end + function tags.start(tag,specification) if not enabled then codeinjections.enabletags() diff --git a/tex/context/base/mkiv/strc-tag.mkiv b/tex/context/base/mkiv/strc-tag.mkiv index c9a82f0ac..bcb8be304 100644 --- a/tex/context/base/mkiv/strc-tag.mkiv +++ b/tex/context/base/mkiv/strc-tag.mkiv @@ -107,6 +107,7 @@ \def\t!listcontent {listcontent} % P \def\t!listdata {listdata} % P \def\t!listpage {listpage} % Reference +\def\t!listtext {listtext} % Span \def\t!delimitedblock {delimited} % BlockQuote \def\t!delimited {delimited} % Quote @@ -164,6 +165,10 @@ \def\t!combinationcontent {combinationcontent} % Span \def\t!combinationcaption {combinationcaption} % Span +\def\t!publications {publications} % Span +\def\t!publication {publication} % Span +\def\t!pubfld {pubfld} % Span + % \setuptaglabeltext % [en] % [\t!document=document] diff --git a/tex/context/base/mkiv/symb-imp-mis.mkiv b/tex/context/base/mkiv/symb-imp-mis.mkiv index d2657512f..2320ea59a 100644 --- a/tex/context/base/mkiv/symb-imp-mis.mkiv +++ b/tex/context/base/mkiv/symb-imp-mis.mkiv @@ -21,34 +21,36 @@ \definesymbol [\v!none] [] -\definesymbol [bullet] [\textmath\bullet] -\definesymbol [dash] [\textmath-] -\definesymbol [star] [\textmath\star] -\definesymbol [triangle] [\textmath\triangleright] -\definesymbol [circle] [\textmath\circ] -\definesymbol [square] [\textmath\square] -\definesymbol [diamond] [\textmath\diamond] +% \definesymbol [bullet] [\textmath\bullet] +% \definesymbol [dash] [\textmath-] +% \definesymbol [star] [\textmath\star] +% \definesymbol [triangle] [\textmath\triangleright] +% \definesymbol [circle] [\textmath\circ] +% \definesymbol [square] [\textmath\square] +% \definesymbol [diamond] [\textmath\diamond] +% \definesymbol [asterisk] [\textmath\ast] % I'm not sure about this ... I dislike the small bullet. So we provide % it as variant: \type {\setupsymbolset[text]}. Also, we want to be % backward compatible. -\startsymbolset[text] +% \startsymbolset[text] \definesymbol [bullet] [\textormathchar{"2022}] % • \bullet \definesymbol [dash] [\textormathchar{"2013}] % – - \definesymbol [star] [\textormathchar{"22C6}] % ✴ \star + \definesymbol [star] [\textormathchar{"22C6}] % ⋆ \star \definesymbol [triangle] [\textormathchar{"22B3}] % ⊳ \triangleright \definesymbol [circle] [\textormathchar{"2218}] % ∘ \circ \definesymbol [square] [\textormathchar{"25A1}] % □ \square \definesymbol [diamond] [\textormathchar{"22C4}] % ⋄ \diamond \definesymbol [checkmark] [\textormathchar{"2713}] % ✓ \checkmark + \definesymbol [asterisk] [\textormathchar{"2217}] % ∗ \asterisk \definesymbol [blacktriangle] [\textormathchar{"25B6}] % ▶ \definesymbol [blacksquare] [\textormathchar{"25A0}] % ■ \definesymbol [blackdiamond] [\textormathchar{"25C6}] % ◆ -\stopsymbolset +% \stopsymbolset \definesymbol [smallcircle] [\hbox{\raise.1ex\hbox{\textmath{\scriptscriptstyle\bigcirc}}}] \definesymbol [medcircle] [\hbox{\raise.1ex\hbox{\textmath{\scriptstyle \bigcirc}}}] @@ -62,6 +64,7 @@ \definesymbol [6] [\symbol{medcircle}] \definesymbol [7] [\symbol{bigcircle}] \definesymbol [8] [\symbol{square}] +\definesymbol [9] [\symbol{checkmark}] \definesymbol [S] [\sectionmark] \definesymbol [P] [\paragraphmark] diff --git a/tex/context/base/mkiv/syst-ini.mkiv b/tex/context/base/mkiv/syst-ini.mkiv index 6e5ced525..1ca2bf1ac 100644 --- a/tex/context/base/mkiv/syst-ini.mkiv +++ b/tex/context/base/mkiv/syst-ini.mkiv @@ -475,8 +475,11 @@ \chardef \plusnine 9 \chardef \plusten 10 \chardef \plussixteen 16 +\chardef \plusfifty 50 \chardef \plushundred 100 +\chardef \plusonehundred 100 \chardef \plustwohundred 200 +\chardef \plusfivehundred 500 \chardef \pluscxxvii 127 \chardef \pluscxxviii 128 \chardef \pluscclv 255 diff --git a/tex/context/base/mkiv/trac-vis.lua b/tex/context/base/mkiv/trac-vis.lua index 6ae65509b..35c27cb57 100644 --- a/tex/context/base/mkiv/trac-vis.lua +++ b/tex/context/base/mkiv/trac-vis.lua @@ -71,6 +71,7 @@ local getshift = nuts.getshift local hpack_nodes = nuts.hpack local vpack_nodes = nuts.vpack local copy_list = nuts.copy_list +local copy_node = nuts.copy_node local flush_node_list = nuts.flush_list local insert_node_before = nuts.insert_before local insert_node_after = nuts.insert_after @@ -196,11 +197,13 @@ end local userrule -- bah, not yet defined: todo, delayed(nuts.rules,"userrule") local outlinerule -- bah, not yet defined: todo, delayed(nuts.rules,"userrule") -local function enable() +local function initialize() + -- if not usedfont then -- we use a narrow monospaced font -- infofont ? visualizers.setfont(fonts.definers.define { name = "lmmonoltcond10regular", size = tex.sp("4pt") }) end + -- for mode, value in next, modes do local tag = formatters["v_%s"](mode) attributes.viewerlayers.define { @@ -231,17 +234,25 @@ local function enable() l_line = layers.line l_space = layers.space l_depth = layers.depth - enableaction("shipouts","nodes.visualizers.handler") - report_visualize("enabled") - enabled = true - tex.setcount("global","c_syst_visualizers_state",1) -- so that we can optimize at the tex end -- if not userrule then userrule = nuts.rules.userrule end + -- if not outlinerule then outlinerule = nuts.pool.outlinerule end + initialize = false +end + +local function enable() + if initialize then + initialize() + end + enableaction("shipouts","nodes.visualizers.handler") + report_visualize("enabled") + enabled = true + tex.setcount("global","c_syst_visualizers_state",1) -- so that we can optimize at the tex end end local function setvisual(n,a,what,list) -- this will become more efficient when we have the bit lib linked in @@ -1570,3 +1581,57 @@ do } end + +-- Here for now: + +do + + local function make(str,forecolor,rulecolor,layer) + if initialize then + initialize() + end + local rule = new_rule(emwidth/fraction,exheight,4*exheight) + setcolor(rule,rulecolor) + settransparency(rule,rulecolor) + local info + if str == "" then + info = new_hlist(rule) + else + local text = hpack_string(str,usedfont) + local list = getlist(text) + setlistcolor(list,textcolor) + setlisttransparency(list,textcolor) + setshift(text,3.5 * exheight) + info = new_hlist(setlink(rule,text)) + end + setattr(info,a_layer,layer) + return info + end + + function visualizers.register(name,textcolor,rulecolor) + if rawget(layers,name) then + -- message + return + end + local cache = caches[name] + local layer = layers[name] + if not textcolor then + textcolor = c_text_d + end + if not rulecolor then + rulecolor = c_origin_d + end + return function(str) + if not str then + str = "" + end + local info = cache[str] + if not info then + info = make(str,textcolor,rulecolor,layer) + cache[str] = info + end + return copy_node(info) + end + end + +end diff --git a/tex/context/base/mkiv/typo-chr.lua b/tex/context/base/mkiv/typo-chr.lua index 1aa84f5ab..ecde8f000 100644 --- a/tex/context/base/mkiv/typo-chr.lua +++ b/tex/context/base/mkiv/typo-chr.lua @@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['typo-chr'] = { license = "see context related readme files" } +-- This module can be optimized. + -- local nodecodes = nodes.nodecodes -- local whatsitcodes = nodes.whatsitcodes -- local glyph_code = nodecodes.glyph @@ -79,12 +81,21 @@ if not modules then modules = { } end modules ['typo-chr'] = { local insert, remove = table.insert, table.remove local context = context +local ctx_doifelse = commands.doifelse local nodecodes = nodes.nodecodes +local subtypes = nodes.subtypes + local glyph_code = nodecodes.glyph local localpar_code = nodecodes.localpar +local boundary_code = nodecodes.boundary + +local word_code = nodes.boundarycodes.word + +local texgetnest = tex.getnest -- to be used + +local texsetcount = tex.setcount -local texnest = tex.nest local flush_node = node.flush_node local flush_list = node.flush_list @@ -106,7 +117,7 @@ local marked = { local stack = { } local function pickup() - local list = texnest[texnest.ptr] + local list = texgetnest() if list then local tail = list.tail if tail and tail.id == glyph_code and punctuation[tail.char] then @@ -177,7 +188,7 @@ end local actions = { remove = function(specification) - local list = texnest[texnest.ptr] + local list = texgetnest() if list then local head = list.head local tail = list.tail @@ -240,3 +251,95 @@ interfaces.implement { actions = markcontent, arguments = "string", } + +-- We just put these here. + +interfaces.implement { + name = "lastnodeidstring", + public = true, + actions = function() + local list = texgetnest() -- "top" + local okay = false + if list then + local tail = list.tail + if tail then + okay = nodecodes[tail.id] + end + end + context(okay or "") + end, +} + +-- local t_lastnodeid = token.create("c_syst_last_node_id") +-- +-- interfaces.implement { +-- name = "lastnodeid", +-- public = true, +-- actions = function() +-- ... +-- tex.setcount("c_syst_last_node_id",okay) +-- context.sprint(t_lastnodeid) +-- end, +-- } + +interfaces.implement { + name = "lastnodeid", + actions = function() + local list = texgetnest() -- "top" + local okay = -1 + if list then + local tail = list.tail + if tail then + okay = tail.id + end + end + texsetcount("c_syst_last_node_id",okay) + end, +} + +interfaces.implement { + name = "lastnodesubtypestring", + public = true, + actions = function() + local list = texgetnest() -- "top" + local okay = false + if list then + local tail = list.tail + if head then + okay = subtypes[tail.id][tail.subtype] + end + end + context(okay or "") + end, +} + +local function lastnodeequals(id,subtype) + local list = texgetnest() -- "top" + local okay = false + if list then + local tail = list.tail + if tail then + local i = tail.id + okay = i == id or i == nodecodes[id] + if subtype then + local s = tail.subtype + okay = s == subtype or s == subtypes[i][subtype] + end + end + end + ctx_doifelse(okay) +end + +interfaces.implement { + name = "lastnodeequals", + arguments = "2 strings", + actions = lastnodeequals, +} + +interfaces.implement { + name = "atwordboundary", + actions = function() + lastnodeequals(boundary_code,word_code) + end, +} + diff --git a/tex/context/base/mkiv/typo-chr.mkiv b/tex/context/base/mkiv/typo-chr.mkiv index c92c4562e..365c79e51 100644 --- a/tex/context/base/mkiv/typo-chr.mkiv +++ b/tex/context/base/mkiv/typo-chr.mkiv @@ -79,4 +79,23 @@ \def\typo_marked_remove[#1]% {\clf_pickupmarkedcontent action{remove}mark{#1}\relax} +%D A few helpers (put here for convenience): +%D +%D \starttyping +%D test test\doifelselastnode{boundary}{word}{YES}{NOP}test +%D test test\wordboundary \doifelselastnode{boundary}{word}{YES}{NOP}test +%D test test\wordboundary \doifelseatwordboundary{YES}{NOP}test +%D test test \lastnodeidstring test +%D test test\lastnodeidstring test +%D test test\number\lastnodeid test +%D \stoptyping + +\newcount\c_syst_last_node_id + +\unexpanded\def\doifelselastnode {\clf_lastnodeequals} +\unexpanded\def\doifelseatwordboundary{\clf_atwordboundary} +\unexpanded\def\lastnodeid {\clf_lastnodeid\c_syst_last_node_id} +% \lastnodeidstring % public expandable +% \lastnodesubstring % public expandable + \protect \endinput diff --git a/tex/context/base/mkiv/typo-del.mkiv b/tex/context/base/mkiv/typo-del.mkiv index 0770be5af..2ce98841e 100644 --- a/tex/context/base/mkiv/typo-del.mkiv +++ b/tex/context/base/mkiv/typo-del.mkiv @@ -71,35 +71,48 @@ \setnewconstant\boundarycharactermode\plusone +% old: skip symbol skip +% new: bound skip symbol skip bound + \unexpanded\def\midboundarycharacter#1#2% {\ifcase\boundarycharactermode \or - %\nobreak + \removeunwantedspaces + \wordboundary \hskip\hspaceamount\currentusedlanguage{#2}% \usedlanguageparameter#1% - %\nobreak \hskip\hspaceamount\currentusedlanguage{#2}% + \wordboundary + \ignorespaces \or \usedlanguageparameter#1% \fi \boundarycharactermode\plusone} +% old: symbol nobreak skip +% new: symbol nobreak skip wordboundary + \unexpanded\def\leftboundarycharacter#1#2% {\ifcase\boundarycharactermode \or \usedlanguageparameter#1% \nobreak - \hskip\hspaceamount\currentusedlanguage{#2}% + \hskip\hspaceamount\currentusedlanguage{#2}% why not a kern + \wordboundary \or \usedlanguageparameter#1% \fi \boundarycharactermode\plusone} +% old: preword skip symbol +% new: bound nobreak skip symbol + \unexpanded\def\rightboundarycharacter#1#2% {\ifcase\boundarycharactermode \or - \prewordbreak %\nobreak - \hskip\hspaceamount\currentusedlanguage{#2}% + \wordboundary + \nobreak + \hskip\hspaceamount\currentusedlanguage{#2}% why not a kern \usedlanguageparameter#1% \or \usedlanguageparameter#1% @@ -212,11 +225,15 @@ %D \typebuffer %D \getbuffer -\unexpanded\def\startsubsentence{\beginofsubsentence\prewordbreak\beginofsubsentencespacing\typo_subsentence_cleanup_start} -\unexpanded\def\stopsubsentence {\typo_subsentence_cleanup_stop\endofsubsentencespacing\prewordbreak\endofsubsentence} +%unexpanded\def\startsubsentence{\beginofsubsentence\prewordbreak\beginofsubsentencespacing\typo_subsentence_cleanup_start} +%unexpanded\def\stopsubsentence {\typo_subsentence_cleanup_stop\endofsubsentencespacing\prewordbreak\endofsubsentence} +%unexpanded\def\subsentence {\groupedcommandcs\startsubsentence\stopsubsentence} +%unexpanded\def\midsubsentence {\typo_subsentence_cleanup_start\prewordbreak\midsentence\prewordbreak\typo_subsentence_cleanup_stop} + +\unexpanded\def\startsubsentence{\beginofsubsentence\wordboundary\beginofsubsentencespacing\wordboundary\typo_subsentence_cleanup_start} +\unexpanded\def\stopsubsentence {\typo_subsentence_cleanup_stop\wordboundary\endofsubsentencespacing\wordboundary\endofsubsentence} \unexpanded\def\subsentence {\groupedcommandcs\startsubsentence\stopsubsentence} -%unexpanded\def\subsentence {\groupedcommand\startsubsentence\stopsubsentence} -\unexpanded\def\midsubsentence {\typo_subsentence_cleanup_start\prewordbreak\midsentence\prewordbreak\typo_subsentence_cleanup_stop} +\unexpanded\def\midsubsentence {\typo_subsentence_cleanup_start\wordboundary\midsentence\wordboundary\typo_subsentence_cleanup_stop} \definehspace [quotation] [\zeropoint] \definehspace [interquotation] [.125em] @@ -419,6 +436,8 @@ \dostoptagged \ignorespaces} +\newconditional\c_typo_delimited_repeating + \def\typo_delimited_start_other {\edef\p_delimited_repeat{\delimitedtextparameter\c!repeat}% \ifx\p_delimited_repeat\v!yes @@ -426,6 +445,7 @@ \else \let\typo_delimited_repeat\relax \fi + \setfalse\c_typo_delimited_repeating \edef\p_delimited_location{\delimitedtextparameter\c!location}% \ifx\p_delimited_location\v!paragraph \singleexpandafter\typo_delimited_start_par @@ -685,30 +705,37 @@ % test test test % \stoptext -\def\typo_delimited_handle_middle#1% - {\typo_delimited_stop_content - \begingroup - \usedelimitedtextstyleandcolor\c!symstyle\c!symcolor - \setbox\scratchbox\hbox{\delimitedtextparameter#1}% - \ifdim\wd\scratchbox>\zeropoint - \ifdim\lastkern=\d_typo_delimited_signal - \unkern - \hskip\hspaceamount\currentusedlanguage{interquotation}% - \fi - \ifhmode % else funny pagebeaks - \penalty\plustenthousand - \hskip\zeropoint % == \prewordbreak +% We have no real test case for this and it's broken already for a while, +% even in \MKII. Maybe we should to this in \LUA. Only Italian has the +% middlespeech parameter set. + +\def\typo_delimited_handle_middle#1% special case + {\ifconditional\c_typo_delimited_repeating + \begingroup + \usedelimitedtextstyleandcolor\c!symstyle\c!symcolor + \setbox\scratchbox\hbox{\delimitedtextparameter#1}% + \ifdim\wd\scratchbox>\zeropoint + \ifdim\lastkern=\d_typo_delimited_signal + \unkern + \hskip\hspaceamount\currentusedlanguage{interquotation}% + \else % maybe an option: + %\edef\p_delimited_margin{\delimitedtextparameter\c!location}% + %\ifx\p_delimited_margin\v!margin + % \hskip-\wd\scratchbox + %\fi + \fi + \strut % new, needed below + \dostarttagged\t!delimitedsymbol\empty + \dotagsetdelimitedsymbol\s!middle + \delimitedtextparameter#1% unhbox\scratchbox + \dostoptagged + % \penalty\plustenthousand % else overfull boxes, but that's better than dangling periods + \kern\d_typo_delimited_signal % +- \prewordbreak \fi - \strut % new, needed below - \dostarttagged\t!delimitedsymbol\empty - \dotagsetdelimitedsymbol\s!middle - \delimitedtextparameter#1% unhbox\scratchbox - \dostoptagged - % \penalty\plustenthousand % else overfull boxes, but that's better than dangling periods - \kern\d_typo_delimited_signal % +- \prewordbreak - \fi - \endgroup - \typo_delimited_start_content} + \endgroup + \else + \settrue\c_typo_delimited_repeating + \fi} \def\typo_delimited_handle_left#1% {\begingroup @@ -722,11 +749,11 @@ \unskip \hskip\hspaceamount\currentusedlanguage{interquotation}% \fi\fi - \strut % new, needed below - \ifhmode % else funny pagebeaks - \penalty\plustenthousand - \hskip\zeropoint % == \prewordbreak - \fi + % \strut % new, needed below + % \ifhmode % else funny pagebeaks + % \penalty\plustenthousand + % \hskip\zeropoint % == \prewordbreak + % \fi \strut % new, needed below \dostarttagged\t!delimitedsymbol\empty \dotagsetdelimitedsymbol\s!left diff --git a/tex/context/interface/mkiv/context-en.xml b/tex/context/interface/mkiv/context-en.xml index 77df95e90..4d624ef20 100644 --- a/tex/context/interface/mkiv/context-en.xml +++ b/tex/context/interface/mkiv/context-en.xml @@ -3744,6 +3744,13 @@ </cd:keywords> </cd:arguments> </cd:command> + <cd:command category="characters fonts" file="char-ini.mkiv" level="style" name="textormathchars"> + <cd:arguments> + <cd:keywords delimiters="braces"> + <cd:constant type="cd:character"/> + </cd:keywords> + </cd:arguments> + </cd:command> <cd:command category="characters" file="char-ini.mkiv" level="style" name="chardescription"> <cd:arguments> <cd:keywords delimiters="braces"> @@ -35163,6 +35170,16 @@ </cd:keywords> </cd:arguments> </cd:command> + <cd:command file="core-env.mkiv" level="system" name="copysetups"> + <cd:arguments> + <cd:keywords> + <cd:constant type="cd:name"/> + </cd:keywords> + <cd:keywords> + <cd:constant type="cd:name"/> + </cd:keywords> + </cd:arguments> + </cd:command> <cd:command file="core-env.mkiv" level="system" name="showsetupsdefinition"> <cd:arguments> <cd:keywords> diff --git a/tex/context/interface/mkiv/i-character.xml b/tex/context/interface/mkiv/i-character.xml index c391836d5..61d6a32a6 100644 --- a/tex/context/interface/mkiv/i-character.xml +++ b/tex/context/interface/mkiv/i-character.xml @@ -87,6 +87,12 @@ </cd:arguments> </cd:command> + <cd:command name="textormathchars" level="style" category="characters fonts" file="char-ini.mkiv"> + <cd:arguments> + <cd:resolve name="argument-character"/> + </cd:arguments> + </cd:command> + <cd:command name="chardescription" level="style" category="characters" file="char-ini.mkiv"> <cd:arguments> <cd:resolve name="argument-number"/> @@ -141,4 +147,4 @@ <cd:command name="textplus" level="document" category="characters" file="enco-ini.mkiv"/> -</cd:interface>
\ No newline at end of file +</cd:interface> diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex f2279cf49..f405eb969 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex 4a0d5e8bb..13d951b1d 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/context/interface/mkiv/i-setups.xml b/tex/context/interface/mkiv/i-setups.xml index df7281e74..a3773e8f7 100644 --- a/tex/context/interface/mkiv/i-setups.xml +++ b/tex/context/interface/mkiv/i-setups.xml @@ -64,6 +64,13 @@ </cd:arguments> </cd:command> + <cd:command name="copysetups" level="system" file="core-env.mkiv"> + <cd:arguments> + <cd:resolve name="keyword-name"/> + <cd:resolve name="keyword-name"/> + </cd:arguments> + </cd:command> + <cd:command name="showsetupsdefinition" level="system" file="core-env.mkiv"> <cd:arguments> <cd:resolve name="keyword-name"/> @@ -221,4 +228,4 @@ </cd:arguments> </cd:command> -</cd:interface>
\ No newline at end of file +</cd:interface> diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 9714f39bb..6c08ea2b2 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 : 07/20/18 21:20:26 +-- merge date : 07/25/18 19:41:46 do -- begin closure to overcome local limits and interference @@ -22856,6 +22856,7 @@ local function copytotfm(data,cache_id) local fontname=metadata.fontname local fullname=metadata.fullname or fontname local psname=fontname or fullname + local subfont=metadata.subfontindex local units=metadata.units or 1000 if units==0 then units=1000 @@ -22943,6 +22944,7 @@ local function copytotfm(data,cache_id) properties.fullname=fullname properties.psname=psname properties.name=filename or fullname + properties.subfont=subfont properties.private=properties.private or data.private or privateoffset return { characters=characters, @@ -32623,7 +32625,7 @@ function afm.load(filename) local name=file.removesuffix(file.basename(filename)) local data=containers.read(afm.cache,name) local attr=lfs.attributes(filename) - local size,time=attr.size or 0,attr.modification or 0 + local size,time=attr and attr.size or 0,attr and attr.modification or 0 local pfbfile=file.replacesuffix(name,"pfb") local pfbname=resolvers.findfile(pfbfile,"pfb") or "" if pfbname=="" then |