diff options
-rw-r--r-- | tex/context/base/cont-new.tex | 2 | ||||
-rw-r--r-- | tex/context/base/context.tex | 2 | ||||
-rw-r--r-- | tex/context/base/font-ctx.lua | 58 | ||||
-rw-r--r-- | tex/context/base/font-gds.lua | 27 | ||||
-rw-r--r-- | tex/context/base/font-ini.lua | 2 | ||||
-rw-r--r-- | tex/context/base/sort-ini.lua | 116 | ||||
-rw-r--r-- | tex/context/base/strc-tag.lua | 1 | ||||
-rw-r--r-- | tex/context/base/strc-tag.mkiv | 1 | ||||
-rw-r--r-- | tex/context/base/type-ini.mkiv | 38 | ||||
-rw-r--r-- | tex/context/fonts/antykwapoltawskiego.lfg | 32 | ||||
-rw-r--r-- | tex/context/fonts/lucida-math.lfg | 2 | ||||
-rw-r--r-- | tex/generic/context/luatex-fonts-merged.lua | 4 |
12 files changed, 234 insertions, 51 deletions
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index b88f76336..432269867 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2010.09.27 11:54} +\newcontextversion{2010.09.27 23:32} %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.tex b/tex/context/base/context.tex index cc9a439d2..f1f0a2c95 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2010.09.27 11:54} +\edef\contextversion{2010.09.27 23:32} %D For those who want to use this: diff --git a/tex/context/base/font-ctx.lua b/tex/context/base/font-ctx.lua index 787b1b424..c9a51f0ba 100644 --- a/tex/context/base/font-ctx.lua +++ b/tex/context/base/font-ctx.lua @@ -723,3 +723,61 @@ function fonts.reportusedfeatures() end luatex.registerstopactions(fonts.reportusedfeatures) + +-- experimental mechanism for Mojca: +-- +-- fonts.definetypeface { +-- name = "mainbodyfont-light", +-- preset = "antykwapoltawskiego-light", +-- } +-- +-- fonts.definetypeface { +-- name = "mojcasfavourite", +-- preset = "antykwapoltawskiego", +-- normalweight = "light", +-- boldweight = "bold", +-- width = "condensed", +-- } + +local Shapes = { + serif = "Serif", + sans = "Sans", + mono = "Mono", +} + +function fonts.definetypeface(name,t) + if type(name) == "table" then + -- {name=abc,k=v,...} + t = name + elseif t then + if type(t) == "string" then + -- "abc", "k=v,..." + t = utilities.parsers.settings_to_hash(name) + else + -- "abc", {k=v,...} + end + t.name = t.name or name + else + -- "name=abc,k=v,..." + t = utilities.parsers.settings_to_hash(name) + end + local p = t.preset and fonts.typefaces[t.preset] or { } + local name = t.name or "unknowntypeface" + local shortcut = t.shortcut or p.shortcut or "rm" + local size = t.size or p.size or "default" + local shape = t.shape or p.shape or "serif" + local fontname = t.fontname or p.fontname or "unknown" + local normalweight = t.normalweight or t.weight or p.normalweight or p.weight or "normal" + local boldweight = t.boldweight or t.weight or p.boldweight or p.weight or "normal" + local normalwidth = t.normalwidth or t.width or p.normalwidth or p.width or "normal" + local boldwidth = t.boldwidth or t.width or p.boldwidth or p.width or "normal" + Shape = Shapes[shape] or "Serif" + context.startfontclass { name } + context.definefontsynonym( { format("%s", Shape) }, { format("spec:%s-%s-regular-%s", fontname, normalweight, normalwidth) } ) + context.definefontsynonym( { format("%sBold", Shape) }, { format("spec:%s-%s-regular-%s", fontname, boldweight, boldwidth ) } ) + context.definefontsynonym( { format("%sBoldItalic", Shape) }, { format("spec:%s-%s-italic-%s", fontname, boldweight, boldwidth ) } ) + context.definefontsynonym( { format("%sItalic", Shape) }, { format("spec:%s-%s-italic-%s", fontname, normalweight, normalwidth) } ) + context.stopfontclass() + local settings = table.sequenced({ features= t.features },",") + context.dofastdefinetypeface(name, shortcut, shape, size, settings) +end diff --git a/tex/context/base/font-gds.lua b/tex/context/base/font-gds.lua index f515d2b33..a0491a3cd 100644 --- a/tex/context/base/font-gds.lua +++ b/tex/context/base/font-gds.lua @@ -320,6 +320,33 @@ end fonts.goodies.register("files", initialize) +-- some day we will have a define command and then we can also do some +-- proper tracing +-- +-- fonts.typefaces["antykwapoltawskiego-condensed"] = { +-- shortcut = "rm", +-- shape = "serif", +-- fontname = "antykwapoltawskiego", +-- normalweight = "light", +-- boldweight = "medium", +-- width = "condensed", +-- size = "default", +-- features = "default", +-- } + +local function initialize(goodies) + local typefaces = goodies.typefaces + if typefaces then + local ft = fonts.typefaces + for k, v in next, typefaces do + ft[k] = v + end + end +end + +fonts.goodies.register("typefaces", initialize) + + -- The following file (husayni.lfg) is the experimental setup that we used -- for Idris font. For the moment we don't store this in the cache and quite -- probably these files sit in one of the paths: diff --git a/tex/context/base/font-ini.lua b/tex/context/base/font-ini.lua index e74db9a0e..04d30a31d 100644 --- a/tex/context/base/font-ini.lua +++ b/tex/context/base/font-ini.lua @@ -76,6 +76,8 @@ fonts.manipulators = fonts.manipulators or { fonts.tracers = fonts.tracers or { } +fonts.typefaces = fonts.typefaces or { +} fonts.definers = fonts.definers or { } fonts.definers.specifiers = fonts.definers.specifiers or { } diff --git a/tex/context/base/sort-ini.lua b/tex/context/base/sort-ini.lua index eca0e68c5..d7ef6b0c1 100644 --- a/tex/context/base/sort-ini.lua +++ b/tex/context/base/sort-ini.lua @@ -70,31 +70,35 @@ local replacements, m_mappings, z_mappings, p_mappings, entries, orders, lower, --~ local shchars = characters.specialchars -- no specials for AE and ae +local usemetatable = true + local mte = { __index = function(t,k) - local el - if k then - local l = lower[k] or lcchars[k] - el = rawget(t,l) - end - if not el then - local l = shchars[k] - if l and l ~= k then - if #l > 0 then - l = sub(l,1,1) - end + if usemetatable then + local el + if k then + local l = lower[k] or lcchars[k] el = rawget(t,l) - if not el then - l = lower[k] or lcchars[l] - if l then - el = rawget(t,l) + end + if not el then + local l = shchars[k] + if l and l ~= k then + if #l > 0 then + l = sub(l,1,1) + end + el = rawget(t,l) + if not el then + l = lower[k] or lcchars[l] + if l then + el = rawget(t,l) + end end end + el = el or k end - el = el or k + -- rawset(t,k,el) also make a copy? + return el end - -- rawset(t,k,el) also make a copy? - return el end } @@ -347,7 +351,7 @@ local function numify(s) end local function numify(s) - s = digitsoffset + tonumber(s) + s = digitsoffset + tonumber(s) -- alternatively we can create a consecutive range if s > digitsmaximum then s = digitsmaximum end @@ -373,8 +377,11 @@ local function firstofsplit(entry) else split = split.ch end + usemetatable = false -- ugly hack local entry = split and split[1] or "" - return entry, entries[entry] or "\000" + local tag = entries[entry] or "\000" + usemetatable = true + return entry, tag end sorters.firstofsplit = firstofsplit @@ -394,29 +401,54 @@ function splitters.utf(str) -- we could append m and u but this is cleaner, s is local m_case, z_case, p_case, m_mapping, z_mapping, p_mapping, char, byte, n = { }, { }, { }, { }, { }, { }, { }, { }, 0 for sc in utfcharacters(str) do local b = utfbyte(sc) - local l = lower[sc] - n = n + 1 - l = l and utfbyte(l) or lccodes[b] - z_case[n] = l - if l ~= b then - m_case[n] = l - 1 - p_case[n] = l + 1 + if b >= digitsoffset then + if n == 0 then + -- we need to force number to the top + z_case[1] = 0 + m_case[1] = 0 + p_case[1] = 0 + char[1] = sc + byte[1] = 0 + m_mapping[1] = 0 + z_mapping[1] = 0 + p_mapping[1] = 0 + n = 2 + else + n = n + 1 + end + z_case[n] = b + m_case[n] = b + p_case[n] = b + char[n] = sc + byte[n] = b + m_mapping[#m_mapping+1] = b + z_mapping[#z_mapping+1] = b + p_mapping[#p_mapping+1] = b else - m_case[n] = l - p_case[n] = l - end - char[n], byte[n] = sc, b - local msc = m_mappings[sc] - for i=1,#msc do - m_mapping[#m_mapping+1] = msc[i] - end - local zsc = z_mappings[sc] - for i=1,#zsc do - z_mapping[#z_mapping+1] = zsc[i] - end - local psc = p_mappings[sc] - for i=1,#psc do - p_mapping[#p_mapping+1] = psc[i] + local l = lower[sc] + n = n + 1 + l = l and utfbyte(l) or lccodes[b] + z_case[n] = l + if l ~= b then + m_case[n] = l - 1 + p_case[n] = l + 1 + else + m_case[n] = l + p_case[n] = l + end + char[n], byte[n] = sc, b + local msc = m_mappings[sc] + for i=1,#msc do + m_mapping[#m_mapping+1] = msc[i] + end + local zsc = z_mappings[sc] + for i=1,#zsc do + z_mapping[#z_mapping+1] = zsc[i] + end + local psc = p_mappings[sc] + for i=1,#psc do + p_mapping[#p_mapping+1] = psc[i] + end end end diff --git a/tex/context/base/strc-tag.lua b/tex/context/base/strc-tag.lua index 424f4f897..15773b448 100644 --- a/tex/context/base/strc-tag.lua +++ b/tex/context/base/strc-tag.lua @@ -73,6 +73,7 @@ local properties = allocate { registersee = { pdf = "Span", nature = "mixed" }, registerpages = { pdf = "Span", nature = "mixed" }, registerpage = { pdf = "Span", nature = "inline" }, + registerpagerange = { pdf = "Span", nature = "mixed" }, table = { pdf = "Table", nature = "display" }, tablerow = { pdf = "TR", nature = "display" }, diff --git a/tex/context/base/strc-tag.mkiv b/tex/context/base/strc-tag.mkiv index 5072dcd45..541dec15e 100644 --- a/tex/context/base/strc-tag.mkiv +++ b/tex/context/base/strc-tag.mkiv @@ -54,6 +54,7 @@ \def\t!registersee {registersee} % Span \def\t!registerpages {registerpages} % Span \def\t!registerpage {registerpage} % Span +\def\t!registerpagerange {registerpagerange} % Span \def\t!table {table} % Table \def\t!tablerow {tablerow} % TR diff --git a/tex/context/base/type-ini.mkiv b/tex/context/base/type-ini.mkiv index 0d7e0b137..0fefc9f9f 100644 --- a/tex/context/base/type-ini.mkiv +++ b/tex/context/base/type-ini.mkiv @@ -416,18 +416,46 @@ {\popmacro\relativefontsize \popmacro\fontclass} -\def\dodefinetypeface[#1][#2][#3][#4][#5][#6]% +% \def\dodefinetypeface[#1][#2][#3][#4][#5][#6]% +% {\dododefinetypeface[#1][#2]% +% \iffifthargument % sixth is optional, we need to expand since in #6 there can be a \typescripttwo +% \iftracetypescripts\writestatus\m!fonts{define: [#1] [#2] [#3] [#4]}\fi +% \dostarttypefacedefining{#1}{#2}{#6}% +% \usetypescript[#3][#4][\t!name,\t!default]% +% \usetypescript[#3][#5][\t!size]% +% \dostoptypefacedefining +% \else\iffourthargument +% \definetypeface[#1][#2][#3][#4][\s!default]% +% \else\ifthirdargument +% \getparameters[\??tf#1#2][#3]% +% \fi\fi\fi} + +\def\dofastdefinetypeface#1#2#3#4#5% {\dododefinetypeface[#1][#2]% - \iffifthargument % sixth is optional, we need to expand since in #6 there can be a \typescripttwo + \dostarttypefacedefining{#1}{#2}{#5}% + \usetypescript[#3][#4][\t!size]% + \dostoptypefacedefining} + +\def\dodefinetypeface[#1][#2][#3][#4][#5][#6]% + {\iffifthargument % sixth is optional, we need to expand since in #6 there can be a \typescripttwo \iftracetypescripts\writestatus\m!fonts{define: [#1] [#2] [#3] [#4]}\fi + \dododefinetypeface[#1][#2]% \dostarttypefacedefining{#1}{#2}{#6}% - \usetypescript[#3][#4][\t!name,\t!default]% - \usetypescript[#3][#5][\t!size]% + \usetypescript[#3][#4][\t!name,\t!default]% + \usetypescript[#3][#5][\t!size]% \dostoptypefacedefining \else\iffourthargument - \definetypeface[#1][#2][#3][#4][\s!default]% + \iftracetypescripts\writestatus\m!fonts{define: [#1] [#2] [#3] [#4]}\fi + \dododefinetypeface[#1][#2]% + \dostarttypefacedefining{#1}{#2}{}% + \usetypescript[#3][#4][\t!name,\t!default]% + \usetypescript[#3][\s!default][\t!size]% + \dostoptypefacedefining \else\ifthirdargument + \dododefinetypeface[#1][#2]% \getparameters[\??tf#1#2][#3]% + \else + \ctxlua{fonts.definetypeface(\!!bs#1\!!es,\!!bs#2\!!es)}% \fi\fi\fi} \def\dododefinetypeface[#1][#2]% saveguard against redefinition diff --git a/tex/context/fonts/antykwapoltawskiego.lfg b/tex/context/fonts/antykwapoltawskiego.lfg index 0cd6f53bb..d5c902c6b 100644 --- a/tex/context/fonts/antykwapoltawskiego.lfg +++ b/tex/context/fonts/antykwapoltawskiego.lfg @@ -210,4 +210,36 @@ return { }, }, }, + typefaces = { -- for Mojca (experiment, names might change) + ["antykwapoltawskiego-light"] = { + shortcut = "rm", + shape = "serif", + fontname = "antykwapoltawskiego", + normalweight = "light", + boldweight = "medium", + width = "normal", + size = "default", + features = "default", + }, + ["antykwapoltawskiego"] = { + shortcut = "rm", + shape = "serif", + fontname = "antykwapoltawskiego", + normalweight = "normal", + boldweight = "bold", + width = "normal", + size = "default", + features = "default", + }, + ["antykwapoltawskiego-condensed"] = { + shortcut = "rm", + shape = "serif", + fontname = "antykwapoltawskiego", + normalweight = "light", + boldweight = "medium", + width = "condensed", + size = "default", + features = "default", + }, + }, } diff --git a/tex/context/fonts/lucida-math.lfg b/tex/context/fonts/lucida-math.lfg index 480418946..b4ece4e89 100644 --- a/tex/context/fonts/lucida-math.lfg +++ b/tex/context/fonts/lucida-math.lfg @@ -306,7 +306,7 @@ return { name = "lucida-math", version = "1.00", comment = "Goodies that complement lucida math.", - author = "Aditya, Hans, Mojca", + author = "Aditya, Hans, Mojca with help from Zhichu Chen", copyright = "ConTeXt development team", mathematics = { mapfiles = { diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index d58d5ac90..502b6b1c2 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 : 09/27/10 11:54:49 +-- merge date : 09/27/10 23:32:54 do -- begin closure to overcome local limits and interference @@ -3158,6 +3158,8 @@ fonts.manipulators = fonts.manipulators or { fonts.tracers = fonts.tracers or { } +fonts.typefaces = fonts.typefaces or { +} fonts.definers = fonts.definers or { } fonts.definers.specifiers = fonts.definers.specifiers or { } |