summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tex/context/base/context-version.pdfbin4248 -> 4249 bytes
-rw-r--r--tex/context/base/mkii/mult-de.mkii1
-rw-r--r--tex/context/base/mkii/mult-en.mkii1
-rw-r--r--tex/context/base/mkii/mult-fr.mkii1
-rw-r--r--tex/context/base/mkii/mult-it.mkii1
-rw-r--r--tex/context/base/mkii/mult-nl.mkii1
-rw-r--r--tex/context/base/mkii/mult-pe.mkii1
-rw-r--r--tex/context/base/mkii/mult-ro.mkii1
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/font-ctx.lua25
-rw-r--r--tex/context/base/mkiv/font-dsp.lua144
-rw-r--r--tex/context/base/mkiv/font-lib.mkvi1
-rw-r--r--tex/context/base/mkiv/font-map.lua4
-rw-r--r--tex/context/base/mkiv/font-ocl.lua235
-rw-r--r--tex/context/base/mkiv/font-otl.lua22
-rw-r--r--tex/context/base/mkiv/font-otr.lua37
-rw-r--r--tex/context/base/mkiv/font-oup.lua56
-rw-r--r--tex/context/base/mkiv/grph-inc.lua4
-rw-r--r--tex/context/base/mkiv/grph-inc.mkiv1
-rw-r--r--tex/context/base/mkiv/grph-mem.lua68
-rw-r--r--tex/context/base/mkiv/meta-imp-mat.mkiv174
-rw-r--r--tex/context/base/mkiv/mult-def.lua3
-rw-r--r--tex/context/base/mkiv/spac-ver.lua73
-rw-r--r--tex/context/base/mkiv/spac-ver.mkiv5
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin9080 -> 9209 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin268725 -> 268935 bytes
-rw-r--r--tex/context/interface/mkii/keys-cs.xml1
-rw-r--r--tex/context/interface/mkii/keys-de.xml1
-rw-r--r--tex/context/interface/mkii/keys-en.xml1
-rw-r--r--tex/context/interface/mkii/keys-fr.xml1
-rw-r--r--tex/context/interface/mkii/keys-it.xml1
-rw-r--r--tex/context/interface/mkii/keys-nl.xml1
-rw-r--r--tex/context/interface/mkii/keys-pe.xml1
-rw-r--r--tex/context/interface/mkii/keys-ro.xml1
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin793090 -> 793091 bytes
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin60786 -> 60787 bytes
-rw-r--r--tex/context/interface/mkiv/i-vspace.xml1
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua218
39 files changed, 1031 insertions, 59 deletions
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index f2ca3c69f..851356b15 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/mkii/mult-de.mkii b/tex/context/base/mkii/mult-de.mkii
index dbadca7c5..62df21b85 100644
--- a/tex/context/base/mkii/mult-de.mkii
+++ b/tex/context/base/mkii/mult-de.mkii
@@ -172,6 +172,7 @@
\setinterfacevariable{eight}{acht}
\setinterfacevariable{embed}{embed}
\setinterfacevariable{empty}{leer}
+\setinterfacevariable{enable}{enable}
\setinterfacevariable{end}{end}
\setinterfacevariable{endnote}{endnote}
\setinterfacevariable{enumeration}{nummerierung}
diff --git a/tex/context/base/mkii/mult-en.mkii b/tex/context/base/mkii/mult-en.mkii
index 751235942..d0bad9459 100644
--- a/tex/context/base/mkii/mult-en.mkii
+++ b/tex/context/base/mkii/mult-en.mkii
@@ -172,6 +172,7 @@
\setinterfacevariable{eight}{eight}
\setinterfacevariable{embed}{embed}
\setinterfacevariable{empty}{empty}
+\setinterfacevariable{enable}{enable}
\setinterfacevariable{end}{end}
\setinterfacevariable{endnote}{endnote}
\setinterfacevariable{enumeration}{enumeration}
diff --git a/tex/context/base/mkii/mult-fr.mkii b/tex/context/base/mkii/mult-fr.mkii
index aff330d76..8f938bed7 100644
--- a/tex/context/base/mkii/mult-fr.mkii
+++ b/tex/context/base/mkii/mult-fr.mkii
@@ -172,6 +172,7 @@
\setinterfacevariable{eight}{eight}
\setinterfacevariable{embed}{embed}
\setinterfacevariable{empty}{vide}
+\setinterfacevariable{enable}{enable}
\setinterfacevariable{end}{end}
\setinterfacevariable{endnote}{notefin}
\setinterfacevariable{enumeration}{enumeration}
diff --git a/tex/context/base/mkii/mult-it.mkii b/tex/context/base/mkii/mult-it.mkii
index 2c7dd13e9..42388d718 100644
--- a/tex/context/base/mkii/mult-it.mkii
+++ b/tex/context/base/mkii/mult-it.mkii
@@ -172,6 +172,7 @@
\setinterfacevariable{eight}{eight}
\setinterfacevariable{embed}{embed}
\setinterfacevariable{empty}{vuoto}
+\setinterfacevariable{enable}{enable}
\setinterfacevariable{end}{end}
\setinterfacevariable{endnote}{endnote}
\setinterfacevariable{enumeration}{enumerazione}
diff --git a/tex/context/base/mkii/mult-nl.mkii b/tex/context/base/mkii/mult-nl.mkii
index 163628a2f..01870066e 100644
--- a/tex/context/base/mkii/mult-nl.mkii
+++ b/tex/context/base/mkii/mult-nl.mkii
@@ -172,6 +172,7 @@
\setinterfacevariable{eight}{acht}
\setinterfacevariable{embed}{sluitin}
\setinterfacevariable{empty}{leeg}
+\setinterfacevariable{enable}{enable}
\setinterfacevariable{end}{eind}
\setinterfacevariable{endnote}{eindnoot}
\setinterfacevariable{enumeration}{doornummering}
diff --git a/tex/context/base/mkii/mult-pe.mkii b/tex/context/base/mkii/mult-pe.mkii
index c2db11315..b3df69def 100644
--- a/tex/context/base/mkii/mult-pe.mkii
+++ b/tex/context/base/mkii/mult-pe.mkii
@@ -172,6 +172,7 @@
\setinterfacevariable{eight}{eight}
\setinterfacevariable{embed}{embed}
\setinterfacevariable{empty}{تهی}
+\setinterfacevariable{enable}{enable}
\setinterfacevariable{end}{end}
\setinterfacevariable{endnote}{ته‌نوشت}
\setinterfacevariable{enumeration}{شماره‌بندی}
diff --git a/tex/context/base/mkii/mult-ro.mkii b/tex/context/base/mkii/mult-ro.mkii
index 9698bffa5..c232d6b13 100644
--- a/tex/context/base/mkii/mult-ro.mkii
+++ b/tex/context/base/mkii/mult-ro.mkii
@@ -172,6 +172,7 @@
\setinterfacevariable{eight}{eight}
\setinterfacevariable{embed}{embed}
\setinterfacevariable{empty}{gol}
+\setinterfacevariable{enable}{enable}
\setinterfacevariable{end}{end}
\setinterfacevariable{endnote}{endnote}
\setinterfacevariable{enumeration}{enumerare}
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 5afc2c583..967669687 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.06 19:52}
+\newcontextversion{2016.06.08 10:50}
%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 c0e1122e8..a463b5cfe 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.06 19:52}
+\edef\contextversion{2016.06.08 10:50}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/font-ctx.lua b/tex/context/base/mkiv/font-ctx.lua
index 8c09ccc25..32270bf96 100644
--- a/tex/context/base/mkiv/font-ctx.lua
+++ b/tex/context/base/mkiv/font-ctx.lua
@@ -151,7 +151,7 @@ local function getfontname(tfmdata)
return basename(type(tfmdata) == "number" and properties[tfmdata].name or tfmdata.properties.name)
end
-fonts.helpers.name = getfontname
+helpers.name = getfontname
if _LUAVERSION < 5.2 then
@@ -160,7 +160,7 @@ if _LUAVERSION < 5.2 then
else
- utilities.strings.formatters.add(formatters,"font:name", [["'"..fontname(%s).."'"]], { fontname = fonts.helpers.name })
+ utilities.strings.formatters.add(formatters,"font:name", [["'"..fontname(%s).."'"]], { fontname = helpers.name })
utilities.strings.formatters.add(formatters,"font:features",[["'"..sequenced(%s," ",true).."'"]],{ sequenced = table.sequenced })
end
@@ -2498,3 +2498,24 @@ implement {
arguments = "string",
}
+-- an extra helper
+
+function helpers.getcoloredglyphs(tfmdata)
+ if type(tfmdata) == "number" then
+ tfmdata = fontdata[tfmdata]
+ end
+ if not tfmdata then
+ tfmdata = fontdata[true]
+ end
+ local characters = tfmdata.characters
+ local descriptions = tfmdata.descriptions
+ local collected = { }
+ for unicode in next, characters do
+ local description = descriptions[unicode]
+ if description and (description.colors or description.svg) then
+ collected[#collected+1] = unicode
+ end
+ end
+ table.sort(collected)
+ return collected
+end
diff --git a/tex/context/base/mkiv/font-dsp.lua b/tex/context/base/mkiv/font-dsp.lua
index 37ae16657..9726c51d8 100644
--- a/tex/context/base/mkiv/font-dsp.lua
+++ b/tex/context/base/mkiv/font-dsp.lua
@@ -76,6 +76,7 @@ local readshort = streamreader.readinteger2 -- 16-bit signed integer
local readfword = readshort
local readstring = streamreader.readstring
local readtag = streamreader.readtag
+local readbytes = streamreader.readbytes
local gsubhandlers = { }
local gposhandlers = { }
@@ -2191,7 +2192,7 @@ function readers.math(f,fontdata,specification)
setposition(f,tableoffset)
local version = readulong(f)
if version ~= 0x00010000 then
- report("table version %a of %a is not supported (yet), maybe font %s is bad",version,what,fontdata.filename)
+ report("table version %a of %a is not supported (yet), maybe font %s is bad",version,"math",fontdata.filename)
return
end
local constants = readushort(f)
@@ -2211,3 +2212,144 @@ function readers.math(f,fontdata,specification)
end
end
end
+
+function readers.colr(f,fontdata,specification)
+ if specification.details then
+ local datatable = fontdata.tables.colr
+ if datatable then
+ local tableoffset = datatable.offset
+ setposition(f,tableoffset)
+ local version = readushort(f)
+ if version ~= 0 then
+ report("table version %a of %a is not supported (yet), maybe font %s is bad",version,"colr",fontdata.filename)
+ return
+ end
+ if not fontdata.tables.cpal then
+ report("color table %a in font %a has no mandate %a table","colr",fontdata.filename,"cpal")
+ fontdata.colorpalettes = { }
+ end
+ local glyphs = fontdata.glyphs
+ local nofglyphs = readushort(f)
+ local baseoffset = readulong(f)
+ local layeroffset = readulong(f)
+ local noflayers = readushort(f)
+ local layerrecords = { }
+ local maxclass = 0
+ -- The special value 0xFFFF is foreground (but we index from 1). It
+ -- more looks like indices into a palette so 'class' is a better name
+ -- than 'palette'.
+ setposition(f,tableoffset + layeroffset)
+ for i=1,noflayers do
+ local slot = readushort(f)
+ local class = readushort(f)
+ if class < 0xFFFF then
+ class = class + 1
+ if class > maxclass then
+ maxclass = class
+ end
+ end
+ layerrecords[i] = {
+ slot = slot,
+ class = class,
+ }
+ end
+ fontdata.maxcolorclass = maxclass
+ setposition(f,tableoffset + baseoffset)
+ for i=0,nofglyphs-1 do
+ local glyphindex = readushort(f)
+ local firstlayer = readushort(f)
+ local noflayers = readushort(f)
+ local t = { }
+ for i=1,noflayers do
+ t[i] = layerrecords[firstlayer+i]
+ end
+ glyphs[glyphindex].colors = t
+ end
+ end
+ end
+end
+
+function readers.cpal(f,fontdata,specification)
+ if specification.details then
+ local datatable = fontdata.tables.cpal
+ if datatable then
+ local tableoffset = datatable.offset
+ setposition(f,tableoffset)
+ local version = readushort(f)
+ if version > 1 then
+ report("table version %a of %a is not supported (yet), maybe font %s is bad",version,"cpal",fontdata.filename)
+ return
+ end
+ local nofpaletteentries = readushort(f)
+ local nofpalettes = readushort(f)
+ local nofcolorrecords = readushort(f)
+ local firstcoloroffset = readulong(f)
+ local colorrecords = { }
+ local palettes = { }
+ for i=1,nofpalettes do
+ palettes[i] = readushort(f)
+ end
+ if version == 1 then
+ -- used for guis
+ local palettettypesoffset = readulong(f)
+ local palettelabelsoffset = readulong(f)
+ local paletteentryoffset = readulong(f)
+ end
+ setposition(f,tableoffset+firstcoloroffset)
+ for i=1,nofcolorrecords do
+ local b, g, r, a = readbytes(f,4)
+ colorrecords[i] = {
+ r, g, b, a ~= 255 and a or nil,
+ }
+ end
+ for i=1,nofpalettes do
+ local p = { }
+ local o = palettes[i]
+ for j=1,nofpaletteentries do
+ p[j] = colorrecords[o+j]
+ end
+ palettes[i] = p
+ end
+ fontdata.colorpalettes = palettes
+ end
+ end
+end
+
+function readers.svg(f,fontdata,specification)
+ if specification.details then
+ local datatable = fontdata.tables.svg
+ if datatable then
+ local tableoffset = datatable.offset
+ setposition(f,tableoffset)
+ local version = readushort(f)
+ if version ~= 0 then
+ report("table version %a of %a is not supported (yet), maybe font %s is bad",version,"svg",fontdata.filename)
+ return
+ end
+ local glyphs = fontdata.glyphs
+ local indexoffset = tableoffset + readulong(f)
+ local reserved = readulong(f)
+ setposition(f,indexoffset)
+ local nofentries = readushort(f)
+ local entries = { }
+ for i=1,nofentries do
+ entries[i] = {
+ first = readushort(f),
+ last = readushort(f),
+ offset = indexoffset + readulong(f),
+ length = readulong(f),
+ }
+ end
+ for i=1,nofentries do
+ local entry = entries[i]
+ setposition(f,entry.offset)
+ entries[i] = {
+ first = entry.first,
+ last = entry.last,
+ data = readstring(f,entry.length)
+ }
+ end
+ fontdata.svgshapes = entries
+ end
+ end
+end
diff --git a/tex/context/base/mkiv/font-lib.mkvi b/tex/context/base/mkiv/font-lib.mkvi
index d13de4b3e..fe9198ec7 100644
--- a/tex/context/base/mkiv/font-lib.mkvi
+++ b/tex/context/base/mkiv/font-lib.mkvi
@@ -50,6 +50,7 @@
\registerctxluafile{font-otc}{1.001}
\registerctxluafile{font-oth}{1.001}
\registerctxluafile{font-osd}{1.001}
+\registerctxluafile{font-ocl}{1.001}
% we use otf code for type one
diff --git a/tex/context/base/mkiv/font-map.lua b/tex/context/base/mkiv/font-map.lua
index db4349563..6151b37f5 100644
--- a/tex/context/base/mkiv/font-map.lua
+++ b/tex/context/base/mkiv/font-map.lua
@@ -139,7 +139,7 @@ local f_double = formatters["%04X%04X"]
-- end
-- end
-local function tounicode16(unicode,name)
+local function tounicode16(unicode)
if unicode < 0xD7FF or (unicode > 0xDFFF and unicode <= 0xFFFF) then
return f_single(unicode)
else
@@ -148,7 +148,7 @@ local function tounicode16(unicode,name)
end
end
-local function tounicode16sequence(unicodes,name)
+local function tounicode16sequence(unicodes)
local t = { }
for l=1,#unicodes do
local u = unicodes[l]
diff --git a/tex/context/base/mkiv/font-ocl.lua b/tex/context/base/mkiv/font-ocl.lua
new file mode 100644
index 000000000..af57b786b
--- /dev/null
+++ b/tex/context/base/mkiv/font-ocl.lua
@@ -0,0 +1,235 @@
+if not modules then modules = { } end modules ['font-ocl'] = {
+ version = 1.001,
+ comment = "companion to font-otf.lua (context)",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- todo : user list of colors
+
+local formatters = string.formatters
+
+local otf = fonts.handlers.otf
+
+local f_color_start = formatters["pdf:direct: %f %f %f rg"]
+local s_color_stop = "pdf:direct:"
+
+local function actualtexthandlers()
+ local startactualtext = nil
+ local stopactualtext = nil
+ if context then
+ local codeinjections = backends.codeinjections
+ if codeinjections then
+ startactualtext = codeinjections.startunicodetoactualtext
+ stopactualtext = codeinjections.stopunicodetoactualtext
+ end
+ end
+ if not startactualtext then
+ -- let's be nice for generic
+ local tounicode = fonts.mappings.tounicode16
+ startactualtext = function(n)
+ return "/Span << /ActualText <feff" .. tounicode(n) .. "> >> BDC"
+ end
+ stopactualtext = function(n)
+ return "EMC"
+ end
+ end
+ return startactualtext, stopactualtext
+end
+
+local function initializecolr(tfmdata,kind,value) -- hm, always value
+ if value then
+ local palettes = tfmdata.resources.colorpalettes
+ if palettes then
+ --
+ local palette = palettes[tonumber(value) or 1] or palettes[1] or { }
+ local classes = #palette
+ if classes == 0 then
+ return
+ end
+ --
+ local characters = tfmdata.characters
+ local descriptions = tfmdata.descriptions
+ local properties = tfmdata.properties
+ local colorvalues = { }
+ --
+ properties.virtualized = true
+ tfmdata.fonts = {
+ { id = 0 }
+ }
+ --
+ local startactualtext, stopactualtext = actualtexthandlers()
+ --
+ for i=1,classes do
+ local p = palette[i]
+ colorvalues[i] = { "special", f_color_start(p[1]/255,p[2]/255,p[3]/255) }
+ end
+ --
+ local stop = { "special", "pdf:direct:" .. stopactualtext() }
+ --
+ for unicode, character in next, characters do
+ local description = descriptions[unicode]
+ if description then
+ local colorlist = description.colors
+ if colorlist then
+ local w = character.width or 0
+ local s = #colorlist
+ local n = 1
+ local t = {
+ { "special", "pdf:direct:" .. startactualtext(unicode) }
+ }
+ for i=1,s do
+ local entry = colorlist[i]
+ n = n + 1 t[n] = colorvalues[entry.class]
+ n = n + 1 t[n] = { "char", entry.slot }
+ if s > 1 and i < s and w ~= 0 then
+ n = n + 1 t[n] = { "right", -w }
+ end
+ end
+ n = n + 1 t[n] = stop
+ character.commands = t
+ end
+ end
+ end
+ end
+ end
+end
+
+fonts.handlers.otf.features.register {
+ name = "colr",
+ description = "color glyphs",
+ manipulators = {
+ base = initializecolr,
+ node = initializecolr,
+ }
+}
+
+otf.svgenabled = true -- for now, this might change
+
+local report_svg = logs.reporter("fonts","svg conversion")
+
+local nofpdfstreams = 0
+local f_name = formatters["svg-glyph-%05i"]
+local f_stream = formatters["memstream:///svg-glyph-%05i"]
+
+-- todo: make a plugin
+
+local function svgtopdf(svgshapes)
+ local svgfile = "temp-otf-svg-shape.svg"
+ local pdffile = "temp-otf-svg-shape.pdf"
+ local command = "inkscape " .. svgfile .. " --export-pdf=" .. pdffile
+ -- local command = [[python "c:\Users\Hans Hagen\AppData\Roaming\Python\Scripts\cairosvg" -f pdf ]] .. svgfile .. " -o " .. pdffile
+ local testrun = false
+
+ local pdfshapes = { }
+ local nofshapes = #svgshapes
+ report_svg("processing %i svg containers",nofshapes)
+ for i=1,nofshapes do
+ local entry = svgshapes[i]
+ for j=entry.first,entry.last do
+ local svg = xml.convert(entry.data)
+ local data = xml.first(svg,"/svg[@id='glyph"..j.."']")
+ io.savedata(svgfile,tostring(data))
+ report_svg("processing svg shape of glyph %i in container %i",j,i)
+ os.execute(command)
+ pdfshapes[j] = io.loaddata(pdffile)
+ end
+ if testrun and i > testrun then
+ report_svg("quiting test run")
+ break
+ end
+ end
+ os.remove(svgfile)
+ return pdfshapes
+end
+
+local function savepdfhandler()
+ if context then
+ local setmemstream = resolvers.setmemstream
+ if setmemstream then
+ return function(pdf)
+ nofpdfstreams = nofpdfstreams + 1
+ setmemstream(f_name(nofpdfstreams),pdf)
+ return f_stream(nofpdfstreams)
+ end
+ end
+ end
+ return function(pdf)
+ nofpdfstreams = nofpdfstreams + 1
+ local name = f_name(nofpdfstreams)
+ io.savedata(name,pdf)
+ return name
+ end
+end
+
+local function initializesvg(tfmdata,kind,value) -- hm, always value
+ if value and otf.svgenabled then
+ local characters = tfmdata.characters
+ local descriptions = tfmdata.descriptions
+ local properties = tfmdata.properties
+ --
+ local svg = properties.svg
+ local hash = svg and svg.hash
+ local timestamp = svg and svg.timestamp
+ if not hash then
+ return
+ end
+ --
+ local pdffile = containers.read(otf.pdfcache,hash)
+ local pdfshapes = pdffile and pdffile.pdfshapes
+ if not pdfshapes or pdffile.timestamp ~= timestamp then
+ local svgfile = containers.read(otf.svgcache,hash)
+ local svgshapes = svgfile and svgfile.svgshapes
+ pdfshapes = svgshapes and svgtopdf(svgshapes) or { }
+ containers.write(otf.pdfcache, hash, {
+ pdfshapes = pdfshapes,
+ timestamp = timestamp,
+ })
+ end
+ if not pdfshapes or not next(pdfshapes) then
+ return
+ end
+ --
+ properties.virtualized = true
+ tfmdata.fonts = {
+ { id = 0 }
+ }
+ --
+ local startactualtext, stopactualtext = actualtexthandlers()
+ local savepdf = savepdfhandler()
+ --
+ local stop = { "special", "pdf:direct:" .. stopactualtext() }
+ --
+ for unicode, character in next, characters do
+ local index = character.index
+ if index then
+ local pdf = pdfshapes[index]
+ if pdf then
+ local filename = savepdf(pdf)
+ character.commands = {
+ { "special", "pdf:direct:" .. startactualtext(unicode) },
+ { "down", character.depth or 0 },
+ { "image", img.new {
+ filename = filename,
+ width = character.width,
+ height = character.height or 0,
+ depth = character.depth or 0,
+ } },
+ stop
+ }
+ character.svg = true
+ end
+ end
+ end
+ end
+end
+
+fonts.handlers.otf.features.register {
+ name = "svg",
+ description = "svg glyphs",
+ manipulators = {
+ base = initializesvg,
+ node = initializesvg,
+ }
+}
diff --git a/tex/context/base/mkiv/font-otl.lua b/tex/context/base/mkiv/font-otl.lua
index e1975f3c6..dd44a165e 100644
--- a/tex/context/base/mkiv/font-otl.lua
+++ b/tex/context/base/mkiv/font-otl.lua
@@ -55,6 +55,8 @@ local otf = fonts.handlers.otf
otf.version = 3.022 -- beware: also sync font-mis.lua and in mtx-fonts
otf.cache = containers.define("fonts", "otl", otf.version, true)
+otf.svgcache = containers.define("fonts", "svg", otf.version, true)
+otf.pdfcache = containers.define("fonts", "pdf", otf.version, true)
local otfreaders = otf.readers
@@ -270,6 +272,25 @@ function otf.load(filename,sub,featurefile) -- second argument (format) is gone
--
--
if data then
+ --
+ local resources = data.resources
+ local svgshapes = resources.svgshapes
+ if svgshapes then
+ resources.svgshapes = nil
+ if otf.svgenabled then
+ local timestamp = os.date()
+ -- work in progress ... a bit boring to do
+ containers.write(otf.svgcache,hash, {
+ svgshapes = svgshapes,
+ timestamp = timestamp,
+ })
+ data.properties.svg = {
+ hash = hash,
+ timestamp = timestamp,
+ }
+ end
+ end
+ --
otfreaders.compact(data)
otfreaders.rehash(data,"unicodes")
otfreaders.addunicodetable(data)
@@ -346,7 +367,6 @@ end
local function copytotfm(data,cache_id)
if data then
local metadata = data.metadata
- local resources = data.resources
local properties = derivetable(data.properties)
local descriptions = derivetable(data.descriptions)
local goodies = derivetable(data.goodies)
diff --git a/tex/context/base/mkiv/font-otr.lua b/tex/context/base/mkiv/font-otr.lua
index 659526297..e09e87d4a 100644
--- a/tex/context/base/mkiv/font-otr.lua
+++ b/tex/context/base/mkiv/font-otr.lua
@@ -129,12 +129,11 @@ local function readlongdatetime(f)
return 0x100000000 * d + 0x1000000 * e + 0x10000 * f + 0x100 * g + h
end
-local tableversion = 0.004
-local privateoffset = fonts.constructors and fonts.constructors.privateoffset or 0xF0000 -- 0x10FFFF
+local tableversion = 0.004
+readers.tableversion = tableversion
+local privateoffset = fonts.constructors and fonts.constructors.privateoffset or 0xF0000 -- 0x10FFFF
+local reportedskipped = { }
-readers.tableversion = tableversion
-
-local reportedskipped = { }
local function reportskippedtable(tag)
if not reportedskipped[tag] then
@@ -1657,6 +1656,26 @@ function readers.glyf(f,fontdata,specification) -- part goes to cff module
end
end
+-- Experimental (we need fonts).
+
+function readers.colr(f,fontdata,specification)
+ if specification.details then
+ reportskippedtable("colr")
+ end
+end
+
+function readers.cpal(f,fontdata,specification)
+ if specification.details then
+ reportskippedtable("cpal")
+ end
+end
+
+function readers.svg(f,fontdata,specification)
+ if specification.details then
+ reportskippedtable("svg")
+ end
+end
+
-- Here we have a table that we really need for later processing although a more advanced gpos table
-- can also be available. Todo: we need a 'fake' lookup for this (analogue to ff).
@@ -1997,6 +2016,9 @@ local function readdata(f,offset,specification)
readers["cmap"](f,fontdata,specification)
readers["loca"](f,fontdata,specification)
readers["glyf"](f,fontdata,specification)
+ readers["colr"](f,fontdata,specification)
+ readers["cpal"](f,fontdata,specification)
+ readers["svg" ](f,fontdata,specification)
readers["kern"](f,fontdata,specification)
readers["gdef"](f,fontdata,specification)
readers["gsub"](f,fontdata,specification)
@@ -2165,7 +2187,8 @@ function readers.loadfont(filename,n)
goodies = { },
metadata = getinfo(fontdata,n), -- no platformnames here !
properties = {
- hasitalics = fontdata.hasitalics or false,
+ hasitalics = fontdata.hasitalics or false,
+ maxcolorclass = fontdata.maxcolorclass,
},
resources = {
-- filename = fontdata.filename,
@@ -2182,6 +2205,8 @@ function readers.loadfont(filename,n)
version = getname(fontdata,"version"),
cidinfo = fontdata.cidinfo,
mathconstants = fontdata.mathconstants,
+ colorpalettes = fontdata.colorpalettes,
+ svgshapes = fontdata.svgshapes,
},
}
end
diff --git a/tex/context/base/mkiv/font-oup.lua b/tex/context/base/mkiv/font-oup.lua
index bd47e71dd..e2d209a76 100644
--- a/tex/context/base/mkiv/font-oup.lua
+++ b/tex/context/base/mkiv/font-oup.lua
@@ -707,6 +707,19 @@ local function unifyglyphs(fontdata,usenames)
end
end
--
+ local colorpalettes = resources.colorpalettes
+ if colorpalettes then
+ for index=1,#glyphs do
+ local colors = glyphs[index].colors
+ if colors then
+ for i=1,#colors do
+ local c = colors[i]
+ c.slot = indices[c.slot]
+ end
+ end
+ end
+ end
+ --
fontdata.private = private
fontdata.glyphs = nil
fontdata.names = names
@@ -1159,6 +1172,7 @@ function readers.pack(data)
local sequences = resources.sequences
local sublookups = resources.sublookups
local features = resources.features
+ local palettes = resources.colorpalettes
local chardata = characters and characters.data
local descriptions = data.descriptions or data.glyphs
@@ -1191,6 +1205,14 @@ function readers.pack(data)
end
end
end
+ -- if palettes then
+ -- local color = description.color
+ -- if color then
+ -- for i=1,#color do
+ -- color[i] = pack_normal(color[i])
+ -- end
+ -- end
+ -- end
end
local function packthem(sequences)
@@ -1315,6 +1337,16 @@ function readers.pack(data)
end
end
+ if palettes then
+ for i=1,#palettes do
+ local p = palettes[i]
+ for j=1,#p do
+ p[j] = pack_indexed(p[j])
+ end
+ end
+
+ end
+
if not success(1,pass) then
return
end
@@ -1462,6 +1494,7 @@ function readers.unpack(data)
local sequences = resources.sequences
local sublookups = resources.sublookups
local features = resources.features
+ local palettes = resources.colorpalettes
local unpacked = { }
setmetatable(unpacked,unpacked_mt)
for unicode, description in next, descriptions do
@@ -1488,6 +1521,17 @@ function readers.unpack(data)
end
end
end
+ -- if palettes then
+ -- local color = description.color
+ -- if color then
+ -- for i=1,#color do
+ -- local tv = tables[color[i]]
+ -- if tv then
+ -- color[i] = tv
+ -- end
+ -- end
+ -- end
+ -- end
end
local function unpackthem(sequences)
@@ -1717,6 +1761,18 @@ function readers.unpack(data)
end
end
+ if palettes then
+ for i=1,#palettes do
+ local p = palettes[i]
+ for j=1,#p do
+ local tv = tables[p[j]]
+ if tv then
+ p[j] = tv
+ end
+ end
+ end
+ end
+
data.tables = nil
end
end
diff --git a/tex/context/base/mkiv/grph-inc.lua b/tex/context/base/mkiv/grph-inc.lua
index d13d45a29..7125edc2e 100644
--- a/tex/context/base/mkiv/grph-inc.lua
+++ b/tex/context/base/mkiv/grph-inc.lua
@@ -1686,7 +1686,7 @@ local svgconverter = { }
converters.svg = svgconverter
converters.svgz = svgconverter
--- inkscape on windows only works with complete paths
+-- inkscape on windows only works with complete paths .. did the command line arguments change again?
programs.inkscape = {
command = "inkscape",
@@ -1694,7 +1694,7 @@ programs.inkscape = {
"%oldname%"
--export-dpi=600
-A
- "%newname%"
+ --export-pdf="%newname%"
]],
pngargument = [[
"%oldname%"
diff --git a/tex/context/base/mkiv/grph-inc.mkiv b/tex/context/base/mkiv/grph-inc.mkiv
index de5a2227a..8b581589e 100644
--- a/tex/context/base/mkiv/grph-inc.mkiv
+++ b/tex/context/base/mkiv/grph-inc.mkiv
@@ -22,6 +22,7 @@
\registerctxluafile{grph-inc}{1.001}
\registerctxluafile{grph-fil}{1.001}
+\registerctxluafile{grph-mem}{1.001}
\registerctxluafile{grph-u3d}{1.001} % this will change
\registerctxluafile{grph-swf}{1.001} % this will change
diff --git a/tex/context/base/mkiv/grph-mem.lua b/tex/context/base/mkiv/grph-mem.lua
new file mode 100644
index 000000000..80a6bfdbf
--- /dev/null
+++ b/tex/context/base/mkiv/grph-mem.lua
@@ -0,0 +1,68 @@
+if not modules then modules = { } end modules ['grph-mem'] = {
+ version = 1.001,
+ comment = "companion to grph-inc.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- very experimental and likely to change
+--
+-- \startluacode
+-- figures.setmemstream("whatever",io.loaddata("t:/sources/cow.pdf"))
+-- \stopluacode
+--
+-- \externalfigure[memstream:///t:/sources/cow.pdf]
+-- \externalfigure[memstream:///whatever]
+
+local report = logs.reporter("memstream")
+local data = { }
+local trace = false
+
+function resolvers.finders.memstream(specification)
+ local original = specification.original
+ local identifier = data[original]
+ if identifier then
+ if trace then
+ report("reusing %a",identifier)
+ end
+ return identifier
+ end
+ local stream = io.loaddata(specification.path)
+ if not stream or stream == "" then
+ return resolvers.finders.notfound()
+ end
+ local memstream = { epdf.openMemStream(stream,#stream,original) }
+ local identifier = memstream[2]
+ if not identifier then
+ report("invalid %a",name)
+ identifier = "invalid-memstream"
+ elseif trace then
+ report("using %a",identifier)
+ end
+ data[original] = identifier
+ return identifier
+end
+
+function resolvers.setmemstream(name,stream)
+ local original = "memstream:///" .. name
+ local memstream = { epdf.openMemStream(stream,#stream,original) }
+ local identifier = memstream[2]
+ if not identifier then
+ report("invalid %a",name)
+ identifier = "invalid-memstream"
+ elseif trace then
+ report("setting %a",identifier)
+ end
+ data[original] = identifier
+end
+
+figures.identifiers.list[#figures.identifiers.list+1] = function(specification)
+ local name = specification.request.name
+ if name and data[name] then
+ specification.status.status = 1
+ specification.used.fullname = name
+ end
+end
+
+figures.setmemstream = resolvers.setmemstream
diff --git a/tex/context/base/mkiv/meta-imp-mat.mkiv b/tex/context/base/mkiv/meta-imp-mat.mkiv
new file mode 100644
index 000000000..8913845fd
--- /dev/null
+++ b/tex/context/base/mkiv/meta-imp-mat.mkiv
@@ -0,0 +1,174 @@
+%D \module
+%D [ file=meta-mat,
+%D version=2013.07.19,
+%D title=\METAPOST\ Graphics,
+%D subtitle=Math,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This is just an example library not meant for production.
+
+% A few accents:
+
+% / for cambria
+
+\startMPextensions
+ vardef math_stacker_overbracket_shape =
+ image (
+ draw
+ (0,OverlayOffset) --
+ (0,OverlayHeight-OverlayOffset) --
+ (OverlayWidth,OverlayHeight-OverlayOffset) --
+ (OverlayWidth,OverlayOffset)
+ withcolor
+ OverlayLineColor ;
+ setbounds currentpicture to boundingbox currentpicture bottomenlarged OverlayOffset ;
+ )
+ enddef ;
+ vardef math_stacker_underbracket_shape =
+ math_stacker_overbracket_shape rotated 180
+ enddef ;
+ vardef math_stacker_overparent_shape =
+ image (
+ draw
+ (0,OverlayOffset) ...
+ (OverlayWidth/2,OverlayHeight-OverlayOffset) ...
+ (OverlayWidth,OverlayOffset)
+ withcolor
+ OverlayLineColor ;
+ setbounds currentpicture to boundingbox currentpicture bottomenlarged OverlayOffset ;
+ )
+ enddef ;
+ vardef math_stacker_underparent_shape =
+ math_stacker_overparent_shape rotated 180
+ enddef ;
+ vardef math_stacker_overbrace_shape =
+ image (
+ draw
+ (0,OverlayOffset) ...
+ (OverlayWidth/4-OverlayOffset,OverlayHeight-OverlayOffset) ...
+ (OverlayWidth/2-OverlayOffset,OverlayHeight-OverlayOffset) ...
+ (OverlayWidth/2,OverlayHeight) &
+ (OverlayWidth/2,OverlayHeight) ...
+ (OverlayWidth/2+OverlayOffset,OverlayHeight-OverlayOffset) ...
+ (3OverlayWidth/4+OverlayOffset,OverlayHeight-OverlayOffset) ...
+ (OverlayWidth,OverlayOffset)
+ withcolor
+ OverlayLineColor ;
+ setbounds currentpicture to boundingbox currentpicture bottomenlarged OverlayOffset ;
+ )
+ enddef ;
+ vardef math_stacker_underbrace_shape =
+ math_stacker_overbrace_shape rotated 180
+ enddef ;
+ vardef math_stacker_overbar_shape =
+ image (
+ draw
+ (0,OverlayOffset) -- (OverlayWidth,OverlayOffset)
+ withcolor
+ OverlayLineColor ;
+ setbounds currentpicture to boundingbox currentpicture bottomenlarged OverlayOffset ;
+ )
+ enddef ;
+ vardef math_stacker_underbar_shape =
+ math_stacker_overbar_shape rotated 180
+ enddef ;
+ vardef math_stacker_arrow_shape =
+ image (
+ drawarrow
+ (OverlayWidth,OverlayOffset) -- (0,OverlayOffset)
+ withcolor
+ OverlayLineColor ;
+ setbounds currentpicture to boundingbox currentpicture bottomenlarged (OverlayOffset/2) topenlarged (OverlayOffset/2) ;
+ )
+ enddef ;
+ vardef math_stacker_leftarrow_shape =
+ math_stacker_arrow_shape
+ enddef ;
+ vardef math_stacker_rightarrow_shape =
+ math_stacker_arrow_shape rotated 180
+ enddef ;
+ def math_stacker_draw(expr p) =
+ draw
+ p
+ withpen
+ pencircle
+ xscaled (2OverlayLineWidth)
+ % yscaled (3OverlayLineWidth/4)
+ yscaled (3OverlayLineWidth)
+ % rotated 30 ;
+ rotated 45 ;
+ enddef ;
+\stopMPextensions
+
+\startuniqueMPgraphic{math:stacker:\number"FE3B4}
+ math_stacker_draw(math_stacker_overbracket_shape) ;
+\stopuniqueMPgraphic
+
+\startuniqueMPgraphic{math:stacker:\number"FE3B5}
+ math_stacker_draw(math_stacker_underbracket_shape) ;
+\stopuniqueMPgraphic
+
+\startuniqueMPgraphic{math:stacker:\number"FE3DC}
+ math_stacker_draw(math_stacker_overparent_shape) ;
+\stopuniqueMPgraphic
+
+\startuniqueMPgraphic{math:stacker:\number"FE3DD}
+ math_stacker_draw(math_stacker_underparent_shape) ;
+\stopuniqueMPgraphic
+
+\startuniqueMPgraphic{math:stacker:\number"FE3DE}
+ math_stacker_draw(math_stacker_overbrace_shape) ;
+\stopuniqueMPgraphic
+
+\startuniqueMPgraphic{math:stacker:\number"FE3DF}
+ math_stacker_draw(math_stacker_underbrace_shape) ;
+\stopuniqueMPgraphic
+
+\startuniqueMPgraphic{math:stacker:\number"FE33E}
+ math_stacker_draw(math_stacker_overbar_shape) ;
+\stopuniqueMPgraphic
+
+\startuniqueMPgraphic{math:stacker:\number"FE33F}
+ math_stacker_draw(math_stacker_underbar_shape) ;
+\stopuniqueMPgraphic
+
+\startuniqueMPgraphic{math:stacker:\number"2190}
+ math_stacker_draw(math_stacker_leftarrow_shape) ;
+\stopuniqueMPgraphic
+
+\startuniqueMPgraphic{math:stacker:\number"2192}
+ math_stacker_draw(math_stacker_rightarrow_shape) ;
+\stopuniqueMPgraphic
+
+%D Radicals:
+
+\startMPextensions
+ vardef math_radical_simple(expr w,h,d,o) =
+ (-h/2-o,h/2-o) --
+ (-h/4-o,-d-o) --
+ (-o,h+o) --
+ (w+o,h+o) --
+ (w+o,h-h/10+o)
+ enddef ;
+\stopMPextensions
+
+\startuniqueMPgraphic{math:radical:default}%{...}
+ draw
+ math_radical_simple(OverlayWidth,OverlayHeight,OverlayDepth,OverlayOffset)
+ withpen pencircle xscaled (2OverlayLineWidth) yscaled (3OverlayLineWidth/4) rotated 30
+ % dashed evenly
+ withcolor OverlayLineColor ;
+\stopuniqueMPgraphic
+
+% \setupmathstackers
+% [vfenced]
+% [color=darkred,
+% alternative=mp]
+
+\endinput
diff --git a/tex/context/base/mkiv/mult-def.lua b/tex/context/base/mkiv/mult-def.lua
index b74ced203..645cf3523 100644
--- a/tex/context/base/mkiv/mult-def.lua
+++ b/tex/context/base/mkiv/mult-def.lua
@@ -13177,6 +13177,9 @@ return {
["pe"]="تهی",
["ro"]="gol",
},
+ ["enable"]={
+ ["en"]="enable",
+ },
["end"]={
["en"]="end",
["nl"]="eind",
diff --git a/tex/context/base/mkiv/spac-ver.lua b/tex/context/base/mkiv/spac-ver.lua
index 1887501b7..9a439e5c2 100644
--- a/tex/context/base/mkiv/spac-ver.lua
+++ b/tex/context/base/mkiv/spac-ver.lua
@@ -1022,16 +1022,17 @@ end
-- penalty only works well when before skip
-local discard = 0
-local largest = 1
-local force = 2
-local penalty = 3
-local add = 4
-local disable = 5
-local nowhite = 6
-local goback = 7
-local together = 8 -- not used (?)
-local overlay = 9
+local discard = 0
+local largest = 1
+local force = 2
+local penalty = 3
+local add = 4
+local disable = 5
+local nowhite = 6
+local goback = 7
+local together = 8 -- not used (?)
+local overlay = 9
+local enable = 10
-- [whatsits][hlist][glue][glue][penalty]
@@ -1513,36 +1514,36 @@ local function collapser(head,where,what,trace,snap,a_snapmethod) -- maybe also
end
end
glue_order, glue_data = 0, nil
- elseif sc == disable then
-local next = getnext(current)
-if not experiment or next then
- ignore_following = true
- if trace then
- trace_skip("disable",sc,so,sp,current)
+ elseif sc == disable or sc == enable then
+ local next = getnext(current)
+ if not experiment or next then
+ ignore_following = sc == disable
+ if trace then
+ trace_skip(sc == disable and "disable" or "enable",sc,so,sp,current)
+ end
+ head, current = remove_node(head, current, true)
+ else
+ current = next
end
- head, current = remove_node(head, current, true)
-else
- current = next
-end
elseif sc == together then
-local next = getnext(current)
-if not experiment or next then
- keep_together = true
- if trace then
- trace_skip("together",sc,so,sp,current)
+ local next = getnext(current)
+ if not experiment or next then
+ keep_together = true
+ if trace then
+ trace_skip("together",sc,so,sp,current)
+ end
+ head, current = remove_node(head, current, true)
+ else
+ current = next
end
- head, current = remove_node(head, current, true)
-else
- current = next
-end
elseif sc == nowhite then
-local next = getnext(current)
-if not experiment or next then
- ignore_whitespace = true
- head, current = remove_node(head, current, true)
-else
- current = next
-end
+ local next = getnext(current)
+ if not experiment or next then
+ ignore_whitespace = true
+ head, current = remove_node(head, current, true)
+ else
+ current = next
+ end
elseif sc == discard then
if trace then
trace_skip("discard",sc,so,sp,current)
diff --git a/tex/context/base/mkiv/spac-ver.mkiv b/tex/context/base/mkiv/spac-ver.mkiv
index 7fe41c6de..5adb048d4 100644
--- a/tex/context/base/mkiv/spac-ver.mkiv
+++ b/tex/context/base/mkiv/spac-ver.mkiv
@@ -2071,6 +2071,8 @@
\definevspacing[\v!preference][penalty:-500] % goodbreak
\definevspacing[\v!samepage] [penalty:10000] % nobreak
+
+\definevspacing[\v!always] [category:0] % hm, internally it's discard
\definevspacing[\v!max] [category:1]
\definevspacing[\v!force] [category:2]
\definevspacing[\v!disable] [category:5]
@@ -2078,7 +2080,8 @@
\definevspacing[\v!back] [category:7]
% together [category:8]
\definevspacing[\v!overlay] [category:9]
-\definevspacing[\v!always] [category:0] % hm, internally it's discard
+\definevspacing[\v!enable] [category:10]
+
\definevspacing[\v!weak] [order:0]
\definevspacing[\v!strong] [order:100]
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 788b9edce..991f3c8ea 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index a7bde7f79..2f63a82a6 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/interface/mkii/keys-cs.xml b/tex/context/interface/mkii/keys-cs.xml
index 94f41a5a8..c368ca014 100644
--- a/tex/context/interface/mkii/keys-cs.xml
+++ b/tex/context/interface/mkii/keys-cs.xml
@@ -175,6 +175,7 @@
<cd:variable name='eight' value='eight'/>
<cd:variable name='embed' value='embed'/>
<cd:variable name='empty' value='prazdne'/>
+ <cd:variable name='enable' value='enable'/>
<cd:variable name='end' value='end'/>
<cd:variable name='endnote' value='endnote'/>
<cd:variable name='enumeration' value='vycet'/>
diff --git a/tex/context/interface/mkii/keys-de.xml b/tex/context/interface/mkii/keys-de.xml
index edbba27c9..45abd7dce 100644
--- a/tex/context/interface/mkii/keys-de.xml
+++ b/tex/context/interface/mkii/keys-de.xml
@@ -175,6 +175,7 @@
<cd:variable name='eight' value='acht'/>
<cd:variable name='embed' value='embed'/>
<cd:variable name='empty' value='leer'/>
+ <cd:variable name='enable' value='enable'/>
<cd:variable name='end' value='end'/>
<cd:variable name='endnote' value='endnote'/>
<cd:variable name='enumeration' value='nummerierung'/>
diff --git a/tex/context/interface/mkii/keys-en.xml b/tex/context/interface/mkii/keys-en.xml
index 9b0a7727a..3a71b17bd 100644
--- a/tex/context/interface/mkii/keys-en.xml
+++ b/tex/context/interface/mkii/keys-en.xml
@@ -175,6 +175,7 @@
<cd:variable name='eight' value='eight'/>
<cd:variable name='embed' value='embed'/>
<cd:variable name='empty' value='empty'/>
+ <cd:variable name='enable' value='enable'/>
<cd:variable name='end' value='end'/>
<cd:variable name='endnote' value='endnote'/>
<cd:variable name='enumeration' value='enumeration'/>
diff --git a/tex/context/interface/mkii/keys-fr.xml b/tex/context/interface/mkii/keys-fr.xml
index dbc2955f5..f107c84b8 100644
--- a/tex/context/interface/mkii/keys-fr.xml
+++ b/tex/context/interface/mkii/keys-fr.xml
@@ -175,6 +175,7 @@
<cd:variable name='eight' value='eight'/>
<cd:variable name='embed' value='embed'/>
<cd:variable name='empty' value='vide'/>
+ <cd:variable name='enable' value='enable'/>
<cd:variable name='end' value='end'/>
<cd:variable name='endnote' value='notefin'/>
<cd:variable name='enumeration' value='enumeration'/>
diff --git a/tex/context/interface/mkii/keys-it.xml b/tex/context/interface/mkii/keys-it.xml
index dcd6e4502..2e3bb5b5d 100644
--- a/tex/context/interface/mkii/keys-it.xml
+++ b/tex/context/interface/mkii/keys-it.xml
@@ -175,6 +175,7 @@
<cd:variable name='eight' value='eight'/>
<cd:variable name='embed' value='embed'/>
<cd:variable name='empty' value='vuoto'/>
+ <cd:variable name='enable' value='enable'/>
<cd:variable name='end' value='end'/>
<cd:variable name='endnote' value='endnote'/>
<cd:variable name='enumeration' value='enumerazione'/>
diff --git a/tex/context/interface/mkii/keys-nl.xml b/tex/context/interface/mkii/keys-nl.xml
index f2ce3629b..704a815f0 100644
--- a/tex/context/interface/mkii/keys-nl.xml
+++ b/tex/context/interface/mkii/keys-nl.xml
@@ -175,6 +175,7 @@
<cd:variable name='eight' value='acht'/>
<cd:variable name='embed' value='sluitin'/>
<cd:variable name='empty' value='leeg'/>
+ <cd:variable name='enable' value='enable'/>
<cd:variable name='end' value='eind'/>
<cd:variable name='endnote' value='eindnoot'/>
<cd:variable name='enumeration' value='doornummering'/>
diff --git a/tex/context/interface/mkii/keys-pe.xml b/tex/context/interface/mkii/keys-pe.xml
index e66ad4f09..87ad3dbe1 100644
--- a/tex/context/interface/mkii/keys-pe.xml
+++ b/tex/context/interface/mkii/keys-pe.xml
@@ -175,6 +175,7 @@
<cd:variable name='eight' value='eight'/>
<cd:variable name='embed' value='embed'/>
<cd:variable name='empty' value='تهی'/>
+ <cd:variable name='enable' value='enable'/>
<cd:variable name='end' value='end'/>
<cd:variable name='endnote' value='ته‌نوشت'/>
<cd:variable name='enumeration' value='شماره‌بندی'/>
diff --git a/tex/context/interface/mkii/keys-ro.xml b/tex/context/interface/mkii/keys-ro.xml
index 2fe560325..bc6227e90 100644
--- a/tex/context/interface/mkii/keys-ro.xml
+++ b/tex/context/interface/mkii/keys-ro.xml
@@ -175,6 +175,7 @@
<cd:variable name='eight' value='eight'/>
<cd:variable name='embed' value='embed'/>
<cd:variable name='empty' value='gol'/>
+ <cd:variable name='enable' value='enable'/>
<cd:variable name='end' value='end'/>
<cd:variable name='endnote' value='endnote'/>
<cd:variable name='enumeration' value='enumerare'/>
diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf
index db1feaa07..0a641e8b4 100644
--- a/tex/context/interface/mkiv/i-context.pdf
+++ b/tex/context/interface/mkiv/i-context.pdf
Binary files differ
diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf
index 8e131f971..68e5b4d12 100644
--- a/tex/context/interface/mkiv/i-readme.pdf
+++ b/tex/context/interface/mkiv/i-readme.pdf
Binary files differ
diff --git a/tex/context/interface/mkiv/i-vspace.xml b/tex/context/interface/mkiv/i-vspace.xml
index b6d7381ee..4618fc00a 100644
--- a/tex/context/interface/mkiv/i-vspace.xml
+++ b/tex/context/interface/mkiv/i-vspace.xml
@@ -28,6 +28,7 @@
<cd:constant type="samepage"/>
<cd:constant type="max"/>
<cd:constant type="force"/>
+ <cd:constant type="enable"/>
<cd:constant type="disable"/>
<cd:constant type="nowhite"/>
<cd:constant type="back"/>
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index e73e0c4ef..607ec824c 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/06/16 19:52:42
+-- merge date : 06/08/16 10:50:01
do -- begin closure to overcome local limits and interference
@@ -7064,7 +7064,7 @@ local function makenameparser(str)
end
local f_single=formatters["%04X"]
local f_double=formatters["%04X%04X"]
-local function tounicode16(unicode,name)
+local function tounicode16(unicode)
if unicode<0xD7FF or (unicode>0xDFFF and unicode<=0xFFFF) then
return f_single(unicode)
else
@@ -7072,7 +7072,7 @@ local function tounicode16(unicode,name)
return f_double(floor(unicode/1024)+0xD800,unicode%1024+0xDC00)
end
end
-local function tounicode16sequence(unicodes,name)
+local function tounicode16sequence(unicodes)
local t={}
for l=1,#unicodes do
local u=unicodes[l]
@@ -7796,8 +7796,8 @@ local function readlongdatetime(f)
return 0x100000000*d+0x1000000*e+0x10000*f+0x100*g+h
end
local tableversion=0.004
-local privateoffset=fonts.constructors and fonts.constructors.privateoffset or 0xF0000
readers.tableversion=tableversion
+local privateoffset=fonts.constructors and fonts.constructors.privateoffset or 0xF0000
local reportedskipped={}
local function reportskippedtable(tag)
if not reportedskipped[tag] then
@@ -8801,6 +8801,21 @@ function readers.glyf(f,fontdata,specification)
reportskippedtable("glyf")
end
end
+function readers.colr(f,fontdata,specification)
+ if specification.details then
+ reportskippedtable("colr")
+ end
+end
+function readers.cpal(f,fontdata,specification)
+ if specification.details then
+ reportskippedtable("cpal")
+ end
+end
+function readers.svg(f,fontdata,specification)
+ if specification.details then
+ reportskippedtable("svg")
+ end
+end
function readers.kern(f,fontdata,specification)
if specification.kerns then
local datatable=fontdata.tables.kern
@@ -9109,6 +9124,9 @@ local function readdata(f,offset,specification)
readers["cmap"](f,fontdata,specification)
readers["loca"](f,fontdata,specification)
readers["glyf"](f,fontdata,specification)
+ readers["colr"](f,fontdata,specification)
+ readers["cpal"](f,fontdata,specification)
+ readers["svg" ](f,fontdata,specification)
readers["kern"](f,fontdata,specification)
readers["gdef"](f,fontdata,specification)
readers["gsub"](f,fontdata,specification)
@@ -9264,6 +9282,7 @@ function readers.loadfont(filename,n)
metadata=getinfo(fontdata,n),
properties={
hasitalics=fontdata.hasitalics or false,
+ maxcolorclass=fontdata.maxcolorclass,
},
resources={
filename=filename,
@@ -9279,6 +9298,8 @@ function readers.loadfont(filename,n)
version=getname(fontdata,"version"),
cidinfo=fontdata.cidinfo,
mathconstants=fontdata.mathconstants,
+ colorpalettes=fontdata.colorpalettes,
+ svgshapes=fontdata.svgshapes,
},
}
end
@@ -11227,6 +11248,7 @@ local readshort=streamreader.readinteger2
local readfword=readshort
local readstring=streamreader.readstring
local readtag=streamreader.readtag
+local readbytes=streamreader.readbytes
local gsubhandlers={}
local gposhandlers={}
local lookupidoffset=-1
@@ -13126,7 +13148,7 @@ function readers.math(f,fontdata,specification)
setposition(f,tableoffset)
local version=readulong(f)
if version~=0x00010000 then
- report("table version %a of %a is not supported (yet), maybe font %s is bad",version,what,fontdata.filename)
+ report("table version %a of %a is not supported (yet), maybe font %s is bad",version,"math",fontdata.filename)
return
end
local constants=readushort(f)
@@ -13146,6 +13168,140 @@ function readers.math(f,fontdata,specification)
end
end
end
+function readers.colr(f,fontdata,specification)
+ if specification.details then
+ local datatable=fontdata.tables.colr
+ if datatable then
+ local tableoffset=datatable.offset
+ setposition(f,tableoffset)
+ local version=readushort(f)
+ if version~=0 then
+ report("table version %a of %a is not supported (yet), maybe font %s is bad",version,"colr",fontdata.filename)
+ return
+ end
+ if not fontdata.tables.cpal then
+ report("color table %a in font %a has no mandate %a table","colr",fontdata.filename,"cpal")
+ fontdata.colorpalettes={}
+ end
+ local glyphs=fontdata.glyphs
+ local nofglyphs=readushort(f)
+ local baseoffset=readulong(f)
+ local layeroffset=readulong(f)
+ local noflayers=readushort(f)
+ local layerrecords={}
+ local maxclass=0
+ setposition(f,tableoffset+layeroffset)
+ for i=1,noflayers do
+ local slot=readushort(f)
+ local class=readushort(f)
+ if class<0xFFFF then
+ class=class+1
+ if class>maxclass then
+ maxclass=class
+ end
+ end
+ layerrecords[i]={
+ slot=slot,
+ class=class,
+ }
+ end
+ fontdata.maxcolorclass=maxclass
+ setposition(f,tableoffset+baseoffset)
+ for i=0,nofglyphs-1 do
+ local glyphindex=readushort(f)
+ local firstlayer=readushort(f)
+ local noflayers=readushort(f)
+ local t={}
+ for i=1,noflayers do
+ t[i]=layerrecords[firstlayer+i]
+ end
+ glyphs[glyphindex].colors=t
+ end
+ end
+ end
+end
+function readers.cpal(f,fontdata,specification)
+ if specification.details then
+ local datatable=fontdata.tables.cpal
+ if datatable then
+ local tableoffset=datatable.offset
+ setposition(f,tableoffset)
+ local version=readushort(f)
+ if version>1 then
+ report("table version %a of %a is not supported (yet), maybe font %s is bad",version,"cpal",fontdata.filename)
+ return
+ end
+ local nofpaletteentries=readushort(f)
+ local nofpalettes=readushort(f)
+ local nofcolorrecords=readushort(f)
+ local firstcoloroffset=readulong(f)
+ local colorrecords={}
+ local palettes={}
+ for i=1,nofpalettes do
+ palettes[i]=readushort(f)
+ end
+ if version==1 then
+ local palettettypesoffset=readulong(f)
+ local palettelabelsoffset=readulong(f)
+ local paletteentryoffset=readulong(f)
+ end
+ setposition(f,tableoffset+firstcoloroffset)
+ for i=1,nofcolorrecords do
+ local b,g,r,a=readbytes(f,4)
+ colorrecords[i]={
+ r,g,b,a~=255 and a or nil,
+ }
+ end
+ for i=1,nofpalettes do
+ local p={}
+ local o=palettes[i]
+ for j=1,nofpaletteentries do
+ p[j]=colorrecords[o+j]
+ end
+ palettes[i]=p
+ end
+ fontdata.colorpalettes=palettes
+ end
+ end
+end
+function readers.svg(f,fontdata,specification)
+ if specification.details then
+ local datatable=fontdata.tables.svg
+ if datatable then
+ local tableoffset=datatable.offset
+ setposition(f,tableoffset)
+ local version=readushort(f)
+ if version~=0 then
+ report("table version %a of %a is not supported (yet), maybe font %s is bad",version,"svg",fontdata.filename)
+ return
+ end
+ local glyphs=fontdata.glyphs
+ local indexoffset=tableoffset+readulong(f)
+ local reserved=readulong(f)
+ setposition(f,indexoffset)
+ local nofentries=readushort(f)
+ local entries={}
+ for i=1,nofentries do
+ entries[i]={
+ first=readushort(f),
+ last=readushort(f),
+ offset=indexoffset+readulong(f),
+ length=readulong(f),
+ }
+ end
+ for i=1,nofentries do
+ local entry=entries[i]
+ setposition(f,entry.offset)
+ entries[i]={
+ first=entry.first,
+ last=entry.last,
+ data=readstring(f,entry.length)
+ }
+ end
+ fontdata.svgshapes=entries
+ end
+ end
+end
end -- closure
@@ -13803,6 +13959,18 @@ local function unifyglyphs(fontdata,usenames)
end
end
end
+ local colorpalettes=resources.colorpalettes
+ if colorpalettes then
+ for index=1,#glyphs do
+ local colors=glyphs[index].colors
+ if colors then
+ for i=1,#colors do
+ local c=colors[i]
+ c.slot=indices[c.slot]
+ end
+ end
+ end
+ end
fontdata.private=private
fontdata.glyphs=nil
fontdata.names=names
@@ -14203,6 +14371,7 @@ function readers.pack(data)
local sequences=resources.sequences
local sublookups=resources.sublookups
local features=resources.features
+ local palettes=resources.colorpalettes
local chardata=characters and characters.data
local descriptions=data.descriptions or data.glyphs
if not descriptions then
@@ -14345,6 +14514,14 @@ function readers.pack(data)
end
end
end
+ if palettes then
+ for i=1,#palettes do
+ local p=palettes[i]
+ for j=1,#p do
+ p[j]=pack_indexed(p[j])
+ end
+ end
+ end
if not success(1,pass) then
return
end
@@ -14465,6 +14642,7 @@ function readers.unpack(data)
local sequences=resources.sequences
local sublookups=resources.sublookups
local features=resources.features
+ local palettes=resources.colorpalettes
local unpacked={}
setmetatable(unpacked,unpacked_mt)
for unicode,description in next,descriptions do
@@ -14703,6 +14881,17 @@ function readers.unpack(data)
end
end
end
+ if palettes then
+ for i=1,#palettes do
+ local p=palettes[i]
+ for j=1,#p do
+ local tv=tables[p[j]]
+ if tv then
+ p[j]=tv
+ end
+ end
+ end
+ end
data.tables=nil
end
end
@@ -15158,6 +15347,8 @@ local fonts=fonts
local otf=fonts.handlers.otf
otf.version=3.022
otf.cache=containers.define("fonts","otl",otf.version,true)
+otf.svgcache=containers.define("fonts","svg",otf.version,true)
+otf.pdfcache=containers.define("fonts","pdf",otf.version,true)
local otfreaders=otf.readers
local hashes=fonts.hashes
local definers=fonts.definers
@@ -15303,6 +15494,22 @@ function otf.load(filename,sub,featurefile)
starttiming(otfreaders)
data=otfreaders.loadfont(filename,sub or 1)
if data then
+ local resources=data.resources
+ local svgshapes=resources.svgshapes
+ if svgshapes then
+ resources.svgshapes=nil
+ if otf.svgenabled then
+ local timestamp=os.date()
+ containers.write(otf.svgcache,hash,{
+ svgshapes=svgshapes,
+ timestamp=timestamp,
+ })
+ data.properties.svg={
+ hash=hash,
+ timestamp=timestamp,
+ }
+ end
+ end
otfreaders.compact(data)
otfreaders.rehash(data,"unicodes")
otfreaders.addunicodetable(data)
@@ -15356,7 +15563,6 @@ end
local function copytotfm(data,cache_id)
if data then
local metadata=data.metadata
- local resources=data.resources
local properties=derivetable(data.properties)
local descriptions=derivetable(data.descriptions)
local goodies=derivetable(data.goodies)