diff options
author | Hans Hagen <pragma@wxs.nl> | 2013-08-30 02:05:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2013-08-30 02:05:00 +0200 |
commit | 4c3617158cb8e379bbdda56ada44458e137844dd (patch) | |
tree | 0913f7f43a7f5ead1b1087853cf4cfad31f6f0d3 | |
parent | 7eeeda12a7c44971ccaafff4c0de4ae5eebc7880 (diff) | |
download | context-4c3617158cb8e379bbdda56ada44458e137844dd.tar.gz |
beta 2013.08.30 02:05
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4106 -> 4100 bytes | |||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/font-syn.lua | 159 | ||||
-rw-r--r-- | tex/context/base/math-act.lua | 112 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24767 -> 24728 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.log | 2 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 2 |
8 files changed, 186 insertions, 93 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index bf4d51289..6ee88f2f5 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2013.08.29 21:48} +\newcontextversion{2013.08.30 02:05} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 903c6d6ca..bac9fd8d7 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 88523fa54..f790d3ce0 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2013.08.29 21:48} +\edef\contextversion{2013.08.30 02:05} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/font-syn.lua b/tex/context/base/font-syn.lua index 7e62771a3..9102a57f2 100644 --- a/tex/context/base/font-syn.lua +++ b/tex/context/base/font-syn.lua @@ -15,7 +15,7 @@ local concat, sort, format = table.concat, table.sort, string.format local serialize = table.serialize local lpegmatch = lpeg.match local unpack = unpack or table.unpack -local formatters = string.formatters +local formatters, topattern = string.formatters, string.topattern local allocate = utilities.storage.allocate local sparse = utilities.storage.sparse @@ -34,6 +34,8 @@ local findfile = resolvers.findfile local cleanpath = resolvers.cleanpath local resolveresolved = resolvers.resolve +local settings_to_hash = utilities.parsers.settings_to_hash_tolerant + local trace_names = false trackers.register("fonts.names", function(v) trace_names = v end) local trace_warnings = false trackers.register("fonts.warnings", function(v) trace_warnings = v end) local trace_specifications = false trackers.register("fonts.specifications", function(v) trace_specifications = v end) @@ -1571,46 +1573,131 @@ end local lastlookups, lastpattern = { }, "" -function names.lookup(pattern,name,reload) -- todo: find - if lastpattern ~= pattern then - names.load(reload) - local specifications = names.data.specifications - local families = names.data.families - local lookups = specifications - if name then - lookups = families[name] - elseif not find(pattern,"=") then - lookups = families[pattern] +-- function names.lookup(pattern,name,reload) -- todo: find +-- if lastpattern ~= pattern then +-- names.load(reload) +-- local specifications = names.data.specifications +-- local families = names.data.families +-- local lookups = specifications +-- if name then +-- lookups = families[name] +-- elseif not find(pattern,"=") then +-- lookups = families[pattern] +-- end +-- if trace_names then +-- report_names("starting with %s lookups for %a",#lookups,pattern) +-- end +-- if lookups then +-- for key, value in gmatch(pattern,"([^=,]+)=([^=,]+)") do +-- local t, n = { }, 0 +-- if find(value,"*") then +-- value = topattern(value) +-- for i=1,#lookups do +-- local s = lookups[i] +-- if find(s[key],value) then +-- n = n + 1 +-- t[n] = lookups[i] +-- end +-- end +-- else +-- for i=1,#lookups do +-- local s = lookups[i] +-- if s[key] == value then +-- n = n + 1 +-- t[n] = lookups[i] +-- end +-- end +-- end +-- if trace_names then +-- report_names("%s matches for key %a with value %a",#t,key,value) +-- end +-- lookups = t +-- end +-- end +-- lastpattern = pattern +-- lastlookups = lookups or { } +-- end +-- return #lastlookups +-- end + +local function look_them_up(lookups,specification) + for key, value in next, specification do + local t, n = { }, 0 + if find(value,"*") then + value = topattern(value) + for i=1,#lookups do + local s = lookups[i] + if find(s[key],value) then + n = n + 1 + t[n] = lookups[i] + end + end + else + for i=1,#lookups do + local s = lookups[i] + if s[key] == value then + n = n + 1 + t[n] = lookups[i] + end + end end if trace_names then - report_names("starting with %s lookups for %a",#lookups,pattern) + report_names("%s matches for key %a with value %a",#t,key,value) end + lookups = t + end + return lookups +end + +local function first_look(name,reload) + names.load(reload) + local data = names.data + local specifications = data.specifications + local families = data.families + if name then + return families[name] + else + return specifications + end +end + +function names.lookup(pattern,name,reload) -- todo: find + names.load(reload) + local data = names.data + local specifications = data.specifications + local families = data.families + local lookups = specifications + if name then + name = cleanname(name) + end + if type(pattern) == "table" then + local familyname = pattern.familyname + if familyname then + familyname = cleanname(familyname) + pattern.familyname = familyname + end + local lookups = first_look(name or familyname,reload) if lookups then - for key, value in gmatch(pattern,"([^=,]+)=([^=,]+)") do - local t, n = { }, 0 - if find(value,"*") then - value = string.topattern(value) - for i=1,#lookups do - local s = lookups[i] - if find(s[key],value) then - n = n + 1 - t[n] = lookups[i] - end - end - else - for i=1,#lookups do - local s = lookups[i] - if s[key] == value then - n = n + 1 - t[n] = lookups[i] - end - end - end - if trace_names then - report_names("%s matches for key %a with value %a",#t,key,value) - end - lookups = t + if trace_names then + report_names("starting with %s lookups for '%T'",#lookups,pattern) + end + lookups = look_them_up(lookups,pattern) + end + lastpattern = false + lastlookups = lookups or { } + elseif lastpattern ~= pattern then + local lookups = first_look(name or (not find(pattern,"=") and pattern),reload) + if lookups then + if trace_names then + report_names("starting with %s lookups for %a",#lookups,pattern) + end + local specification = settings_to_hash(pattern) + local familyname = specification.familyname + if familyname then + familyname = cleanname(familyname) + specification.familyname = familyname end + lookups = look_them_up(lookups,specification) end lastpattern = pattern lastlookups = lookups or { } diff --git a/tex/context/base/math-act.lua b/tex/context/base/math-act.lua index d7b39b4c5..4a26d0192 100644 --- a/tex/context/base/math-act.lua +++ b/tex/context/base/math-act.lua @@ -605,62 +605,68 @@ blocks["digitsextendedarabicindic"] = { first = 0x006F0, last = 0x006F -- todo: tounicode function mathematics.injectfallbacks(target,original) - local specification = target.specification - if specification then - local fallbacks = specification.fallbacks - if fallbacks then - local definitions = fonts.collections.definitions[fallbacks] - if definitions then - local definedfont = fonts.definers.internal - local copiedglyph = fonts.handlers.vf.math.copy_glyph - local fonts = target.fonts - local size = specification.size -- target.size - local characters = target.characters - if not fonts then - fonts = { } - target.fonts = fonts - target.type = "virtual" - target.properties.virtualized = true - end - if #fonts == 0 then - fonts[1] = { id = 0, size = size } -- sel, will be resolved later - end - local done = { } - for i=1,#definitions do - local definition = definitions[i] - local name = definition.font - local start = definition.start - local stop = definition.stop - local check = definition.check - local force = definition.force - local rscale = definition.rscale or 1 - local offset = definition.offset or start - local id = definedfont { name = name, size = size * rscale } - local index = #fonts + 1 - fonts[index] = { id = id, size = size } - local chars = fontchars[id] - if check then - for unicode = start, stop do - local unic = unicode + offset - start - if not chars[unicode] then - -- not in font - elseif force or (not done[unic] and not characters[unic]) then - if trace_collecting then - report_math("remapping math character, vector %a, font %a, character %C, %s",fallbacks,name,unic,"checked") + local properties = original.properties + if properties and properties.hasmath then + local specification = target.specification + if specification then + local fallbacks = specification.fallbacks + if fallbacks then + local definitions = fonts.collections.definitions[fallbacks] + if definitions then + if trace_collecting then + report_math("adding fallback characters to font %a",specification.hash) + end + local definedfont = fonts.definers.internal + local copiedglyph = fonts.handlers.vf.math.copy_glyph + local fonts = target.fonts + local size = specification.size -- target.size + local characters = target.characters + if not fonts then + fonts = { } + target.fonts = fonts + target.type = "virtual" + target.properties.virtualized = true + end + if #fonts == 0 then + fonts[1] = { id = 0, size = size } -- sel, will be resolved later + end + local done = { } + for i=1,#definitions do + local definition = definitions[i] + local name = definition.font + local start = definition.start + local stop = definition.stop + local check = definition.check + local force = definition.force + local rscale = definition.rscale or 1 + local offset = definition.offset or start + local id = definedfont { name = name, size = size * rscale } + local index = #fonts + 1 + fonts[index] = { id = id, size = size } + local chars = fontchars[id] + if check then + for unicode = start, stop do + local unic = unicode + offset - start + if not chars[unicode] then + -- not in font + elseif force or (not done[unic] and not characters[unic]) then + if trace_collecting then + report_math("remapping math character, vector %a, font %a, character %C, %s",fallbacks,name,unic,"checked") + end + characters[unic] = copiedglyph(target,characters,chars,unicode,index) + done[unic] = true end - characters[unic] = copiedglyph(target,characters,chars,unicode,index) - done[unic] = true end - end - else - for unicode = start, stop do - local unic = unicode + offset - start - if force or (not done[unic] and not characters[unic]) then - if trace_collecting then - report_math("remapping math character, vector %a, font %a, character %C, %s",fallbacks,name,unic,"unchecked") + else + for unicode = start, stop do + local unic = unicode + offset - start + if force or (not done[unic] and not characters[unic]) then + if trace_collecting then + report_math("remapping math character, vector %a, font %a, character %C, %s",fallbacks,name,unic,"unchecked") + end + characters[unic] = copiedglyph(target,characters,chars,unicode,index) + done[unic] = true end - characters[unic] = copiedglyph(target,characters,chars,unicode,index) - done[unic] = true end end end diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 0c9d228dd..3d3141a9d 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.log b/tex/context/base/status-lua.log index 1d830b041..ad4439c3e 100644 --- a/tex/context/base/status-lua.log +++ b/tex/context/base/status-lua.log @@ -1,6 +1,6 @@ (cont-yes.mkiv -ConTeXt ver: 2013.08.29 21:48 MKIV beta fmt: 2013.8.29 int: english/english +ConTeXt ver: 2013.08.30 02:05 MKIV beta fmt: 2013.8.30 int: english/english system > 'cont-new.mkiv' loaded (cont-new.mkiv) diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 09dcdce26..d07790368 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 : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 08/29/13 21:48:07 +-- merge date : 08/30/13 02:05:28 do -- begin closure to overcome local limits and interference |