diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-06-06 20:26:50 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-06-06 20:26:50 +0200 |
commit | d78828b55508aae49922032ebd9117804a940f73 (patch) | |
tree | 431d8c001f14d8001ba11c6e2803ef83ba65c9fe /tex | |
parent | 7a761c8aebf67ee022aa4857247518ad6997d5c1 (diff) | |
download | context-d78828b55508aae49922032ebd9117804a940f73.tar.gz |
2016-06-06 19:57:00
Diffstat (limited to 'tex')
35 files changed, 250 insertions, 142 deletions
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 2fb1cdae6..f2ca3c69f 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 943b7d050..5afc2c583 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2016.06.05 16:26} +\newcontextversion{2016.06.06 19:52} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 0548d0023..c0e1122e8 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2016.06.05 16:26} +\edef\contextversion{2016.06.06 19:52} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/font-afm.lua b/tex/context/base/mkiv/font-afm.lua index 0d6b7cb99..9b63095a3 100644 --- a/tex/context/base/mkiv/font-afm.lua +++ b/tex/context/base/mkiv/font-afm.lua @@ -50,10 +50,10 @@ local definers = fonts.definers local readers = fonts.readers local constructors = fonts.constructors -local afm = constructors.newhandler("afm") -local pfb = constructors.newhandler("pfb") +local afm = constructors.handlers.afm +local pfb = constructors.handlers.pfb -local afmfeatures = constructors.newfeatures("afm") +local afmfeatures = constructors.features.afm local registerafmfeature = afmfeatures.register afm.version = 1.501 -- incrementing this number one up will force a re-cache diff --git a/tex/context/base/mkiv/font-chk.lua b/tex/context/base/mkiv/font-chk.lua index 15291052f..aaada574e 100644 --- a/tex/context/base/mkiv/font-chk.lua +++ b/tex/context/base/mkiv/font-chk.lua @@ -34,9 +34,10 @@ local addprivate = helpers.addprivate local hasprivate = helpers.hasprivate local getprivatenode = helpers.getprivatenode -local otffeatures = fonts.constructors.newfeatures("otf") +local otffeatures = fonts.constructors.features.otf +local afmfeatures = fonts.constructors.features.afm + local registerotffeature = otffeatures.register -local afmfeatures = fonts.constructors.newfeatures("afm") local registerafmfeature = afmfeatures.register local is_character = characters.is_character diff --git a/tex/context/base/mkiv/font-con.lua b/tex/context/base/mkiv/font-con.lua index 3af286203..1a0daff63 100644 --- a/tex/context/base/mkiv/font-con.lua +++ b/tex/context/base/mkiv/font-con.lua @@ -1255,7 +1255,11 @@ function constructors.getfeatureaction(what,where,mode,name) end end -function constructors.newhandler(what) -- could be a metatable newindex +local newhandler = { } +constructors.handlers = newhandler -- downward compatible +constructors.newhandler = newhandler + +local function setnewhandler(what) -- could be a metatable newindex local handler = handlers[what] if not handler then handler = { } @@ -1264,7 +1268,16 @@ function constructors.newhandler(what) -- could be a metatable newindex return handler end -function constructors.newfeatures(what) -- could be a metatable newindex +setmetatable(newhandler, { + __call = function(t,k) local v = t[k] return v end, + __index = function(t,k) local v = setnewhandler(k) t[k] = v return v end, +}) + +local newfeatures = { } +constructors.newfeatures = newfeatures -- downward compatible +constructors.features = newfeatures + +local function setnewfeatures(what) local handler = handlers[what] local features = handler.features if not features then @@ -1284,6 +1297,11 @@ function constructors.newfeatures(what) -- could be a metatable newindex return features end +setmetatable(newfeatures, { + __call = function(t,k) local v = t[k] return v end, + __index = function(t,k) local v = setnewfeatures(k) t[k] = v return v end, +}) + --[[ldx-- <p>We need to check for default features. For this we provide a helper function.</p> diff --git a/tex/context/base/mkiv/font-ctx.lua b/tex/context/base/mkiv/font-ctx.lua index 82c70164c..8c09ccc25 100644 --- a/tex/context/base/mkiv/font-ctx.lua +++ b/tex/context/base/mkiv/font-ctx.lua @@ -2474,3 +2474,27 @@ implement { actions = { names.exists, commands.doifelse }, arguments = "string" } + +-- we use 0xFE000+ and 0xFF000+ in math and for runtime (text) extensions we +-- use 0xFD000+ + +constructors.privateslots = constructors.privateslots or { } + +storage.register("fonts/constructors/privateslots", constructors.privateslots, "fonts.constructors.privateslots") + +local privateslots = constructors.privateslots +local lastprivateslot = 0xFD000 + +constructors.privateslots = setmetatableindex(privateslots,function(t,k) + local v = lastprivateslot + lastprivateslot = lastprivateslot + 1 + t[k] = v + return v +end) + +implement { + name = "getprivateglyphslot", + actions = function(name) context(privateslots[name]) end, + arguments = "string", +} + diff --git a/tex/context/base/mkiv/font-enh.lua b/tex/context/base/mkiv/font-enh.lua index 02d5b2ddb..99b5c597b 100644 --- a/tex/context/base/mkiv/font-enh.lua +++ b/tex/context/base/mkiv/font-enh.lua @@ -18,13 +18,12 @@ local report_unicoding = logs.reporter("fonts","unicoding") local fonts = fonts local constructors = fonts.constructors ------ tfmfeatures = constructors.newfeatures("tfm") ------ registertfmfeature = tfmfeatures.register +----- tfmfeatures = constructors.features.tfm +local afmfeatures = constructors.features.afm +local otffeatures = constructors.features.otf -local afmfeatures = fonts.constructors.newfeatures("afm") +----- registertfmfeature = tfmfeatures.register local registerafmfeature = afmfeatures.register - -local otffeatures = fonts.constructors.newfeatures("otf") local registerotffeature = otffeatures.register -- -- these will become goodies (when needed at all) diff --git a/tex/context/base/mkiv/font-ini.mkvi b/tex/context/base/mkiv/font-ini.mkvi index 73df62677..ac807c91d 100644 --- a/tex/context/base/mkiv/font-ini.mkvi +++ b/tex/context/base/mkiv/font-ini.mkvi @@ -2569,6 +2569,10 @@ \def\saveddefinedfontid {\number\fontid\font} \def\saveddefinedfontname{\fontname\font} +%D Handy for defining additional glyphs: + +\let\getprivateglyphslot\clf_getprivateglyphslot + % yes or no: % \let\font_basics_check_text_bodyfont_slow\font_basics_check_text_bodyfont diff --git a/tex/context/base/mkiv/font-odv.lua b/tex/context/base/mkiv/font-odv.lua index 6b9a5a9e4..a5d2e5882 100644 --- a/tex/context/base/mkiv/font-odv.lua +++ b/tex/context/base/mkiv/font-odv.lua @@ -105,7 +105,7 @@ local glyph_code = nodecodes.glyph local handlers = otf.handlers local methods = fonts.analyzers.methods -local otffeatures = fonts.constructors.newfeatures("otf") +local otffeatures = fonts.constructors.features.otf local registerotffeature = otffeatures.register local nuts = nodes.nuts diff --git a/tex/context/base/mkiv/font-one.lua b/tex/context/base/mkiv/font-one.lua index a9f78f4fb..a6f47e87b 100644 --- a/tex/context/base/mkiv/font-one.lua +++ b/tex/context/base/mkiv/font-one.lua @@ -45,14 +45,14 @@ local definers = fonts.definers local readers = fonts.readers local constructors = fonts.constructors -local afm = constructors.newhandler("afm") -local pfb = constructors.newhandler("pfb") +local afm = constructors.handlers.afm +local pfb = constructors.handlers.pfb local otf = fonts.handlers.otf local otfreaders = otf.readers local otfenhancers = otf.enhancers -local afmfeatures = constructors.newfeatures("afm") +local afmfeatures = constructors.features.afm local registerafmfeature = afmfeatures.register afm.version = 1.512 -- incrementing this number one up will force a re-cache diff --git a/tex/context/base/mkiv/font-osd.lua b/tex/context/base/mkiv/font-osd.lua index d2bb2100f..a3dda6734 100644 --- a/tex/context/base/mkiv/font-osd.lua +++ b/tex/context/base/mkiv/font-osd.lua @@ -82,7 +82,7 @@ local otf = fonts.handlers.otf local handlers = otf.handlers local methods = fonts.analyzers.methods -local otffeatures = fonts.constructors.newfeatures("otf") +local otffeatures = fonts.constructors.features.otf local registerotffeature = otffeatures.register local nuts = nodes.nuts diff --git a/tex/context/base/mkiv/font-ota.lua b/tex/context/base/mkiv/font-ota.lua index 42566ebfd..4ddb8310a 100644 --- a/tex/context/base/mkiv/font-ota.lua +++ b/tex/context/base/mkiv/font-ota.lua @@ -55,7 +55,7 @@ local fontdata = fonts.hashes.identifiers local categories = characters and characters.categories or { } -- sorry, only in context local chardata = characters and characters.data -local otffeatures = fonts.constructors.newfeatures("otf") +local otffeatures = fonts.constructors.features.otf local registerotffeature = otffeatures.register --[[ldx-- diff --git a/tex/context/base/mkiv/font-otf.lua b/tex/context/base/mkiv/font-otf.lua index 4fec73989..891577849 100644 --- a/tex/context/base/mkiv/font-otf.lua +++ b/tex/context/base/mkiv/font-otf.lua @@ -68,7 +68,7 @@ local constructors = fonts.constructors local fontdata = hashes and hashes.identifiers local chardata = characters and characters.data -- not used -local otffeatures = constructors.newfeatures("otf") +local otffeatures = constructors.features.otf local registerotffeature = otffeatures.register local enhancers = allocate() diff --git a/tex/context/base/mkiv/font-oti.lua b/tex/context/base/mkiv/font-oti.lua index bacd001a5..d74d2d502 100644 --- a/tex/context/base/mkiv/font-oti.lua +++ b/tex/context/base/mkiv/font-oti.lua @@ -11,8 +11,8 @@ local lower = string.lower local fonts = fonts local constructors = fonts.constructors -local otf = constructors.newhandler("otf") -local otffeatures = constructors.newfeatures("otf") +local otf = constructors.handlers.otf +local otffeatures = constructors.features.otf local registerotffeature = otffeatures.register local otftables = otf.tables or { } diff --git a/tex/context/base/mkiv/font-otl.lua b/tex/context/base/mkiv/font-otl.lua index 394689b82..e1975f3c6 100644 --- a/tex/context/base/mkiv/font-otl.lua +++ b/tex/context/base/mkiv/font-otl.lua @@ -63,7 +63,7 @@ local definers = fonts.definers local readers = fonts.readers local constructors = fonts.constructors -local otffeatures = constructors.newfeatures("otf") +local otffeatures = constructors.features.otf local registerotffeature = otffeatures.register local enhancers = allocate() diff --git a/tex/context/base/mkiv/font-otn.lua b/tex/context/base/mkiv/font-otn.lua index 50e0f532e..8203ee971 100644 --- a/tex/context/base/mkiv/font-otn.lua +++ b/tex/context/base/mkiv/font-otn.lua @@ -281,7 +281,7 @@ local cursonce = true local fonthashes = fonts.hashes local fontdata = fonthashes.identifiers -local otffeatures = fonts.constructors.newfeatures("otf") +local otffeatures = fonts.constructors.featuress.otf local registerotffeature = otffeatures.register local onetimemessage = fonts.loggers.onetimemessage or function() end diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua index 544af9003..51704bf0e 100644 --- a/tex/context/base/mkiv/font-ots.lua +++ b/tex/context/base/mkiv/font-ots.lua @@ -239,7 +239,7 @@ local cursonce = true local fonthashes = fonts.hashes local fontdata = fonthashes.identifiers -local otffeatures = fonts.constructors.newfeatures("otf") +local otffeatures = fonts.constructors.features.otf local registerotffeature = otffeatures.register local onetimemessage = fonts.loggers.onetimemessage or function() end diff --git a/tex/context/base/mkiv/font-sel.lua b/tex/context/base/mkiv/font-sel.lua index 4620319f5..0889d2fcd 100644 --- a/tex/context/base/mkiv/font-sel.lua +++ b/tex/context/base/mkiv/font-sel.lua @@ -6,58 +6,58 @@ if not modules then modules = { } end modules ['font-sel'] = { license = "GNU General Public License" } -local context = context -local cleanname = fonts.names.cleanname -local gsub, splitup, find = string.gsub, string.splitup, string.find -local concat, sortedkeys = table.concat, table.sortedkeys -local merge, remove = table.merge, table.remove -local splitbase, removesuffix = file.splitbase, file.removesuffix -local splitat, lpegmatch = lpeg.splitat, lpeg.match - -local formatters = string.formatters -local settings_to_array = utilities.parsers.settings_to_array -local settings_to_hash = utilities.parsers.settings_to_hash - -local v_default = interfaces.variables.default - -local implement = interfaces.implement - -local selectfont = fonts.select or { } -fonts.select = selectfont - -local data = selectfont.data or { } -selectfont.data = data - -local fallbacks = selectfont.fallbacks or { } -selectfont.fallbacks = fallbacks - -local methods = selectfont.methods or { } -selectfont.methods = methods - -local extras = selectfont.extras or { } -selectfont.extras = extras - -local alternatives = selectfont.alternatives or { } -selectfont.alternatives = alternatives - -local presets = selectfont.presets or { } -selectfont.presets = presets - -local defaults = selectfont.defaults or { } -selectfont.defaults = defaults - -local getlookups = fonts.names.getlookups -local registerdesignsizes = fonts.goodies.designsizes.register -local bodyfontsizes = storage.shared.bodyfontsizes - -local ctx_definefontsynonym = context.definefontsynonym -local ctx_resetfontfallback = context.resetfontfallback -local ctx_startfontclass = context.startfontclass -local ctx_stopfontclass = context.stopfontclass -local ctx_loadfontgoodies = context.loadfontgoodies -local ctx_definefontfallback = context.definefontfallback -local ctx_definetypeface = context.definetypeface -local ctx_definebodyfont = context.definebodyfont +local context = context +local cleanname = fonts.names.cleanname +local gsub, splitup, find, lower = string.gsub, string.splitup, string.find, string.lower +local concat, sortedkeys = table.concat, table.sortedkeys +local merge, remove = table.merge, table.remove +local splitbase, removesuffix = file.splitbase, file.removesuffix +local splitat, lpegmatch = lpeg.splitat, lpeg.match + +local formatters = string.formatters +local settings_to_array = utilities.parsers.settings_to_array +local settings_to_hash = utilities.parsers.settings_to_hash + +local v_default = interfaces.variables.default + +local implement = interfaces.implement + +local selectfont = fonts.select or { } +fonts.select = selectfont + +local data = selectfont.data or { } +selectfont.data = data + +local fallbacks = selectfont.fallbacks or { } +selectfont.fallbacks = fallbacks + +local methods = selectfont.methods or { } +selectfont.methods = methods + +local extras = selectfont.extras or { } +selectfont.extras = extras + +local alternatives = selectfont.alternatives or { } +selectfont.alternatives = alternatives + +local presets = selectfont.presets or { } +selectfont.presets = presets + +local defaults = selectfont.defaults or { } +selectfont.defaults = defaults + +local getlookups = fonts.names.getlookups +local registerdesignsizes = fonts.goodies.designsizes.register +local bodyfontsizes = storage.shared.bodyfontsizes + +local ctx_definefontsynonym = context.definefontsynonym +local ctx_resetfontfallback = context.resetfontfallback +local ctx_startfontclass = context.startfontclass +local ctx_stopfontclass = context.stopfontclass +local ctx_loadfontgoodies = context.loadfontgoodies +local ctx_definefontfallback = context.definefontfallback +local ctx_definetypeface = context.definetypeface +local ctx_definebodyfont = context.definebodyfont local trace_register = false trackers.register("selectfont.register", function(v) trace_register = v end) local trace_files = false trackers.register("selectfont.files", function(v) trace_files = v end) @@ -70,7 +70,7 @@ local report_selectfont = logs.reporter("selectfont") local report_files = logs.reporter("selectfont","files") local report_features = logs.reporter("selectfont","features") local report_goodies = logs.reporter("selectfont","goodies") ------ report_alternatives = logs.reporter("selectfont","alternatives") +local report_alternatives = logs.reporter("selectfont","alternatives") local report_typescript = logs.reporter("selectfont","typescripts") defaults["rm"] = { features = { ["sc"] = "*,f:smallcaps" } } @@ -640,18 +640,19 @@ function selectfont.fontsynonym(data,class,style,alternative,index) local fontfiles = data.files[alternative] or data.files["tf"] local fontsizes = sortedkeys(fontfiles) local fallback = index ~= 0 + local fontclass = lower(class) --~ local fontfeature = data.features and data.features[alternative] or data.options.features --~ local fontgoodie = data.goodies and data.goodies [alternative] or data.options.goodies local fontfeature = selectfont.features(data,style,alternative) local fontgoodie = selectfont.goodies (data,style,alternative) local synonym = m_synonym[style] and m_synonym[style][alternative] - local fontfile = formatters ["file-%s-%s-%s"](class,style,alternative) - local fontsynonym = formatters ["synonym-%s-%s-%s"](class,style,alternative) + local fontfile = formatters ["file-%s-%s-%s"](fontclass,style,alternative) + local fontsynonym = formatters ["synonym-%s-%s-%s"](fontclass,style,alternative) if fallback then - fontfile = formatters ["file-%s-%s-%s-%s"](class,style,alternative,index) - fontsynonym = formatters ["synonym-%s-%s-%s-%s"](class,style,alternative,index) + fontfile = formatters ["file-%s-%s-%s-%s"](fontclass,style,alternative,index) + fontsynonym = formatters ["synonym-%s-%s-%s-%s"](fontclass,style,alternative,index) end - local fontfallback = formatters["fallback-%s-%s-%s"](class,style,alternative) + local fontfallback = formatters["fallback-%s-%s-%s"](fontclass,style,alternative) for _, fontsize in next, fontsizes do --~ if trace_typescript then --~ report_typescript("Synonym: '%s', Size: '%s', File: '%s'",fontfile,fontfiles[fontsize][1],fontfiles[fontsize][2]) @@ -678,13 +679,14 @@ function selectfont.fontsynonym(data,class,style,alternative,index) end function selectfont.fontfallback(data,class,style,alternative,index) - local range = data.options.range - local scale = data.options.rscale ~= "" and data.options.rscale or 1 - local check = data.options.check ~= "" and data.options.check or "" - local force = data.options.force ~= "" and data.options.force or "" - local fontfeature = data.features and data.features[alternative] or data.options.features - local fontsynonym = formatters["synonym-%s-%s-%s-%s"](class,style,alternative,index) - local fontfallback = formatters["fallback-%s-%s-%s"] (class,style,alternative) + local range = data.options.range + local scale = data.options.rscale ~= "" and data.options.rscale or 1 + local check = data.options.check ~= "" and data.options.check or "" + local force = data.options.force ~= "" and data.options.force or "" + local fontfeature = data.features and data.features[alternative] or data.options.features + local fontclass = lower(class) + local fontsynonym = formatters ["synonym-%s-%s-%s-%s"](fontclass,style,alternative,index) + local fontfallback = formatters["fallback-%s-%s-%s"] (fontclass,style,alternative) if index == 1 then ctx_resetfontfallback( { fontfallback } ) end @@ -702,7 +704,8 @@ function selectfont.filefallback(data,class,style,alternative,index) local force = data.options.force ~= "" and data.options.force or "yes" local fontfile = data.files[alternative] and data.files[alternative][0] or data.files["tf"][0] local fontfeature = data.features and data.features[alternative] or data.options.features - local fontfallback = formatters["fallback-%s-%s-%s"](class,style,alternative) + local fontclass = lower(class) + local fontfallback = formatters["fallback-%s-%s-%s"](fontclass,style,alternative) if index == 1 then ctx_resetfontfallback( { fontfallback } ) end @@ -713,7 +716,7 @@ function selectfont.filefallback(data,class,style,alternative,index) end function selectfont.mathfallback(index,entry,class,style) - local data = data[entry] + local data = data[entry] ctx_startfontclass( { class } ) for alternative, _ in next, alternatives do if alternative == "tf" or alternative == "bf" then @@ -724,7 +727,7 @@ function selectfont.mathfallback(index,entry,class,style) end function selectfont.textfallback(index,entry,class,style) - local data = data[entry] + local data = data[entry] ctx_startfontclass( { class } ) for alternative, _ in next, alternatives do selectfont.fontsynonym (data,class,style,alternative,index) @@ -780,8 +783,9 @@ function selectfont.typescript(data) end function selectfont.bodyfont(data) - local fontclass = data.metadata.typeface + local class = data.metadata.typeface local fontstyle = data.metadata.style + local fontclass = lower(class) local fontsizes = concat(sortedkeys(bodyfontsizes),",") local fontsynonym = nil local fontlist = { } @@ -793,7 +797,7 @@ function selectfont.bodyfont(data) --~ end end fontlist = concat(fontlist,",") - ctx_definebodyfont( { fontclass }, { fontsizes }, { fontstyle }, { fontlist } ) + ctx_definebodyfont( { class }, { fontsizes }, { fontstyle }, { fontlist } ) end local m_style = { @@ -919,4 +923,4 @@ implement { name = "definefontfamilypreset", actions = selectfont.definefontfamilypreset, arguments = { "string", "string" } -} +}
\ No newline at end of file diff --git a/tex/context/base/mkiv/font-sel.mkvi b/tex/context/base/mkiv/font-sel.mkvi index 4e74f6864..596a7c0dd 100644 --- a/tex/context/base/mkiv/font-sel.mkvi +++ b/tex/context/base/mkiv/font-sel.mkvi @@ -273,6 +273,7 @@ \setupselectfont [ \c!features=\s!default, \s!designsize=\s!default, - \s!rscale=1] + \s!rscale=\selectfontparameter\c!scale, + \c!scale=1] \protect
\ No newline at end of file diff --git a/tex/context/base/mkiv/font-tfm.lua b/tex/context/base/mkiv/font-tfm.lua index f79006481..ab6d795bb 100644 --- a/tex/context/base/mkiv/font-tfm.lua +++ b/tex/context/base/mkiv/font-tfm.lua @@ -23,12 +23,12 @@ local readers = fonts.readers local constructors = fonts.constructors local encodings = fonts.encodings -local tfm = constructors.newhandler("tfm") +local tfm = constructors.handlers.tfm tfm.version = 1.000 tfm.maxnestingdepth = 5 tfm.maxnestingsize = 65536*1024 -local tfmfeatures = constructors.newfeatures("tfm") +local tfmfeatures = constructors.features.tfm ----- registertfmfeature = tfmfeatures.register constructors.resolvevirtualtoo = false -- wil be set in font-ctx.lua diff --git a/tex/context/base/mkiv/font-vf.lua b/tex/context/base/mkiv/font-vf.lua index 7037c6c8b..401e84956 100644 --- a/tex/context/base/mkiv/font-vf.lua +++ b/tex/context/base/mkiv/font-vf.lua @@ -22,7 +22,7 @@ local fastcopy = table.fastcopy local fonts = fonts local constructors = fonts.constructors -local vf = constructors.newhandler("vf") +local vf = constructors.handlers.vf vf.version = 1.000 -- same as tfm --[[ldx-- diff --git a/tex/context/base/mkiv/good-ctx.lua b/tex/context/base/mkiv/good-ctx.lua index 4c8b9fcff..00e4ed78d 100644 --- a/tex/context/base/mkiv/good-ctx.lua +++ b/tex/context/base/mkiv/good-ctx.lua @@ -44,6 +44,8 @@ local colorschemes = fontgoodies.colorschemes or allocate { } fontgoodies.colorschemes = colorschemes colorschemes.data = colorschemes.data or { } +local privatestoo = true + local function setcolorscheme(tfmdata,scheme) if type(scheme) == "string" then local goodies = tfmdata.goodies @@ -65,13 +67,16 @@ local function setcolorscheme(tfmdata,scheme) local w = what[i] for j=1,#w do local name = w[j] + local kind = type(name) if name == "*" then -- inefficient but only used for tracing anyway for _, unicode in next, hash do reverse[unicode] = i end - elseif type(name) == "number" then + elseif kind == "number" then reverse[name] = i + elseif kind ~= "string" then + -- ignore invalid entries elseif find(name,":",1,true) then local start, stop = splitup(name,":") start = tonumber(start) @@ -94,6 +99,26 @@ local function setcolorscheme(tfmdata,scheme) end end end + if privatestoo then + local private = fonts.constructors.privateoffset + local descriptions = tfmdata.descriptions + for unicode, data in next, characters do + if unicode >= private then + if not reverse[unicode] then + local d = descriptions[unicode] + if d then + local u = d.unicode + if u then + local r = reverse[u] -- also catches tables + if r then + reverse[unicode] = r + end + end + end + end + end + end + end tfmdata.properties.colorscheme = reverse return end diff --git a/tex/context/base/mkiv/math-map.lua b/tex/context/base/mkiv/math-map.lua index f3726cf72..4eb76ac8c 100644 --- a/tex/context/base/mkiv/math-map.lua +++ b/tex/context/base/mkiv/math-map.lua @@ -39,7 +39,7 @@ local extract = bit32.extract local allocate = utilities.storage.allocate -local otffeatures = fonts.constructors.newfeatures("otf") +local otffeatures = fonts.constructors.features.otf local registerotffeature = otffeatures.register local setmetatableindex = table.setmetatableindex diff --git a/tex/context/base/mkiv/math-noa.lua b/tex/context/base/mkiv/math-noa.lua index f80959ea6..b2384b31f 100644 --- a/tex/context/base/mkiv/math-noa.lua +++ b/tex/context/base/mkiv/math-noa.lua @@ -36,7 +36,7 @@ local mathematics = mathematics local context = context local otf = fonts.handlers.otf -local otffeatures = fonts.constructors.newfeatures("otf") +local otffeatures = fonts.constructors.features.otf local registerotffeature = otffeatures.register local privateattribute = attributes.private diff --git a/tex/context/base/mkiv/scrp-cjk.lua b/tex/context/base/mkiv/scrp-cjk.lua index 689754df1..b919098f1 100644 --- a/tex/context/base/mkiv/scrp-cjk.lua +++ b/tex/context/base/mkiv/scrp-cjk.lua @@ -531,7 +531,7 @@ end -- nodes.tasks.prependaction("processors","normalizers","scripts.decomposehangul") -local otffeatures = fonts.constructors.newfeatures("otf") +local otffeatures = fonts.constructors.features.otf local registerotffeature = otffeatures.register registerotffeature { diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex e70a4a726..788b9edce 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex e35880659..a7bde7f79 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/fonts/mkiv/hanbatanglvt.lfg b/tex/context/fonts/mkiv/hanbatanglvt.lfg index 333743348..a7ec0224a 100644 --- a/tex/context/fonts/mkiv/hanbatanglvt.lfg +++ b/tex/context/fonts/mkiv/hanbatanglvt.lfg @@ -1,19 +1,30 @@ --- Maybe some day I will do this more efficient but for the moment it's okay. (We need --- access to the names table then.) - -local f_uni_base = string.formatters["uni%04X"] -local f_uni_plus = string.formatters["uni%04X.y%s"] - -local function range(first,last) - local t = { } - for i=first,last do - t[#t+1] = f_uni_base(i) - for j=0,19 do - t[#t+1] = f_uni_plus(i,j) - end - end - return t -end +-- local f_uni_base = string.formatters["uni%04X"] +-- local f_uni_plus = string.formatters["uni%04X.y%s"] +-- +-- local function range(first,last) +-- local t = { } +-- for i=first,last do +-- t[#t+1] = f_uni_base(i) +-- for j=0,19 do +-- t[#t+1] = f_uni_plus(i,j) +-- end +-- end +-- return t +-- end +-- +-- return { +-- name = "hanbatanglvt", +-- version = "1.00", +-- comment = "Goodies that complement the hanbatanglvt fonts.", +-- author = "Hans Hagen", +-- colorschemes = { +-- default = { +-- range(0x01100,0x0115F), -- jamo_initial (r/c) +-- range(0x01160,0x011A7), -- jamo_medial (g/m) +-- range(0x011A8,0x011FF), -- jamo_final (b/y) +-- } +-- } +-- } return { name = "hanbatanglvt", @@ -22,9 +33,10 @@ return { author = "Hans Hagen", colorschemes = { default = { - range(0x01100,0x0115F), -- jamo_initial (r/c) - range(0x01160,0x011A7), -- jamo_medial (g/m) - range(0x011A8,0x011FF), -- jamo_final (b/y) + { "0x01100:0x0115F" }, -- jamo_initial (r/c) + { "0x01160:0x011A7" }, -- jamo_medial (g/m) + { "0x011A8:0x011FF" }, -- jamo_final (b/y) } } } + diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 8fd39d51a..db1feaa07 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-fonts.xml b/tex/context/interface/mkiv/i-fonts.xml index 1c62ba1ff..f288c5df5 100644 --- a/tex/context/interface/mkiv/i-fonts.xml +++ b/tex/context/interface/mkiv/i-fonts.xml @@ -1311,6 +1311,12 @@ </cd:arguments> </cd:command> + <cd:command name="getprivateslot" file="font-ini.mkvi"> + <cd:arguments> + <cd:resolve name="argument-name"/> + </cd:arguments> + </cd:command> + <cd:command name="glyphfontfile" file="font-sym.mkvi"> <cd:arguments> <cd:resolve name="argument-font"/> diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex 2abc86db5..8e131f971 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/context/modules/mkiv/x-asciimath.lua b/tex/context/modules/mkiv/x-asciimath.lua index e0a4a714b..927e1cd97 100644 --- a/tex/context/modules/mkiv/x-asciimath.lua +++ b/tex/context/modules/mkiv/x-asciimath.lua @@ -295,8 +295,8 @@ local reserved = { ["sigma"] = { true, "σ" }, ["tau"] = { true, "τ" }, ["upsilon"] = { true, "υ" }, - ["phi"] = { true, "φ" }, - ["varphi"] = { true, "ϕ" }, + ["phi"] = { true, "ϕ" }, + ["varphi"] = { true, "φ" }, ["chi"] = { true, "χ" }, ["psi"] = { true, "ψ" }, ["omega"] = { true, "ω" }, diff --git a/tex/generic/context/luatex/luatex-fonts-ext.lua b/tex/generic/context/luatex/luatex-fonts-ext.lua index b60d04512..9d8d3070b 100644 --- a/tex/generic/context/luatex/luatex-fonts-ext.lua +++ b/tex/generic/context/luatex/luatex-fonts-ext.lua @@ -12,7 +12,7 @@ if context then end local fonts = fonts -local otffeatures = fonts.constructors.newfeatures("otf") +local otffeatures = fonts.constructors.features.otf -- A few generic extensions. diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index ea4f6e8d6..e73e0c4ef 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 06/05/16 16:26:23 +-- merge date : 06/06/16 19:52:42 do -- begin closure to overcome local limits and interference @@ -6655,7 +6655,10 @@ function constructors.getfeatureaction(what,where,mode,name) end end end -function constructors.newhandler(what) +local newhandler={} +constructors.handlers=newhandler +constructors.newhandler=newhandler +local function setnewhandler(what) local handler=handlers[what] if not handler then handler={} @@ -6663,7 +6666,14 @@ function constructors.newhandler(what) end return handler end -function constructors.newfeatures(what) +setmetatable(newhandler,{ + __call=function(t,k) local v=t[k] return v end, + __index=function(t,k) local v=setnewhandler(k) t[k]=v return v end, +}) +local newfeatures={} +constructors.newfeatures=newfeatures +constructors.features=newfeatures +local function setnewfeatures(what) local handler=handlers[what] local features=handler.features if not features then @@ -6682,6 +6692,10 @@ function constructors.newfeatures(what) end return features end +setmetatable(newfeatures,{ + __call=function(t,k) local v=t[k] return v end, + __index=function(t,k) local v=setnewfeatures(k) t[k]=v return v end, +}) function constructors.checkedfeatures(what,features) local defaults=handlers[what].features.defaults if features and next(features) then @@ -7446,11 +7460,11 @@ local handlers=fonts.handlers local readers=fonts.readers local constructors=fonts.constructors local encodings=fonts.encodings -local tfm=constructors.newhandler("tfm") +local tfm=constructors.handlers.tfm tfm.version=1.000 tfm.maxnestingdepth=5 tfm.maxnestingsize=65536*1024 -local tfmfeatures=constructors.newfeatures("tfm") +local tfmfeatures=constructors.features.tfm constructors.resolvevirtualtoo=false fonts.formats.tfm="type1" fonts.formats.ofm="type1" @@ -7595,8 +7609,8 @@ if not modules then modules={} end modules ['font-oti']={ local lower=string.lower local fonts=fonts local constructors=fonts.constructors -local otf=constructors.newhandler("otf") -local otffeatures=constructors.newfeatures("otf") +local otf=constructors.handlers.otf +local otffeatures=constructors.features.otf local registerotffeature=otffeatures.register local otftables=otf.tables or {} otf.tables=otftables @@ -15149,7 +15163,7 @@ local hashes=fonts.hashes local definers=fonts.definers local readers=fonts.readers local constructors=fonts.constructors -local otffeatures=constructors.newfeatures("otf") +local otffeatures=constructors.features.otf local registerotffeature=otffeatures.register local enhancers=allocate() otf.enhancers=enhancers @@ -17503,7 +17517,7 @@ local math_code=nodecodes.math local fontdata=fonts.hashes.identifiers local categories=characters and characters.categories or {} local chardata=characters and characters.data -local otffeatures=fonts.constructors.newfeatures("otf") +local otffeatures=fonts.constructors.features.otf local registerotffeature=otffeatures.register local s_init=1 local s_rphf=7 local s_medi=2 local s_half=8 @@ -17955,7 +17969,7 @@ local getligaindex=injections.getligaindex local cursonce=true local fonthashes=fonts.hashes local fontdata=fonthashes.identifiers -local otffeatures=fonts.constructors.newfeatures("otf") +local otffeatures=fonts.constructors.features.otf local registerotffeature=otffeatures.register local onetimemessage=fonts.loggers.onetimemessage or function() end otf.defaultnodealternate="none" @@ -20924,7 +20938,7 @@ fonts.analyzers.methods=fonts.analyzers.methods or { node={ otf={} } } local otf=fonts.handlers.otf local handlers=otf.handlers local methods=fonts.analyzers.methods -local otffeatures=fonts.constructors.newfeatures("otf") +local otffeatures=fonts.constructors.features.otf local registerotffeature=otffeatures.register local nuts=nodes.nuts local tonode=nuts.tonode @@ -23175,12 +23189,12 @@ local findbinfile=resolvers.findbinfile local definers=fonts.definers local readers=fonts.readers local constructors=fonts.constructors -local afm=constructors.newhandler("afm") -local pfb=constructors.newhandler("pfb") +local afm=constructors.handlers.afm +local pfb=constructors.handlers.pfb local otf=fonts.handlers.otf local otfreaders=otf.readers local otfenhancers=otf.enhancers -local afmfeatures=constructors.newfeatures("afm") +local afmfeatures=constructors.features.afm local registerafmfeature=afmfeatures.register afm.version=1.512 afm.cache=containers.define("fonts","afm",afm.version,true) @@ -24507,7 +24521,7 @@ if context then os.exit() end local fonts=fonts -local otffeatures=fonts.constructors.newfeatures("otf") +local otffeatures=fonts.constructors.features.otf local function initializeitlc(tfmdata,value) if value then local parameters=tfmdata.parameters |