diff options
Diffstat (limited to 'tex')
39 files changed, 1133 insertions, 653 deletions
diff --git a/tex/context/base/catc-def.mkiv b/tex/context/base/catc-def.mkiv index 275a9a6cd..0bd7deed7 100644 --- a/tex/context/base/catc-def.mkiv +++ b/tex/context/base/catc-def.mkiv @@ -103,7 +103,8 @@ \catcode\spaceasciicode \spacecatcode \catcode\endoffileasciicode \ignorecatcode \catcode\circumflexasciicode\superscriptcatcode - \catcode\underscoreasciicode\subscriptcatcode +% \catcode\underscoreasciicode\subscriptcatcode + \catcode\underscoreasciicode\lettercatcode \catcode\ampersandasciicode \alignmentcatcode \catcode\backslashasciicode \escapecatcode \catcode\leftbraceasciicode \begingroupcatcode diff --git a/tex/context/base/char-tex.lua b/tex/context/base/char-tex.lua index b8ae0b53f..36eb7f889 100644 --- a/tex/context/base/char-tex.lua +++ b/tex/context/base/char-tex.lua @@ -18,6 +18,118 @@ characters = characters or { } local characters = characters characters.tex = characters.tex or { } +local accentmapping = allocate { + ['"'] = { [""] = "¨", + A = "Ä", a = "ä", + E = "Ë", e = "ë", + I = "Ï", i = "ï", + O = "Ö", o = "ö", + U = "Ü", u = "ü", + Y = "Ÿ", y = "ÿ", + }, + ["'"] = { [""] = "´", + A = "Á", a = "á", + C = "Ć", c = "ć", + E = "É", e = "é", + I = "Í", i = "í", + L = "Ĺ", l = "ĺ", + N = "Ń", n = "ń", + O = "Ó", o = "ó", + R = "Ŕ", r = "ŕ", + S = "Ś", s = "ś", + U = "Ú", u = "ú", + Y = "Ý", y = "ý", + Z = "Ź", z = "ź", + }, + ["."] = { [""] = "˙", + C = "Ċ", c = "ċ", + E = "Ė", e = "ė", + G = "Ġ", g = "ġ", + I = "İ", i = "i", + Z = "Ż", z = "ż", + }, + ["="] = { [""] = "¯", + A = "Ā", a = "ā", + E = "Ē", e = "ē", + I = "Ī", i = "ī", + O = "Ō", o = "ō", + U = "Ū", u = "ū", + }, + ["H"] = { [""] = "˝", + O = "Ő", o = "ő", + U = "Ű", u = "ű", + }, + ["^"] = { [""] = "ˆ", + A = "Â", a = "â", + C = "Ĉ", c = "ĉ", + E = "Ê", e = "ê", + G = "Ĝ", g = "ĝ", + H = "Ĥ", h = "ĥ", + I = "Î", i = "î", + J = "Ĵ", j = "ĵ", + O = "Ô", o = "ô", + S = "Ŝ", s = "ŝ", + U = "Û", u = "û", + W = "Ŵ", w = "ŵ", + Y = "Ŷ", y = "ŷ", + }, + ["`"] = { [""] = "`", + A = "À", a = "à", + E = "È", e = "è", + I = "Ì", i = "ì", + O = "Ò", o = "ò", + U = "Ù", u = "ù", + Y = "Ỳ", y = "ỳ", + }, + ["c"] = { [""] = "¸", + C = "Ç", c = "ç", + K = "Ķ", k = "ķ", + L = "Ļ", l = "ļ", + N = "Ņ", n = "ņ", + R = "Ŗ", r = "ŗ", + S = "Ş", s = "ş", + T = "Ţ", t = "ţ", + }, + ["k"] = { [""] = "˛", + A = "Ą", a = "ą", + E = "Ę", e = "ę", + I = "Į", i = "į", + U = "Ų", u = "ų", + }, + ["r"] = { [""] = "˚", + A = "Å", a = "å", + U = "Ů", u = "ů", + }, + ["u"] = { [""] = "˘", + A = "Ă", a = "ă", + E = "Ĕ", e = "ĕ", + G = "Ğ", g = "ğ", + I = "Ĭ", i = "ĭ", + O = "Ŏ", o = "ŏ", + U = "Ŭ", u = "ŭ", + }, + ["v"] = { [""] = "ˇ", + C = "Č", c = "č", + D = "Ď", d = "ď", + E = "Ě", e = "ě", + L = "Ľ", l = "ľ", + N = "Ň", n = "ň", + R = "Ř", r = "ř", + S = "Š", s = "š", + T = "Ť", t = "ť", + Z = "Ž", z = "ž", + }, + ["~"] = { [""] = "˜", + A = "Ã", a = "ã", + I = "Ĩ", i = "ĩ", + N = "Ñ", n = "ñ", + O = "Õ", o = "õ", + U = "Ũ", u = "ũ", + }, +} + +characters.tex.accentmapping = accentmapping + local accent_map = allocate { -- incomplete ['~'] = "̃" , -- ̃ Ẽ ['"'] = "̈" , -- ̈ Ë @@ -89,3 +201,12 @@ end --~ print(characters.tex.toutf([[\"{e}]]),true) --~ print(characters.tex.toutf([[{\"{e}}]],true)) + +function characters.tex.defineaccents() + for accent, group in next, accentmapping do + context.dodefineaccentcommand(accent) + for character, mapping in next, group do + context.dodefineaccent(accent,character,mapping) + end + end +end diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index add8de91e..fa64d0998 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2011.02.02 13:03} +\newcontextversion{2011.02.04 00:30} %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/cont-new.mkiv b/tex/context/base/cont-new.mkiv index a3a8e804e..6a5e1e7ef 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{2011.02.02 13:03} +\newcontextversion{2011.02.04 00:30} %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/context.mkii b/tex/context/base/context.mkii index 8086f5d45..dd590a9ae 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.02.02 13:03} +\edef\contextversion{2011.02.04 00:30} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index fd6566387..1768d5269 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.02.02 13:03} +\edef\contextversion{2011.02.04 00:30} %D For those who want to use this: diff --git a/tex/context/base/data-ini.lua b/tex/context/base/data-ini.lua index ff115977c..63a7571fe 100644 --- a/tex/context/base/data-ini.lua +++ b/tex/context/base/data-ini.lua @@ -225,4 +225,5 @@ resolvers.settrace(osgetenv("MTX_INPUT_TRACE")) if not resolvers.resolve then function resolvers.resolve (s) return s end function resolvers.unresolve(s) return s end + function resolvers.repath (s) return s end end diff --git a/tex/context/base/data-lst.lua b/tex/context/base/data-lst.lua index c84853e81..23a2fc2fe 100644 --- a/tex/context/base/data-lst.lua +++ b/tex/context/base/data-lst.lua @@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['data-lst'] = { license = "see context related readme files" } --- used in mtxrun +-- used in mtxrun, can be loaded later .. todo local find, concat, upper, format = string.find, table.concat, string.upper, string.format @@ -22,50 +22,42 @@ local function tabstr(str) end end -local function list(list,report,pattern) - pattern = pattern and pattern ~= "" and upper(pattern) or "" - local instance = resolvers.instance - local report = report or texio.write_nl - local sorted = table.sortedkeys(list) - local result = { } - for i=1,#sorted do - local key = sorted[i] - if key ~= "" and (pattern == "" or find(upper(key),pattern)) then - local raw = tabstr(rawget(list,key)) - local val = tabstr(list[key]) - local res = resolvers.resolve(val) - if raw and raw ~= "" then - if raw == val then - if val == res then - result[#result+1] = { key, raw } - else - result[#result+1] = { key, format('%s => %s',raw,res) } - end - else - if val == res then - result[#result+1] = { key, format('%s => %s',raw,val) } - else - result[#result+1] = { key, format('%s => %s => %s',raw,val,res) } - end - end - else - result[#result+1] = { key, "unset" } +function resolvers.listers.variables(pattern) + local instance = resolvers.instance + local environment = instance.environment + local variables = instance.variables + local expansions = instance.expansions + local pattern = upper(pattern or "") + local configured = { } + local order = instance.order + for i=1,#order do + for k, v in next, order[i] do + if v ~= nil and configured[k] == nil then + configured[k] = v end end end - utilities.formatters.formatcolumns(result) - for i=1,#result do - report(result[i]) + local env = table.fastcopy(environment) + local var = table.fastcopy(variables) + local exp = table.fastcopy(expansions) + for key, value in table.sortedpairs(configured) do + if key ~= "" and (pattern == "" or find(upper(key),pattern)) then + logs.simple(key) + logs.simple(" env: %s",tabstr(rawget(environment,key)) or "unset") + logs.simple(" var: %s",tabstr(configured[key]) or "unset") + logs.simple(" exp: %s",tabstr(expansions[key]) or "unset") + logs.simple(" res: %s",resolvers.resolve(expansions[key]) or "unset") + end end + instance.environment = table.fastcopy(env) + instance.variables = table.fastcopy(var) + instance.expansions = table.fastcopy(exp) end -function resolvers.listers.variables (report,pattern) list(resolvers.instance.variables, report,pattern) end -function resolvers.listers.expansions(report,pattern) list(resolvers.instance.expansions,report,pattern) end - function resolvers.listers.configurations(report) local configurations = resolvers.instance.specification local report = report or texio.write_nl for i=1,#configurations do - report(configurations[i]) + report(resolvers.resolve(configurations[i])) end end diff --git a/tex/context/base/data-pre.lua b/tex/context/base/data-pre.lua index 44751ae5a..2e566de87 100644 --- a/tex/context/base/data-pre.lua +++ b/tex/context/base/data-pre.lua @@ -22,6 +22,7 @@ resolvers.prefixes = prefixes local gsub = string.gsub local cleanpath, findgivenfile, expansion = resolvers.cleanpath, resolvers.findgivenfile, resolvers.expansion local getenv = resolvers.getenv -- we can probably also use resolvers.expansion +local P, Cs, lpegmatch = lpeg.P, lpeg.Cs, lpeg.match prefixes.environment = function(str) return cleanpath(expansion(str)) @@ -85,8 +86,6 @@ prefixes.home = function(str) return cleanpath(file.join(getenv('HOME'),str)) end -prefixes["~"] = prefixes.home - prefixes.env = prefixes.environment prefixes.rel = prefixes.relative prefixes.loc = prefixes.locate @@ -145,3 +144,39 @@ if os.uname then end end + +if os.type == "unix" then + + local pattern + + local function makepattern(t,k,v) + local colon = P(":") + local p + for k, v in table.sortedpairs(prefixes) do + if p then + p = P(k) + p + else + p = P(k) + end + end + pattern = Cs((p * colon + colon/";" + P(1))^0) + if t then + t[k] = v + end + end + + makepattern() + + getmetatable(prefixes).__newindex = makepattern + + function resolvers.repath(str) + return lpegmatch(pattern,str) + end + +else -- already the default: + + function resolvers.repath(str) + return str + end + +end diff --git a/tex/context/base/data-res.lua b/tex/context/base/data-res.lua index 0c6ce1969..a53816c3f 100644 --- a/tex/context/base/data-res.lua +++ b/tex/context/base/data-res.lua @@ -192,6 +192,7 @@ function resolvers.newinstance() -- todo: all vars will become lowercase and alp if v ~= nil then v = checkedvariable(v) or "" end + v = resolvers.repath(v) -- for taco who has a : separated osfontdir t[k] = v return v end } ) diff --git a/tex/context/base/enco-ini.mkiv b/tex/context/base/enco-ini.mkiv index d7fac77c2..2c15e2ab7 100644 --- a/tex/context/base/enco-ini.mkiv +++ b/tex/context/base/enco-ini.mkiv @@ -36,34 +36,18 @@ \unprotect -%D Quite some commands are now obsolete. We keep only a few commands -%D around, just in case they are used in styles (and in for instance -%D symb and xtag files). - -\unexpanded\def\startencoding [#1]{} % used in symb -\let\stopencoding \relax -\unexpanded\def\setupencoding [#1]{} -\def\enablemapping [#1]{} -\def\enableencoding[#1]{} - -\def\currentencoding{utf} -\def\currentmapping {utf} -\let\defaultencoding\s!default - -% todo: - -% \def\showaccents {\f!encodingprefix\s!run} -% \def\showcharacters {\f!encodingprefix\s!run} -% \def\showcharacterbounds {\f!encodingprefix\s!run} -% \def\showhyphenations {\f!encodingprefix\s!run} -% \def\showmapping {\f!encodingprefix\s!run} - %D \macros %D {defineaccent, definecharacter, definecommand} +\unexpanded\def\dodefineaccentcommand#1% + {\setevalue{\string#1}{\noexpand\dohandleaccent{\string#1}}} + +\unexpanded\def\dodefineaccent#1#2#3% no spaces, used low level + {\setvalue{\??ac\string#1\string#2\empty}{#3}} + \unexpanded\def\defineaccent#1 #2 #3 % - {\setevalue{\string#1}{\noexpand\dohandleaccent{\string#1}}% - \setvalue{\??ac\string#1\string#2}{#3}} + {\dodefineaccentcommand{#1}% + \dodefineaccent{#1}{#2}{#3}} \def\dohandleaccent#1#2% {\csname\??ac\string#1\string#2\empty\endcsname} @@ -71,19 +55,17 @@ \unexpanded\def\definecharacter#1 #2 % {\doifnumberelse{\string#2} {\setevalue{\string#1}{\utfchar{#2}}} % or {\expandafter\chardef\csname#1\endcsname#2\relax} - {\setuvalue {\string#1}{#2}}} + {\setuvalue{\string#1}{#2}}} \unexpanded\def\definecommand#1 #2 % {\setuvalue{\string#1}{#2}} %D \macros -%D {everyuppercase, EveryUppercase, -%D everyuppercase, EveryUppercase, -%D everysanitize, EverySanitize} +%D {everyuppercase, everylowercase, everysanitize} -\newevery \everyuppercase \EveryUppercase -\newevery \everylowercase \EveryLowercase -\newevery \everysanitize \EverySanitize +\newtoks \everyuppercase +\newtoks \everylowercase +\newtoks \everysanitize %D Some saved meanings (not really needed): @@ -272,52 +254,6 @@ \def\leftsubguillemot {\guilsingleleft} \def\rightsubguillemot {\guilsingleright} -% obsolete: - -% \greekleftquot {[obsolete]} -% \greekrightquot {[obsolete]} -% \greekapostrophos {[obsolete]} -% \greekupsilondialytika{[obsolete]} -% \Ycaron {[obsolete]} -% \ycaron {[obsolete]} - -% to be done in char-def: - -% \definecharacter cyrillicGUP {GUP} -% \definecharacter cyrillicGHCRS {GHCRS} -% \definecharacter cyrillicZHDSC {ZHDSC} -% \definecharacter cyrillicKDSC {KDSC} -% \definecharacter cyrillicKBEAK {KBEAK} -% \definecharacter cyrillicKVCRS {KVCRS} -% \definecharacter cyrillicNG {NG} -% \definecharacter cyrillicOTLD {OTLD} -% \definecharacter cyrillicY {Y} -% \definecharacter cyrillicYHCRS {YHCRS} -% \definecharacter cyrillicHDSC {HDSC} -% \definecharacter cyrillicCHVCRS {CHVCRS} -% \definecharacter cyrillicCHRDSC {CHRDSC} -% \definecharacter cyrillicQ {Q} -% \definecharacter cyrillicW {W} -% -% \definecharacter cyrillicgup {gup} -% \definecharacter cyrillicghcrs {ghcrs} -% \definecharacter cyrilliczhdsc {zhdsc} -% \definecharacter cyrillickdsc {kdsc} -% \definecharacter cyrillickbeak {kbeak} -% \definecharacter cyrillickvcrs {kvcrs} -% \definecharacter cyrillicng {ng} -% \definecharacter cyrillicotld {otld} -% \definecharacter cyrillicy {y} -% \definecharacter cyrillicyhcrs {yhcrs} -% \definecharacter cyrillichdsc {hdsc} -% \definecharacter cyrillicchvcrs {chvcrs} -% \definecharacter cyrillicchrdsc {chrdsc} -% \definecharacter cyrillicq {q} -% \definecharacter cyrillicw {w} - -% \definecharacter softhyphen 45 -% \definecharacter compoundwordmark 23 - % left-overs (some day in private unicode space, so that we can roundtrip) \unexpanded\def\textblacksquare {\dontleavehmode\hbox{\vrule\!!width.3\s!em\!!height.4\s!em\!!depth-.1\s!em}} @@ -364,119 +300,24 @@ {\copy\controlspacebox} % a few defaults (\<whatever>{}), we really need the verbose \empty as it will be -% stringified - -\defineaccent ^ {\empty} {\textcircumflex} -\defineaccent ` {\empty} {\textgrave} -\defineaccent ~ {\empty} {\texttilde} -\defineaccent " {\empty} {\textdiaeresis} -\defineaccent ' {\empty} {\textacute} -\defineaccent . {\empty} {\textdotaccent} -\defineaccent = {\empty} {\textmacron} -\defineaccent c {\empty} {\textcedilla} -\defineaccent H {\empty} {\texthungarumlaut} -\defineaccent k {\empty} {\textogonek} -\defineaccent r {\empty} {\textring} -\defineaccent u {\empty} {\textbreve} -\defineaccent v {\empty} {\textcaron} - -% from enco-acc: +% stringified .. anyhow, we define this at the lua end now but keep it here as a +% reference % -% we should to this at the lua end and share code .. - -\defineaccent ^ A {\Acircumflex} \defineaccent ^ a {\acircumflex} -\defineaccent ^ C {\Ccircumflex} \defineaccent ^ c {\ccircumflex} -\defineaccent ^ E {\Ecircumflex} \defineaccent ^ e {\ecircumflex} -\defineaccent ^ G {\Gcircumflex} \defineaccent ^ g {\gcircumflex} -\defineaccent ^ H {\Hcircumflex} \defineaccent ^ h {\hcircumflex} -\defineaccent ^ I {\Icircumflex} \defineaccent ^ i {\icircumflex} \defineaccent ^ {\i} {\icircumflex} -\defineaccent ^ J {\Jcircumflex} \defineaccent ^ j {\jcircumflex} \defineaccent ^ {\j} {\jcircumflex} -\defineaccent ^ O {\Ocircumflex} \defineaccent ^ o {\ocircumflex} -\defineaccent ^ S {\Scircumflex} \defineaccent ^ s {\scircumflex} -\defineaccent ^ U {\Ucircumflex} \defineaccent ^ u {\ucircumflex} -\defineaccent ^ W {\Wcircumflex} \defineaccent ^ w {\wcircumflex} -\defineaccent ^ Y {\Ycircumflex} \defineaccent ^ y {\ycircumflex} - -\defineaccent ` A {\Agrave} \defineaccent ` a {\agrave} -\defineaccent ` E {\Egrave} \defineaccent ` e {\egrave} -\defineaccent ` I {\Igrave} \defineaccent ` i {\igrave} \defineaccent ` {\i} {\igrave} -\defineaccent ` O {\Ograve} \defineaccent ` o {\ograve} -\defineaccent ` U {\Ugrave} \defineaccent ` u {\ugrave} -\defineaccent ` Y {\Ygrave} \defineaccent ` y {\ygrave} - -\defineaccent ~ A {\Atilde} \defineaccent ~ a {\atilde} -\defineaccent ~ I {\Itilde} \defineaccent ~ i {\itilde} \defineaccent ~ {\i} {\itilde} -\defineaccent ~ O {\Otilde} \defineaccent ~ o {\otilde} -\defineaccent ~ U {\Utilde} \defineaccent ~ u {\utilde} -\defineaccent ~ N {\Ntilde} \defineaccent ~ n {\ntilde} - -\defineaccent " A {\Adiaeresis} \defineaccent " a {\adiaeresis} -\defineaccent " E {\Ediaeresis} \defineaccent " e {\ediaeresis} -\defineaccent " I {\Idiaeresis} \defineaccent " i {\idiaeresis} \defineaccent " {\i} {\idiaeresis} -\defineaccent " O {\Odiaeresis} \defineaccent " o {\odiaeresis} -\defineaccent " U {\Udiaeresis} \defineaccent " u {\udiaeresis} -\defineaccent " Y {\Ydiaeresis} \defineaccent " y {\ydiaeresis} - -\defineaccent ' A {\Aacute} \defineaccent ' a {\aacute} -\defineaccent ' C {\Cacute} \defineaccent ' c {\cacute} -\defineaccent ' E {\Eacute} \defineaccent ' e {\eacute} -\defineaccent ' I {\Iacute} \defineaccent ' i {\iacute} \defineaccent ' {\i} {\iacute} -\defineaccent ' L {\Lacute} \defineaccent ' l {\lacute} -\defineaccent ' N {\Nacute} \defineaccent ' n {\nacute} -\defineaccent ' O {\Oacute} \defineaccent ' o {\oacute} -\defineaccent ' R {\Racute} \defineaccent ' r {\racute} -\defineaccent ' S {\Sacute} \defineaccent ' s {\sacute} -\defineaccent ' U {\Uacute} \defineaccent ' u {\uacute} -\defineaccent ' Y {\Yacute} \defineaccent ' y {\yacute} -\defineaccent ' Z {\Zacute} \defineaccent ' z {\zacute} - -\defineaccent . C {\Cdotaccent} \defineaccent . c {\cdotaccent} -\defineaccent . E {\Edotaccent} \defineaccent . e {\edotaccent} -\defineaccent . G {\Gdotaccent} \defineaccent . g {\gdotaccent} -\defineaccent . I {\Idotaccent} \defineaccent . i {\idotaccent} \defineaccent . {\i} {\idotaccent} -\defineaccent . Z {\Zdotaccent} \defineaccent . z {\zdotaccent} - -\defineaccent = A {\Amacron} \defineaccent = a {\amacron} -\defineaccent = E {\Emacron} \defineaccent = e {\emacron} -\defineaccent = I {\Imacron} \defineaccent = i {\imacron} \defineaccent = {\i} {\imacron} -\defineaccent = O {\Omacron} \defineaccent = o {\omacron} -\defineaccent = U {\Umacron} \defineaccent = u {\umacron} - -\defineaccent c C {\Ccedilla} \defineaccent c c {\ccedilla} -\defineaccent c K {\Kcedilla} \defineaccent c k {\kcedilla} -\defineaccent c L {\Lcedilla} \defineaccent c l {\lcedilla} -\defineaccent c N {\Ncedilla} \defineaccent c n {\ncedilla} -\defineaccent c R {\Rcedilla} \defineaccent c r {\rcedilla} -\defineaccent c S {\Scedilla} \defineaccent c s {\scedilla} -\defineaccent c T {\Tcedilla} \defineaccent c t {\tcedilla} - -\defineaccent H O {\Ohungarumlaut} \defineaccent H o {\ohungarumlaut} -\defineaccent H u {\uhungarumlaut} \defineaccent H U {\Uhungarumlaut} - -\defineaccent k A {\Aogonek} \defineaccent k a {\aogonek} -\defineaccent k E {\Eogonek} \defineaccent k e {\eogonek} -\defineaccent k I {\Iogonek} \defineaccent k i {\iogonek} -\defineaccent k U {\Uogonek} \defineaccent k u {\uogonek} - -\defineaccent r A {\Aring} \defineaccent r a {\aring} -\defineaccent r U {\Uring} \defineaccent r u {\uring} - -\defineaccent u A {\Abreve} \defineaccent u a {\abreve} -\defineaccent u E {\Ebreve} \defineaccent u e {\ebreve} -\defineaccent u G {\Gbreve} \defineaccent u g {\gbreve} -\defineaccent u I {\Ibreve} \defineaccent u i {\ibreve} \defineaccent u {\i} {\ibreve} -\defineaccent u O {\Obreve} \defineaccent u o {\obreve} -\defineaccent u U {\Ubreve} \defineaccent u u {\ubreve} - -\defineaccent v C {\Ccaron} \defineaccent v c {\ccaron} -\defineaccent v D {\Dcaron} \defineaccent v d {\dcaron} -\defineaccent v E {\Ecaron} \defineaccent v e {\ecaron} -\defineaccent v L {\Lcaron} \defineaccent v l {\lcaron} -\defineaccent v N {\Ncaron} \defineaccent v n {\ncaron} -\defineaccent v R {\Rcaron} \defineaccent v r {\rcaron} -\defineaccent v S {\Scaron} \defineaccent v s {\scaron} -\defineaccent v T {\Tcaron} \defineaccent v t {\tcaron} -\defineaccent v Z {\Zcaron} \defineaccent v z {\zcaron} +% \defineaccent ^ {\empty} {\textcircumflex} +% \defineaccent ` {\empty} {\textgrave} +% \defineaccent ~ {\empty} {\texttilde} +% \defineaccent " {\empty} {\textdiaeresis} +% \defineaccent ' {\empty} {\textacute} +% \defineaccent . {\empty} {\textdotaccent} +% \defineaccent = {\empty} {\textmacron} +% \defineaccent c {\empty} {\textcedilla} +% \defineaccent H {\empty} {\texthungarumlaut} +% \defineaccent k {\empty} {\textogonek} +% \defineaccent r {\empty} {\textring} +% \defineaccent u {\empty} {\textbreve} +% \defineaccent v {\empty} {\textcaron} + +\ctxlua{characters.tex.defineaccents()} % from enco-mis: @@ -499,21 +340,6 @@ %D A smaller and bolder variant, more like the math and monospaced ones. -% \def\fakeunderscore -% {\dontleavehmode\hbox % was \leavevmode -% {\setbox\scratchbox\hbox{(}% -% \scratchdimen.2\dp\scratchbox -% \setbox\scratchbox\hbox{\space}% -% \vrule -% \!!depth \scratchdimen -% \!!width \wd\scratchbox -% \!!height\zeropoint}} - -% \startTEXpage -% \ruledhbox{\strut$1\fakeunderscore^{1\fakeunderscore}$} -% \ruledhbox{\strut$1\xfakeunderscore^{1\xfakeunderscore}$} -% \stopTEXpage - \def\fakeunderscore {\relax\ifmmode \vrule\!!depth .12\fontexheight\mathstylefont\normalmathstyle\!!width \fontinterwordspace\mathstylefont\normalmathstyle\!!height\zeropoint\relax diff --git a/tex/context/base/font-ini.mkiv b/tex/context/base/font-ini.mkiv index 6a8c9594f..25ed87eaa 100644 --- a/tex/context/base/font-ini.mkiv +++ b/tex/context/base/font-ini.mkiv @@ -2093,11 +2093,6 @@ \ctxlua{fonts.definers.resetnullfont()}% in luatex 0.70 this will also do the previous \globallet\resetnullfont\relax} -% \def\preloaddefaultfonts -% {\resetpreloadfonts -% \setupbodyfont[modern,\fontstyle,\fontbody]% -% \showmessage\m!fonts6{\normalizedbodyfontsize\normalspace\fontstyle}} - \def\preloaddefaultfonts {\resetpreloadfonts \setupbodyfont[modern,\fontstyle,\fontbody]% @@ -2114,16 +2109,34 @@ \showmessage\m!fonts6{fallback modern tt \normalizedbodyfontsize}} \def\resetpreloadfonts - {\global\let\firststagepreloadfonts \relax - \global\let\secondstagepreloadfonts\relax - \global\let\thirdstagepreloadfonts \relax - \global\let\fourthstagepreloadfonts\relax + {\glet\preloaddefaultfonts \relax + \glet\preloaddefaultfontstt \relax + \glet\preloaddefaultfontsmm \relax + \glet\zerostagepreloadfonts \relax + \glet\firststagepreloadfonts \relax + \glet\secondstagepreloadfonts\relax + \glet\thirdstagepreloadfonts \relax + \glet\fourthstagepreloadfonts\relax + \global\everyhbox\emptytoks + \global\everyvbox\emptytoks \resetnullfont} +\def\dozerostagepreloadfonts + {\definedfont[\s!file:lmmono10-regular sa 1]} + +\def\zerostagepreloadfonts + {\writestatus\m!fonts{beware: no fonts are loaded yet, using 'lm mono' in box}% + \glet\zerostagepreloadfonts\dozerostagepreloadfonts + \zerostagepreloadfonts} + +\appendtoks + \everyhbox{\zerostagepreloadfonts} + \everyvbox{\zerostagepreloadfonts} +\to \everydump + \def\firststagepreloadfonts % see core-def.mkiv {\doifmodeelse{*nofonts} - {%\resetpreloadfonts - \writestatus\m!fonts{latin modern fonts are not preloaded}} + {\writestatus\m!fonts{latin modern fonts are not preloaded}} {\preloaddefaultfonts \writestatus\m!fonts{preloading latin modern fonts (first stage)}}} @@ -2131,14 +2144,6 @@ {\writestatus\m!fonts{preloading latin modern fonts (second stage)}% \preloaddefaultfonts} -% \def\thirdstagepreloadfonts -% {\ifx\fontclass\empty -% \writestatus\m!fonts{preloading latin modern fonts (third stage)}% -% \preloaddefaultfonts -% \else -% \resetpreloadfonts -% \fi} - \def\thirdstagepreloadfonts {\ifx\fontclass\empty \writestatus\m!fonts{preloading latin modern fonts (third stage)}% diff --git a/tex/context/base/font-syn.lua b/tex/context/base/font-syn.lua index c5ae5dc75..5eb7551cd 100644 --- a/tex/context/base/font-syn.lua +++ b/tex/context/base/font-syn.lua @@ -52,7 +52,7 @@ names.be_clever = true names.enabled = true names.cache = containers.define("fonts","data",names.version,true) -local autoreload = false +local autoreload = true directives.register("fonts.autoreload", function(v) autoreload = toboolean(v) end) @@ -926,11 +926,13 @@ local function is_reloaded() local c_status = table.serialize(resolvers.datastate()) local f_status = table.serialize(data.datastate) if c_status == f_status then - -- report_names("font database matches configuration and file hashes") + report_names("font database has matching configuration and file hashes") return else - report_names("font database does not match configuration and file hashes") + report_names("font database has mismatching configuration and file hashes") end + else + report_names("font database is regenerated (controlled by directive 'fonts.autoreload')") end names.loaded = false reloaded = true diff --git a/tex/context/base/java-imp-ans.mkiv b/tex/context/base/java-imp-ans.mkiv index 636c894f9..cc63266e2 100644 --- a/tex/context/base/java-imp-ans.mkiv +++ b/tex/context/base/java-imp-ans.mkiv @@ -8,21 +8,26 @@ %D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. -\startJSpreamble{Do_Check_Answer} used later +% event.target.display = display.hidden - function Do_Check_Answer (field, value) - { if (event.value.toLowerCase()==value.toLowerCase()) - { event.target.hidden = true } - % { event.target.display = display.hidden } - return("\040") } // funny, "" does not work +\startJSpreamble{Do_Check_Answer} used later + + function Do_Check_Answer(field,value) { + if (event.value.toLowerCase() == value.toLowerCase()) { + event.target.hidden = true ; + } + return("\040") // funny, "" does not work + } \stopJSpreamble +% needs to be done better in mkiv: + \startJScode{Check_Answer} uses {Do_Check_Answer} - event.value = Do_Check_Answer(JS_S_1, JS_S_2) ; + event.value = Do_Check_Answer(JS_S_1, JS_S_2) ; \stopJScode \endinput diff --git a/tex/context/base/java-imp-fil.mkiv b/tex/context/base/java-imp-fil.mkiv index 4d79a2ace..592e9460d 100644 --- a/tex/context/base/java-imp-fil.mkiv +++ b/tex/context/base/java-imp-fil.mkiv @@ -13,19 +13,23 @@ \startJSpreamble Auxiliary used now - function DocumentFileName () - { var Paths = this.path.split("/") ; - Paths = Paths[Paths.length-1].split(".") ; - return(Paths[0]) } - - function Print_Page_Range(From, To) % gaat mis, nog geen args mogelijk - { if ((Number(From)>0)&&(Number(To)>=Number(From))) - { var myFrom = Number(From)-1 ; - var myTo = Number(To)-1 ; - this.print(false,myFrom,myTo,true) } } - - function Print_This_Page () - { this.print(false,this.pageNum,this.pageNum,true) } + function DocumentFileName() { + var Paths = this.path.split("/") ; + Paths = Paths[Paths.length-1].split(".") ; + return(Paths[0]) + } + + function Print_Page_Range(From,To) { + if ((Number(From)>0) && (Number(To) >= Number(From))) { + var myFrom = Number(From)-1 ; + var myTo = Number(To)-1 ; + this.print(false,myFrom,myTo,true) ; + } + } + + function Print_This_Page() { + this.print(false,this.pageNum,this.pageNum,true) ; + } \stopJSpreamble diff --git a/tex/context/base/java-imp-fld.mkiv b/tex/context/base/java-imp-fld.mkiv index 93a90dc0a..30847b201 100644 --- a/tex/context/base/java-imp-fld.mkiv +++ b/tex/context/base/java-imp-fld.mkiv @@ -11,216 +11,249 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -% will be simplified, since we now parse functions - -% nu nog alles geladen, moet dus anders - -\startJSpreamble {Sanitize_TeX_Input} used later - - function Sanitized_TeX_String (value) - { var v = value ; - v = v.replace( /\\\\oe/g,"\\234") ; - v = v.replace( /\\\\<</g,"\\253") ; - v = v.replace( /\\\\>>/g,"\\273") ; - v = v.replace( /\\\\`A/g,"\\300") ; - v = v.replace( /\\\\'A/g,"\\301") ; - v = v.replace( /\\\\^A/g,"\\302") ; - v = v.replace( /\\\\~A/g,"\\303") ; - v = v.replace( /\\\\"A/g,"\\304") ; - v = v.replace( /\\\\oA/g,"\\305") ; - v = v.replace( /\\\\AE/g,"\\306") ; - v = v.replace( /\\\\,C/g,"\\307") ; - v = v.replace( /\\\\`E/g,"\\310") ; - v = v.replace( /\\\\'E/g,"\\311") ; - v = v.replace( /\\\\^E/g,"\\312") ; - v = v.replace( /\\\\"E/g,"\\313") ; - v = v.replace( /\\\\`I/g,"\\314") ; - v = v.replace( /\\\\'I/g,"\\315") ; - v = v.replace( /\\\\^I/g,"\\316") ; - v = v.replace( /\\\\"I/g,"\\317") ; - v = v.replace( /\\\\~N/g,"\\321") ; - v = v.replace( /\\\\`O/g,"\\322") ; - v = v.replace( /\\\\'O/g,"\\323") ; - v = v.replace( /\\\\^O/g,"\\324") ; - v = v.replace( /\\\\~O/g,"\\325") ; - v = v.replace( /\\\\"O/g,"\\326") ; - v = v.replace( /\\\\`U/g,"\\331") ; - v = v.replace( /\\\\'U/g,"\\332") ; - v = v.replace( /\\\\^U/g,"\\333") ; - v = v.replace( /\\\\"U/g,"\\334") ; - v = v.replace( /\\\\'Y/g,"\\335") ; - v = v.replace( /\\\\ss/g,"\\337") ; - v = v.replace( /\\\\`a/g,"\\340") ; - v = v.replace( /\\\\'a/g,"\\341") ; - v = v.replace( /\\\\^a/g,"\\342") ; - v = v.replace( /\\\\~a/g,"\\343") ; - v = v.replace( /\\\\"a/g,"\\344") ; - v = v.replace( /\\\\oa/g,"\\345") ; - v = v.replace( /\\\\ae/g,"\\346") ; - v = v.replace( /\\\\,c/g,"\\347") ; - v = v.replace( /\\\\`e/g,"\\350") ; - v = v.replace( /\\\\'e/g,"\\351") ; - v = v.replace( /\\\\^e/g,"\\352") ; - v = v.replace( /\\\\"e/g,"\\353") ; - v = v.replace( /\\\\`i/g,"\\354") ; - v = v.replace( /\\\\'i/g,"\\355") ; - v = v.replace( /\\\\^i/g,"\\356") ; - v = v.replace( /\\\\"i/g,"\\357") ; - v = v.replace( /\\\\~n/g,"\\361") ; - v = v.replace( /\\\\`o/g,"\\362") ; - v = v.replace( /\\\\'o/g,"\\363") ; - v = v.replace( /\\\\^o/g,"\\364") ; - v = v.replace( /\\\\~o/g,"\\365") ; - v = v.replace( /\\\\"o/g,"\\366") ; - v = v.replace( /\\\\`u/g,"\\371") ; - v = v.replace( /\\\\'u/g,"\\372") ; - v = v.replace( /\\\\^u/g,"\\373") ; - v = v.replace( /\\\\"u/g,"\\374") ; - v = v.replace( /\\\\'y/g,"\\375") ; - v = v.replace( /\\\\"y/g,"\\377") ; - return(v) } - - var TeX_Key_Mode = 0 ; - - function Initialize_TeX_Keystroke () - { TeX_Key_Char = "" ; - TeX_Key_Mode = 0 } - - function Sanitized_TeX_Keystroke (change) - { if (change=="\\\\") - { TeX_Key_Mode = 1 ; - return("") } - else if (TeX_Key_Mode==1) - { TeX_Key_Mode = 2 ; - TeX_Key_Char = change ; - return("") } - else if (TeX_Key_Mode==2) - { TeX_Key_Mode = 0 ; - TeX_Key_Char = "\\\\"+TeX_Key_Char+change ; - return(Sanitized_TeX_String(TeX_Key_Char)) } - else - { TeX_Key_Mode = 0 ; - return(change) } } +%D In \LUATEX\ the following does not work out well: +%D +%D \starttyping +%D v = v.replace(/\\\\"e/g,"\\353") ; +%D \stoptyping +%D +%D But this does: +%D +%D \starttyping +%D v = String(v).replace(/\\\\"e/g,"\\353") ; +%D \stoptyping +%D +%D Probably a \UNICODE\ issue. Beware, in \MKIV\ we have a +%D different escaping of \type {\\}. + +\startluasetups javascript:pdfencoding + local verbatim = context.verbatim + verbatim("{\n") + for accent, group in table.sortedhash(characters.tex.accentmapping) do + for character, mapping in table.sortedhash(group) do + if character == "" then + character = " " + end + if accent == '"' then + verbatim(" '%s%s' : '\\u%04X',\n",accent,character,utf.byte(mapping)) + else + verbatim(' "%s%s" : "\\u%04X",\n',accent,character,utf.byte(mapping)) + end + end + end + verbatim(" 'OE' : '\\u0152',\n") + verbatim(" 'oe' : '\\u0153',\n") + verbatim(" 'AE' : '\\u00C6',\n") + verbatim(" 'ae' : '\\u00C7',\n") + verbatim(" '<<' : '\\u00AB',\n") + verbatim(" '>>' : '\\u00BB',\n") + verbatim(" 'ss' : '\\u00DF' \n") + verbatim("}\n") +\stopluasetups + +% maybe make { } tex braces in javascript code so that we can call lua + +\def\JavaScriptTeXAccentMapping{\luasetup{javascript:pdfencoding}} + +\startJSpreamble SanitizeTeXInput used later + +var TeXAccentMapping = \JavaScriptTeXAccentMapping + +function TeX_Replacer(original,str) { + return (TeXAccentMapping[str] || str) ; +} -\stopJSpreamble +function Sanitized_TeX_String(value) { + return (value.replace(/\\(..)/g, TeX_Replacer)) ; +} -\startJScode {Initialize_TeX_Key} uses {Sanitize_TeX_Input} - Initialize_TeX_Keystroke() ; -\stopJScode +var TeX_Key_Mode = 0 ; +var TeX_Key_Char = "" ; -\startJScode {Convert_TeX_Key} uses {Sanitize_TeX_Input} - if (!event.willCommit) - { event.change = Sanitized_TeX_Keystroke(event.change) } -\stopJScode +function Initialize_TeX_Keystroke() { + TeX_Key_Char = "" ; + TeX_Key_Mode = 0 ; +} -\startJScode{Convert_TeX_String} uses {Sanitize_TeX_Input} - event.value = Sanitized_TeX_String(event.value) ; -\stopJScode +function Sanitized_TeX_Keystroke(change) { + if (!event.willCommit) { + if (change=="\\") { + TeX_Key_Mode = 1 ; + return ("") + } else if (TeX_Key_Mode == 1) { + TeX_Key_Mode = 2 ; + TeX_Key_Char = change ; + return ("") + } else if (TeX_Key_Mode == 2) { + TeX_Key_Mode = 0 ; + TeX_Key_Char = "\\"+TeX_Key_Char+change ; + return (Sanitized_TeX_String(TeX_Key_Char)) + } else { + TeX_Key_Mode = 0 ; + return (change) + } + } +} + +function Initialize_TeX_Key() { + Initialize_TeX_Keystroke() ; +} -\startJSpreamble fields_1 used now +function Convert_TeX_Key() { + if (!event.willCommit) { + event.change = Sanitized_TeX_Keystroke(event.change) ; + } +} + +function Convert_TeX_String() { + event.value = Sanitized_TeX_String(event.value) ; +} + +\stopJSpreamble + +% \startJScode {Initialize_TeX_Key} uses {SanitizeTeXInput} +% Initialize_TeX_Keystroke() ; +% \stopJScode +% +% \startJScode {Convert_TeX_Key} uses {SanitizeTeXInput} +% if (!event.willCommit) { +% event.change = Sanitized_TeX_Keystroke(event.change) ; +% } +% \stopJScode +% +% \startJScode{Convert_TeX_String} uses {SanitizeTeXInput} +% event.value = Sanitized_TeX_String(event.value) ; +% \stopJScode + +% was used now but we autocheck anyway so lets test this for a while + +\startJSpreamble FieldsStates used later var visible_field = new Array() ; var visible_fields = 0 ; -function PresetFields ( ) - { this.syncAnnotScan() } +function PresetFields() { + this.syncAnnotScan() ; +} -function Preset_Fields ( ) - { this.syncAnnotScan() } +function Preset_Fields() { + this.syncAnnotScan() ; +} -function Hide_When_Down ( ) - { event.target.hidden = true } +function Hide_When_Down() { + event.target.hidden = true ; +} -function Hide_Field ( Name ) - { var v = this.getField(Name) ; - if (v) - { v.hidden = true ; +function Hide_Field(Name) { + var v = this.getField(Name) ; + if (v) { + v.hidden = true ; v.readonly = true ; - this.dirty = false } } + this.dirty = false ; + } +} -function Do_Vide_Field ( Name, Closable ) - { var v = this.getField(Name) ; - if (v) - { ++visible_fields ; +function Do_Vide_Field(Name, Closable) { + var v = this.getField(Name) ; + if (v) { + ++visible_fields ; visible_field[visible_fields] = Name ; v.hidden = false ; - if (Closable) - { v.readonly = false ; - v.value = "On" } - this.dirty = false } } - -function Vide_Field ( Name ) - { Do_Vide_Field(Name,false) } - -function Vide_Hide_Field ( Name ) - { Do_Vide_Field(Name,true) } - -function Hide_Fields () - { while (visible_fields>0) - { Hide_Field(visible_field[visible_fields]) ; - --visible_fields } } - -function Vide_Fields ( Name ) - { Hide_Fields () ; - Vide_Field ( Name) } - -function Vide_Hide_Fields ( Name ) - { Hide_Fields () ; - Vide_Hide_Field ( Name) } - -function Toggle_Hide ( Name ) - { var v = this.getField(Name) ; - if (v) - { v.hidden = !v.hidden ; - this.dirty = false } } - -function Field_On ( Name ) - { v = this.getField(Name) ; - if (v) { v.value = "On" ; this.dirty = false } } - -function Field_Off ( Name ) - { var v = this.getField(Name) ; - if (v) { v.value = "Off" ; this.dirty = false } } - -function Toggle_Value ( Name ) - { var v = this.getField(Name) ; - if (v) - { if (v.value=="On") - { v.value = "Off" } - else - { v.value = "On" } } - this.dirty = false } - -function Toggle_Read ( Name ) - { var v = this.getField(Name); - if (v) { v.readonly = !v.readonly } } - -function Flip_Fields ( Name ) - { var Names = Name.split(",") ; - for (var i=0;i<Names.length;i++) - { v = this.getField(Names[i]) ; - if (v) - { v.hidden = !v.hidden ; - v.value = "On" } } } - -function Forget_Changes () - { this.dirty = false } - -function ForgetChanges () - { this.dirty = false } -\stopJSpreamble + if (Closable) { + v.readonly = false ; + v.value = "On" ; + } + this.dirty = false ; + } +} -%\startJScode{Hide_When_Down} Hide_When_Down() \stopJScode -%\startJScode{Hide_Field} Hide_Field(JS_S_1) \stopJScode -%\startJScode{Vide_Field} Vide_Field(JS_S_1) \stopJScode -%\startJScode{Toggle_Hide} Toggle_Hide(JS_S_1) \stopJScode -%\startJScode{Field_On} Field_On(JS_S_1) \stopJScode -%\startJScode{Field_Off} Field_Off(JS_S_1) \stopJScode -%\startJScode{Toggle_Value} Toggle_Value(JS_S_1) \stopJScode -%\startJScode{Toggle_Read} Toggle_Read(JS_S_1) \stopJScode -%\startJScode{Flip_Fields} Flip_Fields(JS_S_1) \stopJScode -% -%\startJScode{Forget_Changes} this.dirty = false \stopJScode +function Vide_Field(Name) { + Do_Vide_Field(Name,false) ; +} + +function Vide_Hide_Field(Name) { + Do_Vide_Field(Name,true) ; +} + +function Hide_Fields() { + while (visible_fields>0) { + Hide_Field(visible_field[visible_fields]) ; + --visible_fields ; + } +} + +function Vide_Fields(Name) { + Hide_Fields() ; + Vide_Field(Name) ; +} + +function Vide_Hide_Fields(Name) { + Hide_Fields() ; + Vide_Hide_Field(Name) ; +} + +function Toggle_Hide(Name) { + var v = this.getField(Name) ; + if (v) { + v.hidden = !v.hidden ; + this.dirty = false ; + } +} + +function Field_On(Name) { + v = this.getField(Name) ; + if (v) { + v.value = "On" ; + this.dirty = false ; + } +} + +function Field_Off(Name) { + var v = this.getField(Name) ; + if (v) { + v.value = "Off" ; + this.dirty = false ; + } +} + +function Toggle_Value(Name) { + var v = this.getField(Name) ; + if (v) { + if (v.value == "On") { + v.value = "Off" ; + } else { + v.value = "On" ; + } + } + this.dirty = false ; +} + +function Toggle_Read(Name) { + var v = this.getField(Name); + if (v) { + v.readonly = !v.readonly ; + } +} + +function Flip_Fields(Name) { + var Names = Name.split(",") ; + for (var i=0; i < Names.length; i++) { + v = this.getField(Names[i]) ; + if (v) { + v.hidden = !v.hidden ; + v.value = "On" ; + } + } +} + +function Forget_Changes() { + this.dirty = false ; +} + +function ForgetChanges() { + this.dirty = false ; +} +\stopJSpreamble \definereference[ForgetChanges][JS(Forget_Changes)] @@ -229,7 +262,7 @@ function ForgetChanges () \startJSpreamble FieldStack used later -function Reset_Fields ( FieldSet ) { +function Reset_Fields(FieldSet) { var i = 1 ; while (true) { v = this.getField(FieldSet+":"+i) ; @@ -242,7 +275,7 @@ function Reset_Fields ( FieldSet ) { } } -function Set_Fields ( FieldSet ) { +function Set_Fields(FieldSet) { var i = 1 ; while (true) { v = this.getField(FieldSet+":"+i) ; @@ -255,7 +288,7 @@ function Set_Fields ( FieldSet ) { } } -function Set_Field ( FieldSet, FieldName ) { +function Set_Field(FieldSet, FieldName) { Reset_Fields(FieldSet) ; v = this.getField(FieldSet+":"+FieldName) ; if (v) { @@ -263,7 +296,7 @@ function Set_Field ( FieldSet, FieldName ) { } } -function Reset_Field ( FieldSet, FieldName ) { +function Reset_Field(FieldSet, FieldName) { Set_Fields(FieldSet) ; v = this.getField(FieldSet+":"+FieldName) ; if (v) { @@ -271,7 +304,7 @@ function Reset_Field ( FieldSet, FieldName ) { } } -function Walk_Field ( FieldSet ) { +function Walk_Field(FieldSet) { var i = 1 ; while (true) { v = this.getField(FieldSet+":"+i) ; @@ -298,7 +331,7 @@ function Walk_Field ( FieldSet ) { var FieldSets = new Array() ; -function Do_Get_Check_Walk_Field ( FieldSet ) { +function Do_Get_Check_Walk_Field(FieldSet) { var f = FieldSets[FieldSet] if (! f) { f = new Array() ; @@ -313,7 +346,7 @@ function Do_Get_Check_Walk_Field ( FieldSet ) { return f } -function Do_Next_Auto_Walk_Field ( FieldSet ) { +function Do_Next_Auto_Walk_Field(FieldSet) { var fieldset = Do_Get_Check_Walk_Field(FieldSet) ; if (fieldset) { var v = this.getField(FieldSet + ":" + fieldset.number) ; @@ -329,12 +362,12 @@ function Do_Next_Auto_Walk_Field ( FieldSet ) { v = this.getField(FieldSet + ":" + fieldset.number) ; } if (v) { - v.value = "On" + v.value = "On" ; } } } -function Do_Stop_Auto_Walk_Field ( FieldSet ) { +function Do_Stop_Auto_Walk_Field(FieldSet) { var fieldset = Do_Get_Check_Walk_Field(FieldSet) ; if (fieldset) { try { @@ -345,7 +378,7 @@ function Do_Stop_Auto_Walk_Field ( FieldSet ) { } } -function Do_Start_Auto_Walk_Field ( FieldSet ) { +function Do_Start_Auto_Walk_Field(FieldSet) { var fieldset = Do_Get_Check_Walk_Field(FieldSet) ; if (fieldset) { Do_Stop_Auto_Walk_Field(FieldSet) ; @@ -353,7 +386,7 @@ function Do_Start_Auto_Walk_Field ( FieldSet ) { } } -function Start_Walk_Field ( FieldSet, Delay ) { +function Start_Walk_Field(FieldSet, Delay) { var fieldset = Do_Get_Check_Walk_Field(FieldSet) ; if (fieldset) { fieldset.number = 0 ; @@ -367,7 +400,7 @@ function Start_Walk_Field ( FieldSet, Delay ) { } } -function Pause_Walk_Field ( FieldSet ) { +function Pause_Walk_Field(FieldSet) { var fieldset = Do_Get_Check_Walk_Field(FieldSet) ; if (fieldset) { if (fieldset.running) { @@ -382,7 +415,7 @@ function Pause_Walk_Field ( FieldSet ) { } } -function Stop_Walk_Field ( FieldSet ) { +function Stop_Walk_Field(FieldSet) { var fieldset = Do_Get_Check_Walk_Field(FieldSet) ; if (fieldset) { Do_Stop_Auto_Walk_Field(FieldSet) ; @@ -391,7 +424,7 @@ function Stop_Walk_Field ( FieldSet ) { } } -function Reset_Walk_Field ( FieldSet ) { +function Reset_Walk_Field(FieldSet) { var fieldset = Do_Get_Check_Walk_Field(FieldSet) ; if (fieldset) { Do_Stop_Auto_Walk_Field(FieldSet) ; @@ -402,7 +435,7 @@ function Reset_Walk_Field ( FieldSet ) { } } -function Previous_Walk_Field ( FieldSet ) { +function Previous_Walk_Field(FieldSet) { var fieldset = Do_Get_Check_Walk_Field(FieldSet) ; if (fieldset) { Do_Stop_Auto_Walk_Field(FieldSet) ; @@ -424,7 +457,7 @@ function Previous_Walk_Field ( FieldSet ) { } } -function Next_Walk_Field ( FieldSet ) { +function Next_Walk_Field(FieldSet) { var fieldset = Do_Get_Check_Walk_Field(FieldSet) ; if (fieldset) { Do_Stop_Auto_Walk_Field(FieldSet) ; @@ -448,7 +481,7 @@ function Next_Walk_Field ( FieldSet ) { } } -function Set_Walk_Field_Delay ( FieldSet, Delay ) { +function Set_Walk_Field_Delay(FieldSet, Delay) { var fieldset = Do_Get_Check_Walk_Field(FieldSet) ; if (fieldset) { if (Delay) { diff --git a/tex/context/base/java-imp-stp.mkiv b/tex/context/base/java-imp-stp.mkiv index df4fbcc2f..ebddd8cc6 100644 --- a/tex/context/base/java-imp-stp.mkiv +++ b/tex/context/base/java-imp-stp.mkiv @@ -17,99 +17,101 @@ % we cannot use doc_visited[this.pageNum] instead of doc_currentstep because % of some funny side effect (i.e. dup or so) +% todo: test with later as we do autoinsert now + \startJSpreamble Steps used now - var doc_ocglist = this.getOCGs() ; - var doc_stepname = "step" ; - var doc_currentstep = 0 ; - var doc_maxstep = 50 ; - var doc_visited = new Array() ; - var doc_busy = new Array() ; - - function SetupStepper ( layername, laststep ) { - doc_stepname = layername ; - doc_maxstep = laststep ; - for (var i=0; i<=this.numPages; i++) { - doc_visited[i] = 0 ; - doc_busy[i] = 0 ; - } - } +var doc_ocglist = this.getOCGs() ; +var doc_stepname = "step" ; +var doc_currentstep = 0 ; +var doc_maxstep = 50 ; +var doc_visited = new Array() ; +var doc_busy = new Array() ; +function SetupStepper(layername,laststep) { + doc_stepname = layername ; + doc_maxstep = laststep ; for (var i=0; i<=this.numPages; i++) { doc_visited[i] = 0 ; doc_busy[i] = 0 ; } +} - function GetOCG ( name ) { - for (var i=0; i < doc_ocglist.length; i++) { - if (doc_ocglist[i].name == name) { - return doc_ocglist[i] ; - } +for (var i=0; i<=this.numPages; i++) { + doc_visited[i] = 0 ; + doc_busy[i] = 0 ; +} + +function GetOCG(name) { + for (var i=0; i < doc_ocglist.length; i++) { + if (doc_ocglist[i].name == name) { + return doc_ocglist[i] ; } - return null ; } + return null ; +} - function CheckBusy ( ) { - var ocg = GetOCG("step:busy") ; - if (ocg != null) { - if (doc_visited[this.pageNum]==0) { +function CheckBusy() { + var ocg = GetOCG("step:busy") ; + if (ocg != null) { + if (doc_visited[this.pageNum]==0) { + ocg.state = true ; + } else { + if (doc_visited[this.pageNum]<doc_busy[this.pageNum]) { ocg.state = true ; } else { - if (doc_visited[this.pageNum]<doc_busy[this.pageNum]) { - ocg.state = true ; - } else { - ocg.state = false ; - } + ocg.state = false ; } } - } + } +} - function SetStepper ( maxstep, state ) { - for (var i=1; i<=maxstep; i++) { - try { - var ocg = GetOCG(doc_stepname + ':' + String(i)) ; - if (ocg != null) { - ocg.state = state ; - } - } catch (e) { - return ; +function SetStepper(maxstep,state) { + for (var i=1; i<=maxstep; i++) { + try { + var ocg = GetOCG(doc_stepname + ':' + String(i)) ; + if (ocg != null) { + ocg.state = state ; } + } catch (e) { + return ; } } +} - function CheckStepper ( maxsteps ) { - SetStepper(doc_visited[this.pageNum], true) ; - doc_busy[this.pageNum] = Number(maxsteps) ; - doc_currentstep = doc_visited[this.pageNum] ; - CheckBusy() ; - } +function CheckStepper(maxsteps) { + SetStepper(doc_visited[this.pageNum], true) ; + doc_busy[this.pageNum] = Number(maxsteps) ; + doc_currentstep = doc_visited[this.pageNum] ; + CheckBusy() ; +} - function ResetStepper ( ) { - SetStepper(doc_maxstep, false) ; - doc_currentstep = 0 ; - } +function ResetStepper() { + SetStepper(doc_maxstep, false) ; + doc_currentstep = 0 ; +} - function InvokeStepper ( ) { - try { - if (doc_currentstep<doc_busy[this.pageNum]) { - doc_currentstep += 1 ; - doc_visited[this.pageNum] = doc_currentstep ; - var ocg = GetOCG(doc_stepname + ':' + String(doc_currentstep)) ; - if (ocg != null) { - ocg.state = true ; - } +function InvokeStepper() { + try { + if (doc_currentstep<doc_busy[this.pageNum]) { + doc_currentstep += 1 ; + doc_visited[this.pageNum] = doc_currentstep ; + var ocg = GetOCG(doc_stepname + ':' + String(doc_currentstep)) ; + if (ocg != null) { + ocg.state = true ; + } + } else { + if (this.pageNum+1==this.numPages) { + this.pageNum = 0 ; } else { - if (this.pageNum+1==this.numPages) { - this.pageNum = 0 ; - } else { - this.pageNum += 1 ; - } + this.pageNum += 1 ; } - CheckBusy() ; - } catch (e) { - return ; } + CheckBusy() ; + } catch (e) { + return ; } +} \stopJSpreamble diff --git a/tex/context/base/java-ini.lua b/tex/context/base/java-ini.lua index a53c06adf..efe00ffce 100644 --- a/tex/context/base/java-ini.lua +++ b/tex/context/base/java-ini.lua @@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['java-ini'] = { local format = string.format local concat = table.concat -local lpegmatch, lpegP, lpegR, lpegS, lpegC = lpeg.match, lpeg.P, lpeg.R, lpeg.S, lpeg.C +local lpegmatch, lpegP, lpegR, lpegS, lpegC, lpegCarg = lpeg.match, lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Carg local allocate = utilities.storage.allocate local variables = interfaces.variables @@ -30,8 +30,8 @@ local codes, preambles, functions = javascripts.codes, javascripts.preambles, ja local preambled = { } -local function storefunction(s) - functions[s] = true +local function storefunction(s,preamble) + functions[s] = preamble end local uses = lpegP("uses") @@ -48,7 +48,7 @@ local script = lpegC(any^1) local funct = lpegP("function") local leftp = lpegP("(") local rightp = lpegP(")") -local fname = spaces * funct * spaces * (((1-space-left)^1)/storefunction) * spaces * leftp +local fname = spaces * funct * spaces * (lpegC((1-space-left-leftp)^1) * lpegCarg(1) / storefunction) * spaces * leftp local parsecode = name * ((uses * name) + lpeg.Cc("")) * spaces * script local parsepreamble = name * ((used * name) + lpeg.Cc("")) * spaces * script @@ -70,7 +70,7 @@ function javascripts.storepreamble(str) -- now later if trace_javascript then report_javascript("storing preamble '%s', state '%s', order '%s'",name,used,n) end - lpegmatch(parsefunctions,script) + lpegmatch(parsefunctions,script,1,n) end end @@ -82,7 +82,7 @@ function javascripts.setpreamble(name,script) -- now later if trace_javascript then report_javascript("setting preamble '%s', state 'now', order '%s'",name,n) end - lpegmatch(parsefunctions,script) + lpegmatch(parsefunctions,script,1,n) end end @@ -101,7 +101,7 @@ function javascripts.addtopreamble(name,script) -- now later if trace_javascript then report_javascript("storing preamble '%s', state 'now', order '%s'",name,n) end - lpegmatch(parsefunctions,script) + lpegmatch(parsefunctions,script,1,n) end end end @@ -155,6 +155,7 @@ function javascripts.code(name,arguments) reported[name] = true report_javascript("using function '%s'",name) end +preambles[f][2] = "now" -- automatically tag preambles that define the function (as later) if arguments then local args = lpegmatch(splitter,arguments) for i=1,#args do -- can be a helper diff --git a/tex/context/base/java-ini.mkiv b/tex/context/base/java-ini.mkiv index a0d641240..4013d82af 100644 --- a/tex/context/base/java-ini.mkiv +++ b/tex/context/base/java-ini.mkiv @@ -106,7 +106,11 @@ %D \JAVASCRIPT\ preambles. \unexpanded\def\startJScode - {\begingroup\obeylualines\obeyluatokens\dostartJScode} + {\begingroup + \obeylualines + \obeyluatokens + \def\u{\letterbackslash u}% + \dostartJScode} \long\def\dostartJScode#1\stopJScode {\normalexpanded{\endgroup\ctxlua{interactions.javascripts.storecode(\!!bs#1\!!es)}}} @@ -114,7 +118,11 @@ \let\stopJScode\relax \unexpanded\def\startJSpreamble - {\begingroup\obeylualines\obeyluatokens\dostartJSpreamble} + {\begingroup + \obeylualines + \obeyluatokens + \def\u{\letterbackslash u}% + \dostartJSpreamble} \long\def\dostartJSpreamble#1\stopJSpreamble {\normalexpanded{\endgroup\ctxlua{interactions.javascripts.storepreamble(\!!bs#1\!!es)}}} diff --git a/tex/context/base/l-dir.lua b/tex/context/base/l-dir.lua index 878698b16..2c4ff999b 100644 --- a/tex/context/base/l-dir.lua +++ b/tex/context/base/l-dir.lua @@ -59,22 +59,20 @@ end --~ end local function globpattern(path,patt,recurse,action) - if isdir(path) then - if path == "/" then - path = path .. "." - elseif not find(path,"/$") then - path = path .. '/' - end - for name in walkdir(path) do - local full = path .. name - local mode = attributes(full,'mode') - if mode == 'file' then - if find(full,patt) then - action(full) - end - elseif recurse and (mode == "directory") and (name ~= '.') and (name ~= "..") then - globpattern(full,patt,recurse,action) + if path == "/" then + path = path .. "." + elseif not find(path,"/$") then + path = path .. '/' + end + for name in walkdir(path) do + local full = path .. name + local mode = attributes(full,'mode') + if mode == 'file' then + if find(full,patt) then + action(full) end + elseif recurse and (mode == "directory") and (name ~= '.') and (name ~= "..") then + globpattern(full,patt,recurse,action) end end end diff --git a/tex/context/base/lpdf-fld.lua b/tex/context/base/lpdf-fld.lua index 88ea617ed..622b56098 100644 --- a/tex/context/base/lpdf-fld.lua +++ b/tex/context/base/lpdf-fld.lua @@ -178,6 +178,163 @@ end -- fonts and color + +local pdfdocencodingvector, pdfdocencodingcapsule + +local function checkpdfdocencoding() + local encoding = pdfdictionary { + Type = pdfconstant("Encoding"), + Differences = pdfarray { + 24, + pdfconstant("breve"), + pdfconstant("caron"), + pdfconstant("circumflex"), + pdfconstant("dotaccent"), + pdfconstant("hungarumlaut"), + pdfconstant("ogonek"), + pdfconstant("ring"), + pdfconstant("tilde"), + 39, + pdfconstant("quotesingle"), + 96, + pdfconstant("grave"), + 128, + pdfconstant("bullet"), + pdfconstant("dagger"), + pdfconstant("daggerdbl"), + pdfconstant("ellipsis"), + pdfconstant("emdash"), + pdfconstant("endash"), + pdfconstant("florin"), + pdfconstant("fraction"), + pdfconstant("guilsinglleft"), + pdfconstant("guilsinglright"), + pdfconstant("minus"), + pdfconstant("perthousand"), + pdfconstant("quotedblbase"), + pdfconstant("quotedblleft"), + pdfconstant("quotedblright"), + pdfconstant("quoteleft"), + pdfconstant("quoteright"), + pdfconstant("quotesinglbase"), + pdfconstant("trademark"), + pdfconstant("fi"), + pdfconstant("fl"), + pdfconstant("Lslash"), + pdfconstant("OE"), + pdfconstant("Scaron"), + pdfconstant("Ydieresis"), + pdfconstant("Zcaron"), + pdfconstant("dotlessi"), + pdfconstant("lslash"), + pdfconstant("oe"), + pdfconstant("scaron"), + pdfconstant("zcaron"), + 160, + pdfconstant("Euro"), + 164, + pdfconstant("currency"), + 166, + pdfconstant("brokenbar"), + 168, + pdfconstant("dieresis"), + pdfconstant("copyright"), + pdfconstant("ordfeminine"), + 172, + pdfconstant("logicalnot"), + pdfconstant(".notdef"), + pdfconstant("registered"), + pdfconstant("macron"), + pdfconstant("degree"), + pdfconstant("plusminus"), + pdfconstant("twosuperior"), + pdfconstant("threesuperior"), + pdfconstant("acute"), + pdfconstant("mu"), + 183, + pdfconstant("periodcentered"), + pdfconstant("cedilla"), + pdfconstant("onesuperior"), + pdfconstant("ordmasculine"), + 188, + pdfconstant("onequarter"), + pdfconstant("onehalf"), + pdfconstant("threequarters"), + 192, + pdfconstant("Agrave"), + pdfconstant("Aacute"), + pdfconstant("Acircumflex"), + pdfconstant("Atilde"), + pdfconstant("Adieresis"), + pdfconstant("Aring"), + pdfconstant("AE"), + pdfconstant("Ccedilla"), + pdfconstant("Egrave"), + pdfconstant("Eacute"), + pdfconstant("Ecircumflex"), + pdfconstant("Edieresis"), + pdfconstant("Igrave"), + pdfconstant("Iacute"), + pdfconstant("Icircumflex"), + pdfconstant("Idieresis"), + pdfconstant("Eth"), + pdfconstant("Ntilde"), + pdfconstant("Ograve"), + pdfconstant("Oacute"), + pdfconstant("Ocircumflex"), + pdfconstant("Otilde"), + pdfconstant("Odieresis"), + pdfconstant("multiply"), + pdfconstant("Oslash"), + pdfconstant("Ugrave"), + pdfconstant("Uacute"), + pdfconstant("Ucircumflex"), + pdfconstant("Udieresis"), + pdfconstant("Yacute"), + pdfconstant("Thorn"), + pdfconstant("germandbls"), + pdfconstant("agrave"), + pdfconstant("aacute"), + pdfconstant("acircumflex"), + pdfconstant("atilde"), + pdfconstant("adieresis"), + pdfconstant("aring"), + pdfconstant("ae"), + pdfconstant("ccedilla"), + pdfconstant("egrave"), + pdfconstant("eacute"), + pdfconstant("ecircumflex"), + pdfconstant("edieresis"), + pdfconstant("igrave"), + pdfconstant("iacute"), + pdfconstant("icircumflex"), + pdfconstant("idieresis"), + pdfconstant("eth"), + pdfconstant("ntilde"), + pdfconstant("ograve"), + pdfconstant("oacute"), + pdfconstant("ocircumflex"), + pdfconstant("otilde"), + pdfconstant("odieresis"), + pdfconstant("divide"), + pdfconstant("oslash"), + pdfconstant("ugrave"), + pdfconstant("uacute"), + pdfconstant("ucircumflex"), + pdfconstant("udieresis"), + pdfconstant("yacute"), + pdfconstant("thorn"), + pdfconstant("ydieresis"), + }, + } + pdfdocencodingvector = pdfreference(pdfflushobject(encoding)) + local capsule = pdfdictionary { + PDFDocEncoding = pdfdocencodingvector + } + pdfdocencodingcapsule = pdfreference(pdfflushobject(capsule)) + checkpdfdocencoding = function() end +end + local fontnames = { rm = { tf = "Times-Roman", @@ -239,13 +396,15 @@ end local function registerfonts() if next(usedfonts) then + checkpdfdocencoding() local d = pdfdictionary() for tag, name in next, usedfonts do local f = pdfdictionary { Type = pdfconstant("Font"), - Subtype = pdfconstant("Type1"), -- todo + Subtype = pdfconstant("Type1"), Name = pdfconstant(tag), BaseFont = pdfconstant(name), + Encoding = pdfdocencodingvector, } d[tag] = pdfreference(pdfflushobject(f)) end @@ -620,11 +779,15 @@ local function finishfields() end end if #collected > 0 then + checkpdfdocencoding() usedfonts.tttf = fontnames.tt.tf local acroform = pdfdictionary { NeedAppearances = true, Fields = pdfreference(pdfflushobject(collected)), - DR = pdfdictionary { Font = registerfonts() }, + DR = pdfdictionary { + Font = registerfonts(), + Encoding = pdfdocencodingcapsule, + }, CO = fieldsetlist(calculationset), DA = "/tttf 12 Tf 0 g", } diff --git a/tex/context/base/lpdf-ini.lua b/tex/context/base/lpdf-ini.lua index 839b68895..2defa3f2e 100644 --- a/tex/context/base/lpdf-ini.lua +++ b/tex/context/base/lpdf-ini.lua @@ -43,7 +43,7 @@ local lpdf = lpdf local function tosixteen(str) if not str or str == "" then - return "()" + return "<feff>" -- not () as we want an indication that it's unicode else local r, n = { "<feff" }, 1 for b in utfvalues(str) do diff --git a/tex/context/base/m-zint.mkiv b/tex/context/base/m-zint.mkiv index 815d83fab..25371cff2 100644 --- a/tex/context/base/m-zint.mkiv +++ b/tex/context/base/m-zint.mkiv @@ -55,10 +55,14 @@ end function moduledata.zint.generate(code,data,suffix,options) local code = cleancode(code) - local name = format("zint-%s-%s.%s",code,md5.hex(data),suffix or "eps") + local base = format("zint-%s-%s",code,md5.hex(data)) + local name = file.addsuffix(base,suffix or "eps") if not lfs.isfile(name) then + local temp = file.addsuffix(base,"tmp") local code = numberofcode(code) - os.spawn(format('%s --barcode=%s --output="%s" %s --data="%s"',zint,code,name,options or "",data)) + logs.simple("using 'zint' to generate '%s'",base) + io.savedata(temp,data) + os.execute(format('%s --barcode=%s --output="%s" --input="%s"',zint,code,name,temp,options or "")) end return name end @@ -69,6 +73,8 @@ end \starttext + \externalfigure[\cldcontext{moduledata.zint.generate("PDF417",[[Hans Hagen]])}] + \blank \externalfigure[\cldcontext{moduledata.zint.generate("PDF417","Ton Otten")}] \blank \externalfigure[\cldcontext{moduledata.zint.generate("ISBN","9789490688011")}] diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv index 5b017e055..5d1c7e8b7 100644 --- a/tex/context/base/math-ini.mkiv +++ b/tex/context/base/math-ini.mkiv @@ -396,8 +396,18 @@ \newconditional \knuthmode -\def\nonknuthmode{\the\everynonknuthmode\let\nonknuthmode\relax} -\def\donknuthmode{\the\everydonknuthmode} +\def\nonknuthmode + {\pushcatcodes + \setcatcodetable\ctxcatcodes + \the\everynonknuthmode + \let\nonknuthmode\relax + \popcatcodes} + +\def\donknuthmode + {\pushcatcodes + \setcatcodetable\ctxcatcodes + \the\everydonknuthmode + \popcatcodes} \bgroup diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex bda299c0c..b7e3252c4 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/supp-fil.lua b/tex/context/base/supp-fil.lua index 0ea1fa2b8..acc3bbe66 100644 --- a/tex/context/base/supp-fil.lua +++ b/tex/context/base/supp-fil.lua @@ -337,6 +337,7 @@ function commands.uselibrary(name,patterns,action,failure) if foundname ~= "" then action(name,foundname) done = true + break end end if done then diff --git a/tex/context/base/symb-eur.mkiv b/tex/context/base/symb-eur.mkiv new file mode 100644 index 000000000..4ec5a8931 --- /dev/null +++ b/tex/context/base/symb-eur.mkiv @@ -0,0 +1,52 @@ +%D \module +%D [ file=symb-eur, +%D version=2000.06.22, +%D title=\CONTEXT\ Symbol Libraries, +%D subtitle=Adobe Euro Symbols, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\definefontsynonym [EuroSerif] [eurose] +\definefontsynonym [EuroSerifBold] [euroseb] +\definefontsynonym [EuroSerifItalic] [eurosei] +\definefontsynonym [EuroSerifSlanted] [eurosei] +\definefontsynonym [EuroSerifBoldItalic] [eurosebi] +\definefontsynonym [EuroSerifBoldSlanted] [eurosebi] + +\definefontsynonym [EuroSans] [eurosa] +\definefontsynonym [EuroSansBold] [eurosab] +\definefontsynonym [EuroSansItalic] [eurosai] +\definefontsynonym [EuroSansSlanted] [eurosai] +\definefontsynonym [EuroSansBoldItalic] [eurosabi] +\definefontsynonym [EuroSansBoldSlanted] [eurosabi] + +\definefontsynonym [EuroMono] [euromo] +\definefontsynonym [EuroMonoBold] [euromob] +\definefontsynonym [EuroMonoSlanted] [euromoi] +\definefontsynonym [EuroMonoItalic] [euromoi] +\definefontsynonym [EuroMonoBoldItalic] [euromobi] +\definefontsynonym [EuroMonoBoldSlanted] [euromobi] + +\definesymbol [euro] [\getglyph{Euro}{\fontchar{Euro.127}}] + +% \unexpanded\def\euro{\doiftextelse\texteuro\texteuro{\symbol[euro]}} + +%D The next table shows the complete set of symbols: +%D +%D \starttabulate[|l|c|c|c|c|c|c|] +%D \NC \NC \tex{tf} \NC \tex{bf} \NC \tex{sl} +%D \NC \tex{it} \NC \tex{bs} \NC \tex{bi} \NC\NR +%D \NC \rm Serif \NC \rm\tf\euro \NC \rm\bf\euro \NC \rm\sl\euro +%D \NC \rm\it\euro \NC \rm\bs\euro \NC \rm\bi\euro \NC\NR +%D \NC \ss Sans \NC \ss\tf\euro \NC \ss\bf\euro \NC \ss\sl\euro +%D \NC \ss\it\euro \NC \ss\bs\euro \NC \ss\bi\euro \NC\NR +%D \NC \tt Mono \NC \tt\tf\euro \NC \tt\bf\euro \NC \tt\sl\euro +%D \NC \tt\it\euro \NC \tt\bs\euro \NC \tt\bi\euro \NC\NR +%D \stoptabulate + +\endinput diff --git a/tex/context/base/symb-ini.lua b/tex/context/base/symb-ini.lua new file mode 100644 index 000000000..7e1292d1c --- /dev/null +++ b/tex/context/base/symb-ini.lua @@ -0,0 +1,30 @@ +if not modules then modules = { } end modules ['symb-ini'] = { + version = 1.001, + comment = "companion to symb-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local variables = interfaces.variables + +fonts.symbols = fonts.symbols or { } +local symbols = fonts.symbols + +local patterns = { "symb-imp-%s.mkiv", "symb-imp-%s.tex", "symb-%s.mkiv", "symb-%s.tex" } + +function symbols.uselibrary(name) + if name ~= variables.reset then + commands.uselibrary(name,patterns,function(name,foundname) + -- context.startnointerference() + context.startreadingfile() + context.input(foundname) + context.showmessage("symbols",1,name) + context.stopreadingfile() + -- context.stopnointerference() + end) + end +end + +commands.usesymbols = symbols.uselibrary + diff --git a/tex/context/base/symb-ini.mkiv b/tex/context/base/symb-ini.mkiv index bbefe9930..8282649b0 100644 --- a/tex/context/base/symb-ini.mkiv +++ b/tex/context/base/symb-ini.mkiv @@ -17,6 +17,8 @@ \writestatus{loading}{ConTeXt Symbol Libraries / Initialization} +\registerctxluafile{symb-ini}{1.001} + \unprotect %D \macros @@ -255,17 +257,7 @@ %D %D \showsetup{usesymbols} -\def\dousesymbols#1% - {\startreadingfile - \readsysfile{\truefilename{\f!symbolprefix#1}.\mksuffix} - {\showmessage\m!symbols1{#1}} - {\readsysfile{\truefilename{\f!symbolprefix#1}} - {\showmessage\m!symbols1{#1}} - \donothing}% - \stopreadingfile} - -\def\usesymbols[#1]% - {\processcommalist[#1]\dousesymbols} +\def\usesymbols[#1]{\ctxcommand{usesymbols("#1")}} %D As longs as symbols are linked to levels or numbers, we can %D also use the conversion mechanism, but in for instance the diff --git a/tex/context/base/type-ini.mkiv b/tex/context/base/type-ini.mkiv index 7c4dd7819..5c716abbe 100644 --- a/tex/context/base/type-ini.mkiv +++ b/tex/context/base/type-ini.mkiv @@ -20,45 +20,6 @@ %D apart from downward compatibility issues, it would make global, class %D spanning definitions a pain. Some day we will introduce a default class. -% torture test : proper typefaces (and namespace) -% -% \starttext -% \usetypescript[modern][default] default: \setupbodyfont[modern] \eacute \eogonek \zcaron \acircumflexgrave -% \usetypescript[modern][texnansi] texnansi: \setupbodyfont[modern] \eacute \eogonek \zcaron \acircumflexgrave -% \usetypescript[modern][ec] ec: \setupbodyfont[modern] \eacute \eogonek \zcaron \acircumflexgrave -% \usetypescript[modern][qx] qx: \setupbodyfont[modern] \eacute \eogonek \zcaron \acircumflexgrave -% \usetypescript[modern][t5] t5: \setupbodyfont[modern] \eacute \eogonek \zcaron \acircumflexgrave -% \stoptext -% -% torture test : no typeface, just definitions -% -% \starttext -% {\setupbodyfont[reset] \setupbodyfont[cmr] cmr: \eacute \eogonek \zcaron \acircumflexgrave \endgraf} -% {\setupbodyfont[reset] \setupbodyfont[plr] plr: \eacute \eogonek \zcaron \acircumflexgrave \endgraf} -% {\setupbodyfont[reset] \setupbodyfont[csr] csr: \eacute \eogonek \zcaron \acircumflexgrave \endgraf} -% {\setupbodyfont[reset] \setupbodyfont[vnr] vnr: \eacute \eogonek \zcaron \acircumflexgrave \endgraf} -% {\setupbodyfont[reset] \setupbodyfont[aer] aer: \eacute \eogonek \zcaron \acircumflexgrave \endgraf} -% \stoptext - -% \usetypescript [modern] [texnansi] -% -% normal : 1450 ms -% exa quit : 1300 ms (150 ms) -% preload : 825 ms (635 ms) (40-50%) -% -% \usetypescript [modern] [texnansi] -% \usetypescript [palatino][texnansi] -% \usetypescript [times] [texnansi] -% -% normal : 3200 ms -% exa quit : 2700 ms ( 500 ms) -% preload : 1300 ms (1900 ms) (60-70%) - -% \usetypescript [modern][\defaultencoding] -% \usetypescript [map] [latin-modern-os] [\defaultencoding] -% \setupbodyfont[modern] -% test 1234 test - \unprotect \unexpanded\def\starttypescriptcollection @@ -416,9 +377,7 @@ % #1=main #2=rm #3=serif #4=fontname #5=size #6=settings -% we can use \rawgetparameters or \rawgeteparameters - -\def\typefaceencoding{\defaultencoding} +\let\typefaceencoding\s!default % obsolete \def\dostarttypefacedefining#1#2#3% {\geteparameters[\??ts][\s!rscale=\plusone,\s!features=,\s!fallbacks=,\s!goodies=,#3]% diff --git a/tex/context/interface/cont-cs.xml b/tex/context/interface/cont-cs.xml index fbe91763a..f71e12fdc 100644 --- a/tex/context/interface/cont-cs.xml +++ b/tex/context/interface/cont-cs.xml @@ -10267,6 +10267,8 @@ </cd:arguments> </cd:command> + <!-- mkii: + <cd:command name="definefontsynonym" file="font-ini.tex"> <cd:sequence> <cd:string value="definujsynonumumfontu"/> @@ -10295,6 +10297,33 @@ </cd:arguments> </cd:command> + --> + + <cd:command name="definefontsynonym" file="font-ini.tex"> + <cd:sequence> + <cd:string value="definujsynonumumfontu"/> + </cd:sequence> + <cd:arguments> + <cd:keywords n="1"> + <cd:constant type="cd:text"/> + </cd:keywords> + <cd:keywords n="2"> + <cd:constant type="cd:name"/> + </cd:keywords> + <cd:assignments n="3" optional="yes"> + <cd:parameter name="fallbacks"> + <cd:constant type="cd:name"/> + </cd:parameter> + <cd:parameter name="features"> + <cd:constant type="cd:name"/> + </cd:parameter> + <cd:parameter name="goodies"> + <cd:constant type="cd:name"/> + </cd:parameter> + </cd:assignments> + </cd:arguments> + </cd:command> + <cd:command name="setupfontsynonym" file="font-ini.tex"> <cd:sequence> <cd:string value="setupfontsynonym"/> diff --git a/tex/context/interface/cont-de.xml b/tex/context/interface/cont-de.xml index d6d65eddc..17b2480c4 100644 --- a/tex/context/interface/cont-de.xml +++ b/tex/context/interface/cont-de.xml @@ -10267,6 +10267,8 @@ </cd:arguments> </cd:command> + <!-- mkii: + <cd:command name="definefontsynonym" file="font-ini.tex"> <cd:sequence> <cd:string value="defineschriftsynonym"/> @@ -10295,6 +10297,33 @@ </cd:arguments> </cd:command> + --> + + <cd:command name="definefontsynonym" file="font-ini.tex"> + <cd:sequence> + <cd:string value="defineschriftsynonym"/> + </cd:sequence> + <cd:arguments> + <cd:keywords n="1"> + <cd:constant type="cd:text"/> + </cd:keywords> + <cd:keywords n="2"> + <cd:constant type="cd:name"/> + </cd:keywords> + <cd:assignments n="3" optional="yes"> + <cd:parameter name="fallbacks"> + <cd:constant type="cd:name"/> + </cd:parameter> + <cd:parameter name="features"> + <cd:constant type="cd:name"/> + </cd:parameter> + <cd:parameter name="goodies"> + <cd:constant type="cd:name"/> + </cd:parameter> + </cd:assignments> + </cd:arguments> + </cd:command> + <cd:command name="setupfontsynonym" file="font-ini.tex"> <cd:sequence> <cd:string value="setupfontsynonym"/> diff --git a/tex/context/interface/cont-en.xml b/tex/context/interface/cont-en.xml index 0f928f671..b532f2b21 100644 --- a/tex/context/interface/cont-en.xml +++ b/tex/context/interface/cont-en.xml @@ -10267,6 +10267,8 @@ </cd:arguments> </cd:command> + <!-- mkii: + <cd:command name="definefontsynonym" file="font-ini.tex"> <cd:sequence> <cd:string value="definefontsynonym"/> @@ -10295,6 +10297,33 @@ </cd:arguments> </cd:command> + --> + + <cd:command name="definefontsynonym" file="font-ini.tex"> + <cd:sequence> + <cd:string value="definefontsynonym"/> + </cd:sequence> + <cd:arguments> + <cd:keywords n="1"> + <cd:constant type="cd:text"/> + </cd:keywords> + <cd:keywords n="2"> + <cd:constant type="cd:name"/> + </cd:keywords> + <cd:assignments n="3" optional="yes"> + <cd:parameter name="fallbacks"> + <cd:constant type="cd:name"/> + </cd:parameter> + <cd:parameter name="features"> + <cd:constant type="cd:name"/> + </cd:parameter> + <cd:parameter name="goodies"> + <cd:constant type="cd:name"/> + </cd:parameter> + </cd:assignments> + </cd:arguments> + </cd:command> + <cd:command name="setupfontsynonym" file="font-ini.tex"> <cd:sequence> <cd:string value="setupfontsynonym"/> diff --git a/tex/context/interface/cont-fr.xml b/tex/context/interface/cont-fr.xml index 354465e08..da74f6013 100644 --- a/tex/context/interface/cont-fr.xml +++ b/tex/context/interface/cont-fr.xml @@ -10267,6 +10267,8 @@ </cd:arguments> </cd:command> + <!-- mkii: + <cd:command name="definefontsynonym" file="font-ini.tex"> <cd:sequence> <cd:string value="definitsynonymepolice"/> @@ -10295,6 +10297,33 @@ </cd:arguments> </cd:command> + --> + + <cd:command name="definefontsynonym" file="font-ini.tex"> + <cd:sequence> + <cd:string value="definitsynonymepolice"/> + </cd:sequence> + <cd:arguments> + <cd:keywords n="1"> + <cd:constant type="cd:text"/> + </cd:keywords> + <cd:keywords n="2"> + <cd:constant type="cd:name"/> + </cd:keywords> + <cd:assignments n="3" optional="yes"> + <cd:parameter name="fallbacks"> + <cd:constant type="cd:name"/> + </cd:parameter> + <cd:parameter name="features"> + <cd:constant type="cd:name"/> + </cd:parameter> + <cd:parameter name="goodies"> + <cd:constant type="cd:name"/> + </cd:parameter> + </cd:assignments> + </cd:arguments> + </cd:command> + <cd:command name="setupfontsynonym" file="font-ini.tex"> <cd:sequence> <cd:string value="setupfontsynonym"/> diff --git a/tex/context/interface/cont-it.xml b/tex/context/interface/cont-it.xml index c215ed4cd..292915a06 100644 --- a/tex/context/interface/cont-it.xml +++ b/tex/context/interface/cont-it.xml @@ -10267,6 +10267,8 @@ </cd:arguments> </cd:command> + <!-- mkii: + <cd:command name="definefontsynonym" file="font-ini.tex"> <cd:sequence> <cd:string value="definiscisinonimofont"/> @@ -10295,6 +10297,33 @@ </cd:arguments> </cd:command> + --> + + <cd:command name="definefontsynonym" file="font-ini.tex"> + <cd:sequence> + <cd:string value="definiscisinonimofont"/> + </cd:sequence> + <cd:arguments> + <cd:keywords n="1"> + <cd:constant type="cd:text"/> + </cd:keywords> + <cd:keywords n="2"> + <cd:constant type="cd:name"/> + </cd:keywords> + <cd:assignments n="3" optional="yes"> + <cd:parameter name="fallbacks"> + <cd:constant type="cd:name"/> + </cd:parameter> + <cd:parameter name="features"> + <cd:constant type="cd:name"/> + </cd:parameter> + <cd:parameter name="goodies"> + <cd:constant type="cd:name"/> + </cd:parameter> + </cd:assignments> + </cd:arguments> + </cd:command> + <cd:command name="setupfontsynonym" file="font-ini.tex"> <cd:sequence> <cd:string value="setupfontsynonym"/> diff --git a/tex/context/interface/cont-nl.xml b/tex/context/interface/cont-nl.xml index aa99a0a2f..ad038db16 100644 --- a/tex/context/interface/cont-nl.xml +++ b/tex/context/interface/cont-nl.xml @@ -10267,6 +10267,8 @@ </cd:arguments> </cd:command> + <!-- mkii: + <cd:command name="definefontsynonym" file="font-ini.tex"> <cd:sequence> <cd:string value="definieerfontsynoniem"/> @@ -10295,6 +10297,33 @@ </cd:arguments> </cd:command> + --> + + <cd:command name="definefontsynonym" file="font-ini.tex"> + <cd:sequence> + <cd:string value="definieerfontsynoniem"/> + </cd:sequence> + <cd:arguments> + <cd:keywords n="1"> + <cd:constant type="cd:text"/> + </cd:keywords> + <cd:keywords n="2"> + <cd:constant type="cd:name"/> + </cd:keywords> + <cd:assignments n="3" optional="yes"> + <cd:parameter name="fallbacks"> + <cd:constant type="cd:name"/> + </cd:parameter> + <cd:parameter name="features"> + <cd:constant type="cd:name"/> + </cd:parameter> + <cd:parameter name="goodies"> + <cd:constant type="cd:name"/> + </cd:parameter> + </cd:assignments> + </cd:arguments> + </cd:command> + <cd:command name="setupfontsynonym" file="font-ini.tex"> <cd:sequence> <cd:string value="setupfontsynonym"/> diff --git a/tex/context/interface/cont-pe.xml b/tex/context/interface/cont-pe.xml index 08e0284da..929f3c4b5 100644 --- a/tex/context/interface/cont-pe.xml +++ b/tex/context/interface/cont-pe.xml @@ -10267,6 +10267,8 @@ </cd:arguments> </cd:command> + <!-- mkii: + <cd:command name="definefontsynonym" file="font-ini.tex"> <cd:sequence> <cd:string value="تعریفمترادفقلم"/> @@ -10295,6 +10297,33 @@ </cd:arguments> </cd:command> + --> + + <cd:command name="definefontsynonym" file="font-ini.tex"> + <cd:sequence> + <cd:string value="تعریفمترادفقلم"/> + </cd:sequence> + <cd:arguments> + <cd:keywords n="1"> + <cd:constant type="cd:text"/> + </cd:keywords> + <cd:keywords n="2"> + <cd:constant type="cd:name"/> + </cd:keywords> + <cd:assignments n="3" optional="yes"> + <cd:parameter name="fallbacks"> + <cd:constant type="cd:name"/> + </cd:parameter> + <cd:parameter name="features"> + <cd:constant type="cd:name"/> + </cd:parameter> + <cd:parameter name="goodies"> + <cd:constant type="cd:name"/> + </cd:parameter> + </cd:assignments> + </cd:arguments> + </cd:command> + <cd:command name="setupfontsynonym" file="font-ini.tex"> <cd:sequence> <cd:string value="setupfontsynonym"/> diff --git a/tex/context/interface/cont-ro.xml b/tex/context/interface/cont-ro.xml index 27863b40a..14abb248b 100644 --- a/tex/context/interface/cont-ro.xml +++ b/tex/context/interface/cont-ro.xml @@ -10267,6 +10267,8 @@ </cd:arguments> </cd:command> + <!-- mkii: + <cd:command name="definefontsynonym" file="font-ini.tex"> <cd:sequence> <cd:string value="definestesinonimfont"/> @@ -10295,6 +10297,33 @@ </cd:arguments> </cd:command> + --> + + <cd:command name="definefontsynonym" file="font-ini.tex"> + <cd:sequence> + <cd:string value="definestesinonimfont"/> + </cd:sequence> + <cd:arguments> + <cd:keywords n="1"> + <cd:constant type="cd:text"/> + </cd:keywords> + <cd:keywords n="2"> + <cd:constant type="cd:name"/> + </cd:keywords> + <cd:assignments n="3" optional="yes"> + <cd:parameter name="fallbacks"> + <cd:constant type="cd:name"/> + </cd:parameter> + <cd:parameter name="features"> + <cd:constant type="cd:name"/> + </cd:parameter> + <cd:parameter name="goodies"> + <cd:constant type="cd:name"/> + </cd:parameter> + </cd:assignments> + </cd:arguments> + </cd:command> + <cd:command name="setupfontsynonym" file="font-ini.tex"> <cd:sequence> <cd:string value="setupfontsynonym"/> diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 0c1121639..cae16b0c3 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 02/02/11 13:03:55 +-- merge date : 02/04/11 00:30:28 do -- begin closure to overcome local limits and interference |