diff options
Diffstat (limited to 'tex/context')
26 files changed, 564 insertions, 120 deletions
diff --git a/tex/context/base/cont-fil.mkiv b/tex/context/base/cont-fil.mkiv index 0b239a977..b0eff65ff 100644 --- a/tex/context/base/cont-fil.mkiv +++ b/tex/context/base/cont-fil.mkiv @@ -73,8 +73,6 @@ \definefilesynonym [pre-cycle] [pre-22] \definefilesynonym [pre-super] [pre-23] -\definefilesynonym [pre-41] [present-tiles] - %definefilesynonym [pre-more] [pre-24] %definefilesynonym [pre-more] [pre-25] \definefilesynonym [pre-more] [pre-26] @@ -104,4 +102,10 @@ \definefilesynonym [memo] [cor-02] \definefilesynonym [resume] [cor-03] +% downward compatible mapping: + +\definefilesynonym [pre-41] [present-tiles] +\definefilesynonym [fnt-33] [math-coverage] +\definefilesynonym [mat-20] [math-parameters] + \endinput diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 2fd5325d7..9be65f061 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2013.05.15 09:58} +\newcontextversion{2013.05.16 00:29} %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/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex e80a39ade..152b4c095 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 8e8304ef3..1b457ac5e 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2013.05.15 09:58} +\edef\contextversion{2013.05.16 00:29} \edef\contextkind {beta} %D For those who want to use this: @@ -198,8 +198,6 @@ \loadmarkfile{lang-mis} \loadmarkfile{lang-url} \loadmarkfile{lang-def} -\loadmarkfile{lang-wrd} % can be optional -%loadmarkfile{lang-rep} % can be optional (will be added after the 2013 code freeze, maybe nice for a ctx 2013 presentation) \loadmkvifile{file-job} % why so late? @@ -393,6 +391,9 @@ \loadmarkfile{scrp-ini} +\loadmarkfile{lang-wrd} % can be optional (discussion with mm sideeffect) +%loadmarkfile{lang-rep} % can be optional (bt 2013 side effect) + \loadmarkfile{prop-ini} % only for downward compatibility \loadmarkfile{mlib-ctx} diff --git a/tex/context/base/font-ctx.lua b/tex/context/base/font-ctx.lua index c894660d5..ae42ed18e 100644 --- a/tex/context/base/font-ctx.lua +++ b/tex/context/base/font-ctx.lua @@ -68,7 +68,9 @@ local lastmathids = hashes.lastmathids local designsizefilename = fontgoodies.designsizes.filename -local otffeatures = handlers.otf.features +local otffeatures = otf.features +local otftables = otf.tables + local registerotffeature = otffeatures.register local baseprocessors = otffeatures.processors.base local baseinitializers = otffeatures.initializers.base @@ -159,7 +161,9 @@ local needsnodemode = { gpos_mark2ligature = true, } -fonts.handlers.otf.tables.scripts.auto = "automatic fallback to latn when no dflt present" +otftables.scripts.auto = "automatic fallback to latn when no dflt present" + +-- setmetatableindex(otffeatures.descriptions,otftables.features) local privatefeatures = { tlig = true, diff --git a/tex/context/base/font-otf.lua b/tex/context/base/font-otf.lua index 6f4a54309..c1f2f14fc 100644 --- a/tex/context/base/font-otf.lua +++ b/tex/context/base/font-otf.lua @@ -2065,7 +2065,7 @@ end registerotffeature { name = "mathsize", - description = "apply mathsize as specified in the font", + description = "apply mathsize specified in the font", initializers = { base = checkmathsize, node = checkmathsize, diff --git a/tex/context/base/font-ott.lua b/tex/context/base/font-ott.lua index 8a5579c02..e3aacd0d1 100644 --- a/tex/context/base/font-ott.lua +++ b/tex/context/base/font-ott.lua @@ -771,7 +771,7 @@ local function resolve(t,k) end end end - return "dflt" + return k -- "dflt" end setmetatableindex(features, resolve) diff --git a/tex/context/base/l-file.lua b/tex/context/base/l-file.lua index acb4216b0..f25490749 100644 --- a/tex/context/base/l-file.lua +++ b/tex/context/base/l-file.lua @@ -62,7 +62,7 @@ elseif not lfs.isfile then end local insert, concat = table.insert, table.concat -local match, find = string.match, string.find +local match, find, gmatch = string.match, string.find, string.gmatch local lpegmatch = lpeg.match local getcurrentdir, attributes = lfs.currentdir, lfs.attributes local checkedsplit = string.checkedsplit @@ -572,3 +572,19 @@ end -- return f(...) -- end -- end + +-- a goodie: a dumb version of mkdirs: + +function lfs.mkdirs(path) + local full + for sub in gmatch(path,"([^\\/]+)") do + if full then + full = full .. "/" .. sub + else + full = sub + end + if not lfs.isdir(full) then + lfs.mkdir(full) + end + end +end diff --git a/tex/context/base/s-art-01.mkiv b/tex/context/base/s-art-01.mkiv index 046c35cc1..5ef53ebe0 100644 --- a/tex/context/base/s-art-01.mkiv +++ b/tex/context/base/s-art-01.mkiv @@ -12,7 +12,7 @@ \c!footer=0pt] \setupbodyfont - [dejavu] + [dejavu,10pt] % 12pt is just to large and we use this for all kind of demos \setupwhitespace [\v!big] diff --git a/tex/context/base/s-fonts-features.lua b/tex/context/base/s-fonts-features.lua new file mode 100644 index 000000000..4ee143204 --- /dev/null +++ b/tex/context/base/s-fonts-features.lua @@ -0,0 +1,74 @@ +if not modules then modules = { } end modules ['s-fonts-features'] = { + version = 1.001, + comment = "companion to s-fonts-features.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +moduledata.fonts = moduledata.fonts or { } +moduledata.fonts.features = moduledata.fonts.features or { } + +-- for the moment only otf + +local NC, NR, bold = context.NC, context.NR, context.bold + +function moduledata.fonts.features.showused(specification) + + specification = interfaces.checkedspecification(specification) + + -- local list = utilities.parsers.settings_to_set(specification.list or "all") + + context.starttabulate { "|T|T|T|T|T|" } + + context.HL() + + NC() bold("feature") + NC() + NC() bold("description") + NC() bold("value") + NC() bold("internal") + NC() NR() + + context.HL() + + local usedfeatures = fonts.handlers.otf.statistics.usedfeatures + local features = fonts.handlers.otf.tables.features + local descriptions = fonts.handlers.otf.features.descriptions + + for feature, keys in table.sortedhash(usedfeatures) do + -- if list.all or (list.otf and rawget(features,feature)) or (list.extra and rawget(descriptions,feature)) then + local done = false + for k, v in table.sortedhash(keys) do + if done then + NC() + NC() + NC() + elseif rawget(descriptions,feature) then + NC() context(feature) + NC() context("+") -- extra + NC() context(descriptions[feature]) + done = true + elseif rawget(features,feature) then + NC() context(feature) + NC() -- otf + NC() context(features[feature]) + done = true + else + NC() context(feature) + NC() context("-") -- unknown + NC() + done = true + end + NC() context(k) + NC() context(tostring(v)) + NC() NR() + end + -- end + end + + context.HL() + + context.stoptabulate() + +end diff --git a/tex/context/base/s-fonts-features.mkiv b/tex/context/base/s-fonts-features.mkiv new file mode 100644 index 000000000..410bc13d3 --- /dev/null +++ b/tex/context/base/s-fonts-features.mkiv @@ -0,0 +1,27 @@ +%D \module +%D [ file=s-fonts-features, % was s-fnt-41, +%D version=2012.11.27, % older probably +%D title=\CONTEXT\ Style File, +%D subtitle=Features, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\registerctxluafile{s-fonts-features}{} + +\installmodulecommandluasingle \showusedfeatures {moduledata.fonts.features.showused} + +\continueifinputfile{s-fonts-features.mkiv} + +\usemodule + [art-01] + +\starttext + + \showusedfeatures + +\stoptext diff --git a/tex/context/base/s-math-coverage.lua b/tex/context/base/s-math-coverage.lua new file mode 100644 index 000000000..05a311ee6 --- /dev/null +++ b/tex/context/base/s-math-coverage.lua @@ -0,0 +1,143 @@ +if not modules then modules = { } end modules ['s-math-coverage'] = { + version = 1.001, + comment = "companion to s-math-coverage.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +moduledata.math = moduledata.math or { } +moduledata.math.coverage = moduledata.math.coverage or { } + +local utfchar, utfbyte = utf.char, utf.byte + +local ucgreek = { + 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, + 0x0396, 0x0397, 0x0398, 0x0399, 0x039A, + 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, + 0x03A0, 0x03A1, 0x03A3, 0x03A4, 0x03A5, + 0x03A6, 0x03A7, 0x03A8, 0x03A9 +} + +local lcgreek = { + 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, + 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, + 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, + 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, + 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9, + 0x03D1, 0x03D5, 0x03D6, 0x03F0, 0x03F1, + 0x03F4, 0x03F5 +} + +local ucletters = { + 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, + 0x00046, 0x00047, 0x00048, 0x00049, 0x0004A, + 0x0004B, 0x0004C, 0x0004D, 0x0004E, 0x0004F, + 0x00050, 0x00051, 0x00052, 0x00053, 0x00054, + 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, + 0x0005A, +} + +local lcletters = { + 0x00061, 0x00062, 0x00063, 0x00064, 0x00065, + 0x00066, 0x00067, 0x00068, 0x00069, 0x0006A, + 0x0006B, 0x0006C, 0x0006D, 0x0006E, 0x0006F, + 0x00070, 0x00071, 0x00072, 0x00073, 0x00074, + 0x00075, 0x00076, 0x00077, 0x00078, 0x00079, + 0x0007A, +} + +local digits = { + 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, + 0x00035, 0x00036, 0x00037, 0x00038, 0x00039, +} + +local styles = { + "regular", "sansserif", "monospaced", "fraktur", "script", "blackboard" +} + +local alternatives = { + "normal", "bold", "italic", "bolditalic" +} + +local alphabets = { + ucletters, lcletters, ucgreek, lcgreek, digits, +} + +local getboth = mathematics.getboth +local remapalphabets = mathematics.remapalphabets + +function moduledata.math.coverage.showalphabets() + context.starttabulate { "|lT|l|Tl|" } + for i=1,#styles do + local style = styles[i] + for i=1,#alternatives do + local alternative = alternatives[i] + for i=1,#alphabets do + local alphabet = alphabets[i] + context.NC() + if i == 1 then + context("%s %s",style,alternative) + end + context.NC() + context.startimath() + context.setmathattribute(style,alternative) + for i=1,#alphabet do + local letter = alphabet[i] + local id = getboth(style,alternative) + local unicode = remapalphabets(letter,id) + if not unicode then + context.underbar(utfchar(letter)) + elseif unicode == letter then + context(utfchar(unicode)) + else + context(utfchar(unicode)) + end + end + context.stopimath() + context.NC() + local first = alphabet[1] + local last = alphabet[#alphabet] + local id = getboth(style,alternative) + local f_unicode = remapalphabets(first,id) or utfbyte(first) + local l_unicode = remapalphabets(last,id) or utfbyte(last) + context("%05X - %05X",f_unicode,l_unicode) + context.NC() + context.NR() + end + end + end + context.stoptabulate() +end + +function moduledata.math.coverage.showcharacters() + local NC, NR, getglyph, concat = context.NC, context.NR, context.getglyph, table.concat + context.startcolumns() + context.setupalign { "nothyphenated" } + context.starttabulate { "|T|i2|Tpl|" } + for u, d in table.sortedpairs(characters.data) do + local mathclass = d.mathclass + local mathspec = d.mathspec + if mathclass or mathspec then + NC() + context("%05X",u) + NC() + getglyph("MathRoman",u) + NC() + if mathspec then + local t = { } + for i=1,#mathspec do + t[mathspec[i].class] = true + end + t = table.sortedkeys(t) + context(concat(t," ")) + else + context(mathclass) + end + NC() + NR() + end + end + context.stoptabulate() + context.stopcolumns() +end diff --git a/tex/context/base/s-math-coverage.mkiv b/tex/context/base/s-math-coverage.mkiv new file mode 100644 index 000000000..cbac318ee --- /dev/null +++ b/tex/context/base/s-math-coverage.mkiv @@ -0,0 +1,37 @@ +%D \module +%D [ file=s-math-coverage, % s-fnt-33, +%D version=2011.05.10, % about then +%D title=\CONTEXT\ Style File, +%D subtitle=Show Math Coverage, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\registerctxluafile{s-math-coverage}{} + +\installmodulecommandluasingle \showmathalphabets {moduledata.math.coverage.showalphabets} +\installmodulecommandluasingle \showmathcharacters {moduledata.math.coverage.showcharacters} + +\continueifinputfile{s-math-coverage.mkiv} + +\setupbodyfont + [modern] + +\setuplayout + [backspace=1cm, + topspace=1cm, + header=1cm, + footer=1cm, + width=middle, + height=middle] + +\starttext + + \showmathalphabets \page + \showmathcharacters \page + +\stoptext diff --git a/tex/context/base/s-mat-20.mkiv b/tex/context/base/s-math-parameters.lua index 544612fec..8e8c15a2d 100644 --- a/tex/context/base/s-mat-20.mkiv +++ b/tex/context/base/s-math-parameters.lua @@ -1,17 +1,13 @@ -%D \module -%D [ file=s-mat-20.mkiv, -%D version=2012.12.05, -%D title=\CONTEXT\ Style File, -%D subtitle=Math Tracing Macros, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. +if not modules then modules = { } end modules ['s-math-coverage'] = { + version = 1.001, + comment = "companion to s-math-coverage.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} -\startluacode +moduledata.math = moduledata.math or { } +moduledata.math.parameters = moduledata.math.parameters or { } local tables = utilities.tables.definedtable("math","tracing","spacing","tables") @@ -61,7 +57,7 @@ function tables.strippt(old) return new end -function tables.showspacing() +function moduledata.math.parameters.showspacing() local styles = tables.styles local styleaxis = tables.styleaxis @@ -103,7 +99,7 @@ function tables.showspacing() context.stoptabulate() end -function tables.showparameters() +function moduledata.math.parameters.showparameters() local styles = tables.styles local parameters = tables.parameters @@ -137,25 +133,3 @@ function tables.showparameters() context.stoptabulate() end - -\stopluacode - -\continueifinputfile{s-mat-20.mkiv} - -\setuplayout - [width=middle, - height=middle, - backspace=1cm, - topspace=1cm, - footer=0pt, - header=0pt] - -\setupbodyfont - [dejavu,8pt] - -\starttext - - \ctxlua{math.tracing.spacing.tables.showspacing()} - % \ctxlua{math.tracing.spacing.tables.showparameters()} - -\stoptext diff --git a/tex/context/base/s-math-parameters.mkiv b/tex/context/base/s-math-parameters.mkiv new file mode 100644 index 000000000..3b9089f84 --- /dev/null +++ b/tex/context/base/s-math-parameters.mkiv @@ -0,0 +1,37 @@ +%D \module +%D [ file=s-math-parameters.mkiv, +%D version=2012.12.05, +%D title=\CONTEXT\ Style File, +%D subtitle=Show Math Parameters, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\registerctxluafile{s-math-parameters}{} + +\installmodulecommandluasingle \showmathspacing {moduledata.math.parameters.showspacing} +\installmodulecommandluasingle \showmathparameters {moduledata.math.parameters.showparameters} + +\continueifinputfile{s-math-parameters.mkiv} + +\setuplayout + [width=middle, + height=middle, + backspace=1cm, + topspace=1cm, + footer=0pt, + header=0pt] + +\setupbodyfont + [dejavu,8pt] + +\starttext + + \showmathspacing \page + \showmathparameters \page + +\stoptext diff --git a/tex/context/base/s-mat-12.mkiv b/tex/context/base/s-math-repertoire.mkiv index deb28975c..5c9a3e8a3 100644 --- a/tex/context/base/s-mat-12.mkiv +++ b/tex/context/base/s-math-repertoire.mkiv @@ -1,6 +1,17 @@ -\usemodule[s][mat-10] +%D \module +%D [ file=s-math-parameters.mkiv, % was s-mat-12.mkiv +%D version=2012.06.06, % whatever, probably a bit earlier +%D title=\CONTEXT\ Style File, +%D subtitle=Show Math Character Repertoire, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. -% \enabletrackers[pages.timing] +\usemodule[s][mat-10] % todo: mode for screen % todo: variant for HD with one menu at the right (with include menu) @@ -49,7 +60,9 @@ \setupbackgrounds [text][text] - [bottomframe=on,framecolor=textcolor,rulethickness=0.025ex] + [bottomframe=on, + framecolor=textcolor, + rulethickness=0.025ex] \setupmakeup [standard] @@ -385,22 +398,35 @@ % done -\continueifinputfile{s-mat-12.mkiv} +\continueifinputfile{s-math-repertoire.mkiv} -\setmathfontlistbodyfonts{lucidanova,cambria,xits,modern,pagella} +\setmathfontlistbodyfonts{lucidanova,cambria,xits,modern,pagella,termes,bonum} \starttext -% \setupbodyfont[cambria, 12pt] \showmathfontcharacters -% \setupbodyfont[modern, 12pt] \showmathfontcharacters -% \setupbodyfont[lmvirtual,12pt] \showmathfontcharacters -% \setupbodyfont[pxvirtual,12pt] \showmathfontcharacters -% \setupbodyfont[txvirtual,12pt] \showmathfontcharacters -% \setupbodyfont[palatino, 10pt] \showmathfontcharacters -% \setupbodyfont[mathtimes,12pt] \showmathfontcharacters -% \setupbodyfont[stix, 12pt] \showmathfontcharacters -% \setupbodyfont[xits, 12pt] \showmathfontcharacters -% \setupbodyfont[lucida, 12pt] \showmathfontcharacters -% \setupbodyfont[lucidanova, 12pt] \showmathfontcharacters - \setupbodyfont[pagella, 12pt] \showmathfontcharacters + + \doifelse {\getdocumentargument{bodyfont}} {} { + + \setupbodyfont[cambria, 12pt] + % \setupbodyfont[modern, 12pt] + % \setupbodyfont[lmvirtual, 12pt] + % \setupbodyfont[pxvirtual, 12pt] + % \setupbodyfont[txvirtual, 12pt] + % \setupbodyfont[palatino, 10pt] + % \setupbodyfont[mathtimes, 12pt] + % \setupbodyfont[stix, 12pt] + % \setupbodyfont[xits, 12pt] + % \setupbodyfont[lucida, 12pt] + % \setupbodyfont[lucidanova,12pt] + % \setupbodyfont[pagella, 12pt] + % \setupbodyfont[bonum, 12pt] + + } { + + \normalexpanded{\setupbodyfont[\getdocumentargument{bodyfont},12pt]} + + } + + \showmathfontcharacters + \stoptext diff --git a/tex/context/base/scrp-cjk.lua b/tex/context/base/scrp-cjk.lua index 487d5a267..f7167b45c 100644 --- a/tex/context/base/scrp-cjk.lua +++ b/tex/context/base/scrp-cjk.lua @@ -31,8 +31,8 @@ local glyph_code = nodecodes.glyph local glue_code = nodecodes.glue local userskip_code = skipcodes.userskip -local a_prestat = attributes.private('prestat') -local a_preproc = attributes.private('preproc') +local a_scriptstatus = attributes.private('scriptstatus') +local a_scriptinjection = attributes.private('scriptinjection') local categorytonumber = scripts.categorytonumber local numbertocategory = scripts.numbertocategory @@ -425,7 +425,7 @@ local function process(head,first,last) while true do local upcoming, id = first.next, first.id if id == glyph_code then - local a = first[a_prestat] + local a = first[a_scriptstatus] local current = numbertocategory[a] local action = injectors[previous] if action then @@ -434,7 +434,7 @@ local function process(head,first,last) local font = first.font if font ~= lastfont then lastfont = font - set_parameters(font,numbertodataset[first[a_preproc]]) + set_parameters(font,numbertodataset[first[a_scriptinjection]]) end action(head,first) end @@ -445,7 +445,7 @@ local function process(head,first,last) if p and n then local pid, nid = p.id, n.id if pid == glyph_code and nid == glyph_code then - local pa, na = p[a_prestat], n[a_prestat] + local pa, na = p[a_scriptstatus], n[a_scriptstatus] local pcjk, ncjk = pa and numbertocategory[pa], na and numbertocategory[na] if not pcjk or not ncjk or pcjk == "korean" or ncjk == "korean" @@ -476,7 +476,7 @@ end scripts.installmethod { name = "hangul", - process = process, + injector = process, datasets = { -- todo: metatables default = { inter_char_shrink_factor = 0.50, -- of quad @@ -646,7 +646,7 @@ local function process(head,first,last) while true do local upcoming, id = first.next, first.id if id == glyph_code then - local a = first[a_prestat] + local a = first[a_scriptstatus] local current = numbertocategory[a] local action = injectors[previous] if action then @@ -655,7 +655,7 @@ local function process(head,first,last) local font = first.font if font ~= lastfont then lastfont = font - set_parameters(font,numbertodataset[first[a_preproc]]) + set_parameters(font,numbertodataset[first[a_scriptinjection]]) end action(head,first) end @@ -666,7 +666,7 @@ local function process(head,first,last) if p and n then local pid, nid = p.id, n.id if pid == glyph_code and nid == glyph_code then - local pa, na = p[a_prestat], n[a_prestat] + local pa, na = p[a_scriptstatus], n[a_scriptstatus] local pcjk, ncjk = pa and numbertocategory[pa], na and numbertocategory[na] if not pcjk or not ncjk or pcjk == "korean" or ncjk == "korean" @@ -698,7 +698,7 @@ end scripts.installmethod { name = "hanzi", - process = process, + injector = process, datasets = { default = { inter_char_shrink_factor = 0.50, -- of quad @@ -868,7 +868,7 @@ local function process(head,first,last) while true do local upcoming, id = first.next, first.id if id == glyph_code then - local a = first[a_prestat] + local a = first[a_scriptstatus] local current = numbertocategory[a] local action = injectors[previous] if action then @@ -877,7 +877,7 @@ local function process(head,first,last) local font = first.font if font ~= lastfont then lastfont = font - set_parameters(font,numbertodataset[first[a_preproc]]) + set_parameters(font,numbertodataset[first[a_scriptinjection]]) end action(head,first) end @@ -893,7 +893,7 @@ local function process(head,first,last) if p and n then local pid, nid = p.id, n.id if pid == glyph_code and nid == glyph_code then - local pa, na = p[a_prestat], n[a_prestat] + local pa, na = p[a_scriptstatus], n[a_scriptstatus] local pcjk, ncjk = pa and numbertocategory[pa], na and numbertocategory[na] if not pcjk or not ncjk or pcjk == "korean" or ncjk == "korean" @@ -902,7 +902,7 @@ local function process(head,first,last) or pcjk == "half_width_close" or ncjk == "half_width_open" then -- extra compared to korean previous = "start" else -- if head ~= first then -if id == glue_code and first.subtype == userskip_code then -- also prestat check? +if id == glue_code and first.subtype == userskip_code then -- also scriptstatus check? -- for the moment no distinction possible between space and userskip local w = first.spec.width local s = spacedata[p.font] @@ -935,7 +935,7 @@ end scripts.installmethod { name = "nihongo", -- what name to use? - process = process, + injector = process, datasets = { default = { inter_char_shrink_factor = 0.50, -- of quad diff --git a/tex/context/base/scrp-eth.lua b/tex/context/base/scrp-eth.lua index e1b8df432..597afa1b5 100644 --- a/tex/context/base/scrp-eth.lua +++ b/tex/context/base/scrp-eth.lua @@ -19,8 +19,8 @@ local new_penalty = nodepool.penalty local nodecodes = nodes.nodecodes local glyph_code = nodecodes.glyph -local a_prestat = attributes.private('prestat') -local a_preproc = attributes.private('preproc') +local a_scriptstatus = attributes.private('scriptstatus') +local a_scriptinjection = attributes.private('scriptinjection') local categorytonumber = scripts.categorytonumber local numbertocategory = scripts.numbertocategory @@ -37,7 +37,7 @@ local inter_character_stretch_factor = 1 local inter_character_shrink_factor = 1 local function space_glue(current) - local data = numbertodataset[current[a_preproc]] + local data = numbertodataset[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 @@ -106,8 +106,8 @@ local function process(head,first,last) while current do local id = current.id if id == glyph_code then - local prestat = current[a_prestat] - local category = numbertocategory[prestat] + local scriptstatus = current[a_scriptstatus] + local category = numbertocategory[scriptstatus] if injector then local action = injector[category] if action then @@ -129,7 +129,7 @@ end scripts.installmethod { name = "ethiopic", - process = process, + injector = process, datasets = { default = { inter_character_space_factor = 1, diff --git a/tex/context/base/scrp-ini.lua b/tex/context/base/scrp-ini.lua index c375e2ec3..18f86475f 100644 --- a/tex/context/base/scrp-ini.lua +++ b/tex/context/base/scrp-ini.lua @@ -29,14 +29,18 @@ local unsetvalue = attributes.unsetvalue local glyph_code = nodecodes.glyph local glue_code = nodecodes.glue -local a_preproc = attributes.private('preproc') -local a_prestat = attributes.private('prestat') +local a_scriptinjection = attributes.private('scriptinjection') +local a_scriptsplitting = attributes.private('scriptsplitting') +local a_scriptstatus = attributes.private('scriptstatus') local fontdata = fonts.hashes.identifiers local allocate = utilities.storage.allocate local setnodecolor = nodes.tracers.colors.set local setmetatableindex = table.setmetatableindex +local enableaction = nodes.tasks.enableaction +local disableaction = nodes.tasks.disableaction + scripts = scripts or { } local scripts = scripts @@ -46,6 +50,12 @@ local hash = scripts.hash local handlers = allocate() scripts.handlers = handlers +local injectors = allocate() +scripts.injectors = handlers + +local splitters = allocate() +scripts.splitters = splitters + local hash = { -- we could put these presets in char-def.lua -- -- half width opening parenthesis @@ -198,15 +208,19 @@ local numbertohandler = allocate() --~ storage.register("scripts/hash", hash, "scripts.hash") scripts.numbertodataset = numbertodataset +scripts.numbertohandler = numbertohandler local defaults = { inter_char_shrink_factor = 0, + inter_char_shrink_factor = 0, inter_char_stretch_factor = 0, inter_char_half_shrink_factor = 0, inter_char_half_stretch_factor = 0, inter_char_quarter_shrink_factor = 0, inter_char_quarter_stretch_factor = 0, inter_char_hangul_penalty = 0, + + inter_word_stretch_factor = 0, } scripts.defaults = defaults -- so we can add more @@ -283,13 +297,39 @@ function scripts.installdataset(specification) -- global overload end end +local injectorenabled = false +local splitterenabled = false + function scripts.set(name,method,preset) local handler = handlers[method] - texsetattribute(a_preproc,handler and handler.attributes[preset] or unsetvalue) + if handler then + if handler.injector then + if not injectorenabled then + enableaction("processors","scripts.injectors.handler") + injectorenabled = true + end + texsetattribute(a_scriptinjection,handler.attributes[preset] or unsetvalue) + end + if handler.splitter then + if not splitterenabled then + enableaction("processors","scripts.splitters.handler") + splitterenabled = true + end + texsetattribute(a_scriptsplitting,handler.attributes[preset] or unsetvalue) + end + if handler.initializer then + handler.initializer(handler) + handler.initializer = nil + end + else + texsetattribute(a_scriptinjection,unsetvalue) + texsetattribute(a_scriptsplitting,unsetvalue) + end end function scripts.reset() - texsetattribute(handler.attributes[preset]) + texsetattribute(a_scriptinjection,unsetvalue) + texsetattribute(a_scriptsplitting,unsetvalue) end -- the following tables will become a proper installer (move to cjk/eth) @@ -345,7 +385,7 @@ scripts.numbertocategory = numbertocategory local function colorize(start,stop) for n in traverse_id(glyph_code,start) do - local kind = numbertocategory[n[a_prestat]] + local kind = numbertocategory[n[a_scriptstatus]] if kind then local ac = scriptcolors[kind] if ac then @@ -376,7 +416,7 @@ end -- we can have a fonts.hashes.originals -function scripts.preprocess(head) +function scripts.injectors.handler(head) local start = first_glyph(head) -- we already have glyphs here (subtype 1) if not start then return head, false @@ -386,7 +426,7 @@ function scripts.preprocess(head) while start do local id = start.id if id == glyph_code then - local a = start[a_preproc] + local a = start[a_scriptinjection] if a then if a ~= last_a then if first then @@ -405,7 +445,7 @@ function scripts.preprocess(head) end last_a = a local handler = numbertohandler[a] - normal_process = handler.process + normal_process = handler.injector end if normal_process then local f = start.font @@ -424,7 +464,7 @@ function scripts.preprocess(head) end local h = hash[c] if h then - start[a_prestat] = categorytonumber[h] + start[a_scriptstatus] = categorytonumber[h] if not first then first, last = start, start else @@ -502,6 +542,10 @@ function scripts.preprocess(head) end end +function scripts.splitters.handler(head) + return head, false +end + -- new plugin: local registercontext = fonts.specifiers.registercontext @@ -526,14 +570,14 @@ setmetatableindex(cache_nop,function(t,k) local v = { } t[k] = v return v end) -- -- we can consider merging this in handlers.characters(head) at some point as there -- already check for the dynamic attribute so it saves a pass, however, then we also --- need to check for a_preproc there which nils the benefit +-- need to check for a_scriptinjection there which nils the benefit -- -- we can consider cheating: set all glyphs in a word as the first one but it's not -- playing nice function autofontfeature.handler(head) for n in traverse_id(glyph_code,head) do - -- if n[a_preproc] then + -- if n[a_scriptinjection] then -- -- already tagged by script feature, maybe some day adapt -- else local char = n.char @@ -553,7 +597,7 @@ function autofontfeature.handler(head) end if attr ~= 0 then n[0] = attr - -- maybe set preproc when associated + -- maybe set scriptinjection when associated end else local slot = cache_nop[font] @@ -567,7 +611,7 @@ function autofontfeature.handler(head) end if attr ~= 0 then n[0] = attr - -- maybe set preproc when associated + -- maybe set scriptinjection when associated end end end @@ -578,12 +622,12 @@ end function autofontfeature.enable() report_scripts("globally enabled") - nodes.tasks.enableaction("processors","scripts.autofontfeature.handler") + enableaction("processors","scripts.autofontfeature.handler") end function autofontfeature.disable() report_scripts("globally disabled") - nodes.tasks.disableaction("processors","scripts.autofontfeature.handler") + disableaction("processors","scripts.autofontfeature.handler") end commands.enableautofontscript = autofontfeature.enable diff --git a/tex/context/base/scrp-ini.mkiv b/tex/context/base/scrp-ini.mkiv index bf8b580c7..289409933 100644 --- a/tex/context/base/scrp-ini.mkiv +++ b/tex/context/base/scrp-ini.mkiv @@ -17,8 +17,9 @@ \registerctxluafile{scrp-cjk}{1.001} \registerctxluafile{scrp-eth}{1.001} -\definesystemattribute[preproc][public] -\definesystemattribute[prestat][public] +\definesystemattribute[scriptinjection][public] +\definesystemattribute[scriptsplitting][public] +\definesystemattribute[scriptstatus] [public] %D Since scripts need specific \LUA\ code we use hard coded attribute %D values, but we might have more tricks at some time, so we use a @@ -56,15 +57,23 @@ \unexpanded\def\stopscript {\endgroup} -% \setscript[hangul] \hangul \startscript[hangul] +% % todo: +% +% \unexpanded\def\setscriptsplitterlist +% {\dodoubleargument\scripts_basics_set_splitter_list} +% +% \def\scripts_basics_set_splitter_list[#1][#2]% +% {\ctxcommand{setscriptsplitterlist("#1","#2")} -\definescript[hangul] [\c!method=hangul] -\definescript[hanzi] [\c!method=hanzi] -\definescript[nihongo] [\c!method=nihongo] +% \setscript[hangul] \hangul \startscript[hangul] -\definescript[ethiopic][\c!method=ethiopic] +\definescript [hangul] [\c!method=hangul] +\definescript [hanzi] [\c!method=hanzi] +\definescript [nihongo] [\c!method=nihongo] +\definescript [ethiopic] [\c!method=ethiopic] +\definescript [thai] [\c!method=thai] -\definescript[latin] [\c!method=] % resets the attribute (also currentscript) +\definescript [latin] [\c!method=] % resets the attribute (also currentscript) % a new trick (at some point we will predefine more scripts and consider a link with the above) diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex b8adb2829..57208daf8 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex af5f201ca..3be798898 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/status-mkiv.lua b/tex/context/base/status-mkiv.lua index cc1c86d56..320ea0d17 100644 --- a/tex/context/base/status-mkiv.lua +++ b/tex/context/base/status-mkiv.lua @@ -4267,6 +4267,11 @@ return { }, { category = "lua", + filename = "s-fonts-features", + status = "okay", + }, + { + category = "lua", filename = "s-fonts-missing", status = "okay", }, @@ -4282,6 +4287,21 @@ return { }, { category = "lua", + filename = "s-math-extensibles", + status = "okay", + }, + { + category = "lua", + filename = "s-math-coverage", + status = "okay", + }, + { + category = "lua", + filename = "s-math-parameters", + status = "okay", + }, + { + category = "lua", filename = "s-pre-71", status = "todo", }, @@ -5321,6 +5341,11 @@ return { }, { category = "mkiv", + filename = "s-fonts-features", + status = "okay", + }, + { + category = "mkiv", filename = "s-fonts-missing", status = "okay", }, @@ -5386,22 +5411,27 @@ return { }, { category = "mkiv", - filename = "s-mat-20", + filename = "s-mat-11", + status = "todo", + }, + { + category = "mkiv", + filename = "s-math-repertoire", status = "okay", }, { category = "mkiv", - filename = "s-mat-11", - status = "todo", + filename = "s-math-extensibles", + status = "okay", }, { category = "mkiv", - filename = "s-mat-12", - status = "todo", + filename = "s-math-coverage", + status = "okay", }, { category = "mkiv", - filename = "s-math-extensibles", + filename = "s-math-parameters", status = "okay", }, { diff --git a/tex/context/base/task-ini.lua b/tex/context/base/task-ini.lua index 011ed50ca..0f477cb6e 100644 --- a/tex/context/base/task-ini.lua +++ b/tex/context/base/task-ini.lua @@ -24,11 +24,12 @@ appendaction("processors", "normalizers", "fonts.collections.process") appendaction("processors", "normalizers", "fonts.checkers.missing") -- disabled appendaction("processors", "characters", "scripts.autofontfeature.handler") +appendaction("processors", "characters", "scripts.splitters.handler") -- disabled appendaction("processors", "characters", "typesetters.cleaners.handler") -- disabled appendaction("processors", "characters", "typesetters.directions.handler") -- disabled appendaction("processors", "characters", "typesetters.cases.handler") -- disabled appendaction("processors", "characters", "typesetters.breakpoints.handler") -- disabled -appendaction("processors", "characters", "scripts.preprocess") +appendaction("processors", "characters", "scripts.injectors.handler") -- disabled appendaction("processors", "words", "builders.kernel.hyphenation") -- always on appendaction("processors", "words", "languages.words.check") -- disabled @@ -108,6 +109,8 @@ appendaction("vboxbuilders","normalizers","typesetters.checkers.handler") -- speedup: only kick in when used disableaction("processors", "scripts.autofontfeature.handler") +disableaction("processors", "scripts.splitters.handler") +disableaction("processors", "scripts.injectors.handler") -- was enabled disableaction("processors", "fonts.collections.process") disableaction("processors", "fonts.checkers.missing") disableaction("processors", "chars.handle_breakpoints") diff --git a/tex/context/base/type-imp-texgyre.mkiv b/tex/context/base/type-imp-texgyre.mkiv index b1e1e3cc0..24185f41d 100644 --- a/tex/context/base/type-imp-texgyre.mkiv +++ b/tex/context/base/type-imp-texgyre.mkiv @@ -177,7 +177,7 @@ \definetypeface [\typescriptone] [\s!rm] [\s!serif] [\typescriptone] [\s!default] \definetypeface [\typescriptone] [\s!ss] [\s!sans] [modern] [\s!default] [\s!rscale=1.1] \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default] [\s!rscale=1.1] - \definetypeface [\typescriptone] [\s!mm] [\s!math] [modern] [\s!default] [\s!rscale=1.1] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [bonum] [\s!default] \quittypescriptscanning \stoptypescript @@ -244,7 +244,7 @@ \startmode[pxmath] - \starttypescriptcollection[texgyre-math] + \starttypescriptcollection[texgyre-math-pagella] \starttypescript [\s!math][palatino,pagella][\s!all] \loadfontgoodies[px-math] @@ -258,7 +258,7 @@ \startnotmode[pxmath] - \starttypescriptcollection[texgyre-math] + \starttypescriptcollection[texgyre-math-pagella] \starttypescript [\s!math][palatino,pagella][\s!all] \loadfontgoodies[texgyre] @@ -268,3 +268,12 @@ \stoptypescriptcollection \stopnotmode + +\starttypescriptcollection[texgyre-math-bonum] + + \starttypescript [\s!math][bookman,bonum][\s!all] + \loadfontgoodies[texgyre] + \definefontsynonym[\s!MathRoman][file:texgyre-bonum-math-regular.otf][\s!features=\s!math\mathsizesuffix] + \stoptypescript + +\stoptypescriptcollection diff --git a/tex/context/fonts/texgyre.lfg b/tex/context/fonts/texgyre.lfg index 953692232..7782aa509 100644 --- a/tex/context/fonts/texgyre.lfg +++ b/tex/context/fonts/texgyre.lfg @@ -20,5 +20,11 @@ return { "tgtermesmath-regular.otf", "tgtermes-math.otf", }, + ["texgyre-bonum-math-regular.otf"] = { + "texgyrebonum-math.otf", -- beta + "texgyrebonummath-regular.otf", + "tgbonummath-regular.otf", + "tgbonum-math.otf", + }, }, } |