summaryrefslogtreecommitdiff
path: root/tex/context/base
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2015-10-09 20:15:06 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2015-10-09 20:15:06 +0200
commit13fefb5c2324f81e4d1d5b881ba6508bf44186a7 (patch)
tree14a70a5d658b749dfc30e7be9e44ce9d6e54ddfb /tex/context/base
parentab4b27ac289969d64e7d788c62f5e30eba58a903 (diff)
downloadcontext-13fefb5c2324f81e4d1d5b881ba6508bf44186a7.tar.gz
2015-10-09 19:44:00
Diffstat (limited to 'tex/context/base')
-rw-r--r--tex/context/base/cont-new.mkiv7
-rw-r--r--tex/context/base/context-version.pdfbin4195 -> 4192 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/font-ctx.lua68
-rw-r--r--tex/context/base/font-otc.lua4
-rw-r--r--tex/context/base/font-ots.lua41
-rw-r--r--tex/context/base/mult-prm.lua14
-rw-r--r--tex/context/base/node-fnt.lua7
-rw-r--r--tex/context/base/status-files.pdfbin24411 -> 24436 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin256350 -> 256385 bytes
-rw-r--r--tex/context/base/syst-ini.mkiv17
11 files changed, 117 insertions, 43 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 2d1b140d2..a4160e8ba 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{2015.10.09 10:59}
+\newcontextversion{2015.10.09 19:42}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
@@ -21,11 +21,6 @@
\unprotect
-\ifdefined\pdfxform \else \let\pdfxform \saveboxresource \fi
-\ifdefined\pdfrefxform \else \let\pdfrefxform \useboxresource \fi
-\ifdefined\pdfrefximage \else \let\pdfrefximage\useimageresource \fi
-\ifdefined\pdfximage \else \let\pdfximage \saveimageresource \fi
-
% \writestatus\m!system{beware: some patches loaded from cont-new.mkiv}
% \attribute152\zerocount : marks ... lots of sweeps so best early in list
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index 4c3d3fd14..18bff259a 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 70a538f7d..e034fdc19 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -39,7 +39,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2015.10.09 10:59}
+\edef\contextversion{2015.10.09 19:42}
\edef\contextkind {beta}
%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 330508eae..a20174ef3 100644
--- a/tex/context/base/font-ctx.lua
+++ b/tex/context/base/font-ctx.lua
@@ -2207,25 +2207,69 @@ end
-- a fontkern plug:
-local copy_node = nuts.copy
-local kern = nuts.pool.register(nuts.pool.kern())
+do
-setattr(kern,attributes.private('fontkern'),1) -- we can have several, attributes are shared
+ local copy_node = nuts.copy
+ local kern = nuts.pool.register(nuts.pool.kern())
-nodes.injections.installnewkern(function(k)
- local c = copy_node(kern)
- setfield(c,"kern",k)
- return c
-end)
+ setattr(kern,attributes.private('fontkern'),1) -- we can have several, attributes are shared
+
+ nodes.injections.installnewkern(function(k)
+ local c = copy_node(kern)
+ setfield(c,"kern",k)
+ return c
+ end)
+
+ directives.register("nodes.injections.fontkern", function(v) setfield(kern,"subtype",v and 0 or 1) end)
+
+end
+
+do
+
+ local report = logs.reporter("otf","variants")
+
+ local function replace(tfmdata,feature,value)
+ local characters = tfmdata.characters
+ local variants = tfmdata.resources.variants
+ if variants then
+ local t = { }
+ for k, v in sortedhash(variants) do
+ t[#t+1] = formatters["0x%X (%i)"](k,k)
+ end
+ value = tonumber(value) or 0xFE00 -- 917762
+ report("fontname : %s",tfmdata.properties.fontname)
+ report("available: % t",t)
+ local v = variants[value]
+ if v then
+ report("using : %X (%i)",value,value)
+ for k, v in next, v do
+ local c = characters[v]
+ if c then
+ characters[k] = c
+ end
+ end
+ else
+ report("unknown : %X (%i)",value,value)
+ end
+ end
+ end
+
+ registerotffeature {
+ name = 'variant',
+ description = 'unicode variant',
+ manipulators = {
+ base = replace,
+ node = replace,
+ }
+ }
-directives.register("nodes.injections.fontkern", function(v) setfield(kern,"subtype",v and 0 or 1) end)
+end
-- here (todo: closure)
-local trace_analyzing = false trackers.register("otf.analyzing", function(v) trace_analyzing = v end)
+-- make a closure (200 limit):
------ otffeatures = constructors.newfeatures("otf")
-local registerotffeature = otffeatures.register
+local trace_analyzing = false trackers.register("otf.analyzing", function(v) trace_analyzing = v end)
local analyzers = fonts.analyzers
local methods = analyzers.methods
diff --git a/tex/context/base/font-otc.lua b/tex/context/base/font-otc.lua
index 4a71e3df6..fccd38014 100644
--- a/tex/context/base/font-otc.lua
+++ b/tex/context/base/font-otc.lua
@@ -43,6 +43,8 @@ setmetatableindex(types, function(t,k) t[k] = k return k end) -- "key"
local everywhere = { ["*"] = { ["*"] = true } } -- or: { ["*"] = { "*" } }
local noflags = { }
+-- beware: shared, maybe we should copy the sequence
+
local function addfeature(data,feature,specifications)
local descriptions = data.descriptions
local resources = data.resources
@@ -87,7 +89,7 @@ local function addfeature(data,feature,specifications)
local initialize = specification.initialize
if initialize then
-- when false is returned we initialize only once
- specification.initialize = initialize(specification) and initialize or nil
+ specification.initialize = initialize(specification,data) and initialize or nil
end
local askedfeatures = specification.features or everywhere
local askedsteps = specifications.steps or specification.subtables or { specification.data } or { }
diff --git a/tex/context/base/font-ots.lua b/tex/context/base/font-ots.lua
index 5dbb25ab2..64e2ea05f 100644
--- a/tex/context/base/font-ots.lua
+++ b/tex/context/base/font-ots.lua
@@ -731,26 +731,31 @@ local function get_alternative_glyph(start,alternatives,value)
return alternatives[1], trace_alternatives and formatters["value %a, taking %a"](value,1)
elseif value == "last" then
return alternatives[n], trace_alternatives and formatters["value %a, taking %a"](value,n)
- else
- value = value == true and 1 or tonumber(value)
- if type(value) ~= "number" then
- return alternatives[1], trace_alternatives and formatters["invalid value %s, taking %a"](value,1)
- elseif value > n then
- local defaultalt = otf.defaultnodealternate
- if defaultalt == "first" then
- return alternatives[n], trace_alternatives and formatters["invalid value %s, taking %a"](value,1)
- elseif defaultalt == "last" then
- return alternatives[1], trace_alternatives and formatters["invalid value %s, taking %a"](value,n)
- else
- return false, trace_alternatives and formatters["invalid value %a, %s"](value,"out of range")
- end
- elseif value == 0 then
- return getchar(start), trace_alternatives and formatters["invalid value %a, %s"](value,"no change")
- elseif value < 1 then
- return alternatives[1], trace_alternatives and formatters["invalid value %a, taking %a"](value,1)
+ end
+ value = value == true and 1 or tonumber(value)
+ if type(value) ~= "number" then
+ return alternatives[1], trace_alternatives and formatters["invalid value %s, taking %a"](value,1)
+ end
+ -- local a = alternatives[value]
+ -- if a then
+ -- -- some kind of hash
+ -- return a, trace_alternatives and formatters["value %a, taking %a"](value,a)
+ -- end
+ if value > n then
+ local defaultalt = otf.defaultnodealternate
+ if defaultalt == "first" then
+ return alternatives[n], trace_alternatives and formatters["invalid value %s, taking %a"](value,1)
+ elseif defaultalt == "last" then
+ return alternatives[1], trace_alternatives and formatters["invalid value %s, taking %a"](value,n)
else
- return alternatives[value], trace_alternatives and formatters["value %a, taking %a"](value,value)
+ return false, trace_alternatives and formatters["invalid value %a, %s"](value,"out of range")
end
+ elseif value == 0 then
+ return getchar(start), trace_alternatives and formatters["invalid value %a, %s"](value,"no change")
+ elseif value < 1 then
+ return alternatives[1], trace_alternatives and formatters["invalid value %a, taking %a"](value,1)
+ else
+ return alternatives[value], trace_alternatives and formatters["value %a, taking %a"](value,value)
end
end
diff --git a/tex/context/base/mult-prm.lua b/tex/context/base/mult-prm.lua
index 8928779cc..821905590 100644
--- a/tex/context/base/mult-prm.lua
+++ b/tex/context/base/mult-prm.lua
@@ -235,6 +235,9 @@ return {
"ifprimitive",
"ignoreligaturesinfont",
"initcatcodetable",
+ "lastsavedboxresourceindex",
+ "lastsavedimageresourceindex",
+ "lastsavedimageresourcepages",
"lastxpos",
"lastypos",
"latelua",
@@ -277,7 +280,9 @@ return {
"rightghost",
"rightmarginkern",
"rpcode",
+ "saveboxresource",
"savecatcodetable",
+ "saveimageresource",
"savepos",
"scantextokens",
"setrandomseed",
@@ -290,6 +295,8 @@ return {
"tagcode",
"textdir",
"uniformdeviate",
+ "useboxresource",
+ "useimageresource",
},
["omega"]={
"OmegaVersion",
@@ -778,6 +785,9 @@ return {
"lastlinefit",
"lastnodetype",
"lastpenalty",
+ "lastsavedboxresourceindex",
+ "lastsavedimageresourceindex",
+ "lastsavedimageresourcepages",
"lastskip",
"lastxpos",
"lastypos",
@@ -1031,6 +1041,8 @@ return {
"rightskip",
"romannumeral",
"rpcode",
+ "saveboxresource",
+ "saveimageresource",
"savepos",
"savecatcodetable",
"savinghyphcodes",
@@ -1121,6 +1133,8 @@ return {
"unvbox",
"unvcopy",
"uppercase",
+ "useboxresource",
+ "useimageresource",
"vadjust",
"valign",
"vbadness",
diff --git a/tex/context/base/node-fnt.lua b/tex/context/base/node-fnt.lua
index 352529dab..ff02c0930 100644
--- a/tex/context/base/node-fnt.lua
+++ b/tex/context/base/node-fnt.lua
@@ -15,6 +15,7 @@ local nodes, node, fonts = nodes, node, fonts
local trace_characters = false trackers .register("nodes.characters", function(v) trace_characters = v end)
local trace_fontrun = false trackers .register("nodes.fontrun", function(v) trace_fontrun = v end)
+local trace_variants = false trackers .register("nodes.variants", function(v) trace_variants = v end)
local force_discrun = true directives.register("nodes.discrun", function(v) force_discrun = v end)
local force_basepass = true directives.register("nodes.basepass", function(v) force_basepass = v end)
@@ -232,8 +233,12 @@ function handlers.characters(head)
if hash then
local p = getprev(n)
if p and getid(p) == glyph_code then
- local variant = hash[getchar(p)]
+ local char = getchar(p)
+ local variant = hash[char]
if variant then
+ if trace_variants then
+ report_fonts("replacing %C by %C",char,variant)
+ end
setfield(p,"char",variant)
if not redundant then
redundant = { n }
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index afdda01cb..d685bf247 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index 7beb41d66..dba51e562 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/syst-ini.mkiv b/tex/context/base/syst-ini.mkiv
index eef4387cb..b71713b00 100644
--- a/tex/context/base/syst-ini.mkiv
+++ b/tex/context/base/syst-ini.mkiv
@@ -119,11 +119,20 @@
% for the moment:
-\ifdefined\pagewidth \else \let\pagewidth \pdfpagewidth \let\normalpagewidth \pdfpagewidth \fi
-\ifdefined\pageheight \else \let\pageheight \pdfpageheight \let\normalpageheight \pdfpageheight \fi
+\ifdefined\pagewidth \else \let\pagewidth \pdfpagewidth \let\normalpagewidth \pdfpagewidth \fi
+\ifdefined\pageheight \else \let\pageheight \pdfpageheight \let\normalpageheight \pdfpageheight \fi
-\ifdefined\adjustspacing \else \let\adjustspacing\pdfadjustspacing \let\normaladjustspacing\adjustspacing \fi
-\ifdefined\protrudechars \else \let\protrudechars\pdfprotrudechars \let\normalprotrudechars\protrudechars \fi
+\ifdefined\adjustspacing \else \let\adjustspacing \pdfadjustspacing \let\normaladjustspacing \adjustspacing \fi
+\ifdefined\protrudechars \else \let\protrudechars \pdfprotrudechars \let\normalprotrudechars \protrudechars \fi
+
+\ifdefined\pdfxform \else \let\pdfxform \saveboxresource \let\normalpdfxform \pdfxform \fi
+\ifdefined\pdflastxform \else \let\pdflastxform \lastsavedboxresourceindex \let\normalpdflastxform \pdflastxform \fi
+\ifdefined\pdfrefxform \else \let\pdfrefxform \useboxresource \let\normalpdfrefxform \pdfrefxform \fi
+
+\ifdefined\pdfximage \else \let\pdfximage \saveimageresource \let\normalpdfximage \pdfximage \fi
+\ifdefined\pdflastximage \else \let\pdflastximage \lastsavedimageresourceindex \let\normalpdflastximage \pdflastximage \fi
+\ifdefined\pdflastximagepages\else \let\pdflastximagepages \lastsavedimageresourcepages \let\normalpdflastximagepages\pdflastximagepages\fi
+\ifdefined\pdfrefximage \else \let\pdfrefximage \useimageresource \let\normalpdfrefximage \pdfrefximage \fi
%D \ETEX\ has a not so handy way of telling you the version number, i.e. the revision
%D number has a period in it: