summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-05-09 11:20:37 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-05-09 11:20:37 +0200
commit2498bbe606e7cca22799e33dc29ae5160693b3d8 (patch)
tree2e71bea973ba924760facb782342ed063ab096e2 /tex
parent57c3891a6b93b57f91ea77c9bbecffacbcc0da28 (diff)
downloadcontext-2498bbe606e7cca22799e33dc29ae5160693b3d8.tar.gz
2017-05-09 10:20:00
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-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-dsp.lua37
-rw-r--r--tex/context/base/mkiv/font-otr.lua43
-rw-r--r--tex/context/base/mkiv/font-sym.mkvi2
-rw-r--r--tex/context/base/mkiv/font-ttf.lua112
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin25664 -> 25656 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin424881 -> 424881 bytes
-rw-r--r--tex/context/base/mkiv/util-fil.lua30
-rw-r--r--tex/context/base/mkiv/util-sac.lua30
-rw-r--r--tex/context/interface/mkiv/context-en.xml20
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin812089 -> 812381 bytes
-rw-r--r--tex/context/interface/mkiv/i-fonts.xml18
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin60864 -> 60864 bytes
-rw-r--r--tex/context/modules/mkiv/s-fonts-variable.lua21
-rw-r--r--tex/context/modules/mkiv/s-fonts-variable.mkiv51
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua134
-rw-r--r--tex/generic/context/luatex/luatex-math.tex58
20 files changed, 399 insertions, 165 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index d75587f56..293a87f19 100644
--- a/tex/context/base/mkii/cont-new.mkii
+++ b/tex/context/base/mkii/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2017.05.06 23:06}
+\newcontextversion{2017.05.09 10:14}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii
index dfbd7e33a..ee0cb8adf 100644
--- a/tex/context/base/mkii/context.mkii
+++ b/tex/context/base/mkii/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2017.05.06 23:06}
+\edef\contextversion{2017.05.09 10:14}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index c539cac7e..8412a0bce 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{2017.05.06 23:06}
+\newcontextversion{2017.05.09 10:14}
%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 bc713993f..be0623bd4 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{2017.05.06 23:06}
+\edef\contextversion{2017.05.09 10:14}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/font-dsp.lua b/tex/context/base/mkiv/font-dsp.lua
index d43348cdf..b46e1b82c 100644
--- a/tex/context/base/mkiv/font-dsp.lua
+++ b/tex/context/base/mkiv/font-dsp.lua
@@ -307,11 +307,13 @@ end)
-- italic = "ital",
-- }, "self")
+-- todo: spaces in name but not before :
+
local pattern = lpeg.Cf (
lpeg.Ct("") *
lpeg.Cg (
--(lpeg.R("az")^1/names) * lpeg.S(" :") *
- lpeg.C(lpeg.R("az")^1) * lpeg.S(" :=") *
+ lpeg.C((lpeg.R("az","09")+lpeg.P(" "))^1) * lpeg.S(" :=") *
(lpeg.patterns.number/tonumber) * lpeg.S(" ,")^0
)^1, rawset
)
@@ -371,7 +373,10 @@ local function getaxisscale(segments,minimum,default,maximum,user)
local e
for i=1,#segments do
local s = segments[i]
- if s[1] >= default then
+ if type(s) ~= "number" then
+ report("using default axis scale")
+ return default
+ elseif s[1] >= default then
if s[2] == default then
return default
else
@@ -3329,7 +3334,7 @@ function readers.stat(f,fontdata,specification)
end
-- The avar table is optional and used in combination with fvar. Given the
--- detailed explanation about bad valeus we expect the worst and do some
+-- detailed explanation about bad values we expect the worst and do some
-- checking.
function readers.avar(f,fontdata,specification)
@@ -3337,7 +3342,7 @@ function readers.avar(f,fontdata,specification)
if tableoffset then
local function collect()
- local nofvalues = readulong(f)
+ local nofvalues = readushort(f)
local values = { }
local lastfrom = false
local lastto = false
@@ -3349,7 +3354,7 @@ function readers.avar(f,fontdata,specification)
-- ignore
else
values[#values+1] = { f, t }
- lasfrom, lastto = f, t
+ lastfrom, lastto = f, t
end
end
nofvalues = #values
@@ -3358,7 +3363,7 @@ function readers.avar(f,fontdata,specification)
if some[1] == -1 and some[2] == -1 then
some = values[nofvalues]
if some[1] == 1 and some[2] == 1 then
- for i=2,size-1 do
+ for i=2,nofvalues-1 do
some = values[i]
if some[1] == 0 and some[2] == 0 then
return values
@@ -3370,10 +3375,11 @@ function readers.avar(f,fontdata,specification)
return false
end
- local version = readulong(f) -- 1.0
- local reserved = readulong(f)
- local nofaxis = readulong(f)
- local segments = { }
+ local majorversion = readushort(f) -- 1
+ local minorversion = readushort(f) -- 0
+ local reserved = readushort(f)
+ local nofaxis = readushort(f)
+ local segments = { }
for i=1,nofaxis do
segments[i] = collect()
end
@@ -3403,9 +3409,9 @@ function readers.fvar(f,fontdata,specification)
for i=1,nofaxis do
axis[i] = {
tag = readtag(f), -- ital opsz slnt wdth wght
- minimum = readfixed(f), -- we get weird values from a test font ... to be checked
- default = readfixed(f), -- idem
- maximum = readfixed(f), -- idem
+ minimum = readfixed(f),
+ default = readfixed(f),
+ maximum = readfixed(f),
flags = readushort(f),
name = lower(extras[readushort(f)] or "bad name"),
}
@@ -3425,10 +3431,6 @@ function readers.fvar(f,fontdata,specification)
local flags = readushort(f) -- 0, not used yet
local values = { }
for i=1,nofaxis do
- -- depends on what we want to see:
- --
- -- values[axis[i].tag] = readfixed(f)
- --
values[i] = {
axis = axis[i].tag,
value = readfixed(f),
@@ -3516,6 +3518,7 @@ function readers.hvar(f,fontdata,specification)
innerindex[i] = band(mapdata,innermask)
end
-- use last entry when no match i
+ setvariabledata(fontdata,"hvarwidths",true)
local glyphs = fontdata.glyphs
for i=0,fontdata.nofglyphs-1 do
local glyph = glyphs[i]
diff --git a/tex/context/base/mkiv/font-otr.lua b/tex/context/base/mkiv/font-otr.lua
index 977be70a6..3addf3324 100644
--- a/tex/context/base/mkiv/font-otr.lua
+++ b/tex/context/base/mkiv/font-otr.lua
@@ -2075,6 +2075,39 @@ local function readdata(f,offset,specification)
if variablefonts_supported then
+ local variabledata = fontdata.variabledata
+
+ if variabledata then
+ local instances = variabledata.instances
+ local axis = variabledata.axis
+ if axis and (not instances or #instances == 0) then
+ instances = { }
+ variabledata.instances = instances
+ local function add(n,subfamily,value)
+ local values = { }
+ for i=1,#axis do
+ local a = axis[i]
+ values[i] = {
+ axis = a.tag,
+ value = i == n and value or a.default,
+ }
+ end
+ instances[#instances+1] = {
+ subfamily = subfamily,
+ values = values,
+ }
+ end
+ for i=1,#axis do
+ local a = axis[i]
+ local tag = a.tag
+ add(i,"default"..tag,a.default)
+ add(i,"minimum"..tag,a.minimum)
+ add(i,"maximum"..tag,a.maximum)
+ end
+ -- report("%i fake instances added",#instances)
+ end
+ end
+
if not specification.factors then
local instance = specification.instance
if type(instance) == "string" then
@@ -2089,19 +2122,19 @@ local function readdata(f,offset,specification)
end
end
end
+
if not fontdata.factors then
if fontdata.variabledata then
local factors = helpers.getfactors(fontdata,true)
if factors then
specification.factors = factors
- fontdata.factors = factors
- fontdata.instance = instance
- report("font instance: %s, factors: % t",instance,factors)
+ fontdata.factors = factors
+ report("factors: % t",factors)
else
- report("user instance: %s, bad factors",instance)
+ report("bad factors")
end
else
- report("unknown instance")
+ -- report("unknown instance")
end
end
diff --git a/tex/context/base/mkiv/font-sym.mkvi b/tex/context/base/mkiv/font-sym.mkvi
index c1ffd6361..0e709f161 100644
--- a/tex/context/base/mkiv/font-sym.mkvi
+++ b/tex/context/base/mkiv/font-sym.mkvi
@@ -173,6 +173,8 @@
\unexpanded\def\getnamedglyphdirect#fontname#character{{\setdirectsymbolicfont{#fontname}\clf_fontchar{#character}}}
\unexpanded\def\getglyphstyled #fontname#character{{\setstyledsymbolicfont{#fontname}\doifelsenumber{#character}\char\donothing#character}}
\unexpanded\def\getglyphdirect #fontname#character{{\setdirectsymbolicfont{#fontname}\doifelsenumber{#character}\char\donothing#character}}
+\unexpanded\def\resolvedglyphstyled#fontname#character{{\setstyledsymbolicfont{#fontname}\clf_tochar{#character}}}
+\unexpanded\def\resolvedglyphdirect#fontname#character{{\setdirectsymbolicfont{#fontname}\clf_tochar{#character}}}
% this one is wrong:
diff --git a/tex/context/base/mkiv/font-ttf.lua b/tex/context/base/mkiv/font-ttf.lua
index 290a3dfe8..37b30f314 100644
--- a/tex/context/base/mkiv/font-ttf.lua
+++ b/tex/context/base/mkiv/font-ttf.lua
@@ -40,6 +40,8 @@ local concat = table.concat
local report = logs.reporter("otf reader","ttf")
+local trace_deltas = false
+
local readers = fonts.handlers.otf.readers
local streamreader = readers.streamreader
@@ -154,14 +156,15 @@ end
-- We had two loops (going backward) but can do it in one loop .. but maybe we
-- should only accept fonts with proper hvar tables.
-local function applyaxis(glyph,shape,points,deltas)
+local function applyaxis(glyph,shape,deltas,dowidth)
+ local points = shape.points
if points then
local nofpoints = #points
--- local h = nofpoints + 2 -- weird, the example font seems to have left first
--- ----- l = nofpoints + 2
--- ----- v = nofpoints + 3
--- ----- t = nofpoints + 4
--- local width = glyph.width
+ local h = nofpoints + 1 -- weird, the example font seems to have left first
+ ----- l = nofpoints + 2
+ ----- v = nofpoints + 3
+ ----- t = nofpoints + 4
+ local width = dowidth and glyph.width -- what if hvar
for i=1,#deltas do
local deltaset = deltas[i]
local xvalues = deltaset.xvalues
@@ -176,30 +179,22 @@ local function applyaxis(glyph,shape,points,deltas)
local p = points[d]
if p then
if xvalues then
- local x = xvalues[d]
+ local x = xvalues[i]
if x and x ~= 0 then
p[1] = p[1] + factor * x
end
end
if yvalues then
- local y = yvalues[d]
+ local y = yvalues[i]
if y and y ~= 0 then
p[2] = p[2] + factor * y
end
end
- elseif width then
--- weird one-off and bad values
---
--- if d == h then
--- print("index",d)
--- inspect(dpoints)
--- inspect(xvalues)
--- local x = xvalues[i]
--- if x then
--- print("phantom h advance",width,factor*x)
--- width = width + factor * x
--- end
--- end
+ elseif width then -- and p == h then
+ local x = xvalues[d+1]
+ if x then
+ width = width + factor * x
+ end
end
end
else
@@ -218,10 +213,24 @@ local function applyaxis(glyph,shape,points,deltas)
end
end
end
--- todo : phantom point hadvance
+ if width then
+ local x = xvalues[h]
+ if x then
+ width = width + factor * x
+ end
+ end
end
end
--- glyph.width = width
+ -- for i=1,nofpoints do
+ -- local p = points[i]
+ -- p[1] = round(p[1])
+ -- p[2] = round(p[2])
+ -- end
+ if width then
+ glyph.width = width
+ end
+ else
+ report("no points for glyph %a",glyph.name)
end
end
@@ -935,8 +944,10 @@ local function readpoints(f)
else
if count < 128 then
-- no second byte, use count
+ elseif bittest(count,0x80) then
+ count = band(count,0x7F) * 256 + readbyte(f)
else
- count = band(count,0x80) * 256 + readbyte(f)
+ -- bad news
end
local points = { }
local p = 0
@@ -1055,15 +1066,16 @@ function readers.gvar(f,fontdata,specification,glyphdata,shapedata)
local data = { }
local tuples = { }
local glyphdata = fontdata.glyphs
+ local dowidth = fontdata.variabledata.hvarwidths
-- there is one more offset (so that one can calculate the size i suppose)
-- so we could test for overflows but we simply assume sane font files
if bittest(flags,0x0001) then
- for i=1,nofglyphs do
- data[i] = readulong(f)
+ for i=1,nofglyphs+1 do
+ data[i] = dataoffset + readulong(f)
end
else
- for i=1,nofglyphs do
- data[i] = 2*readushort(f)
+ for i=1,nofglyphs+1 do
+ data[i] = dataoffset + 2*readushort(f)
end
end
--
@@ -1073,15 +1085,22 @@ function readers.gvar(f,fontdata,specification,glyphdata,shapedata)
tuples[i] = readtuplerecord(f,nofaxis)
end
end
- local lastoffset = false
+ local nextoffset = false
+ local startoffset = data[1]
for i=1,nofglyphs do -- hm one more cf spec
- local startoffset = dataoffset + data[i]
- if startoffset == lastoffset then
- -- no deltas
+ nextoffset = data[i+1]
+ local glyph = glyphdata[i-1]
+ local name = trace_deltas and glyph.name
+ if startoffset == nextoffset then
+ if name then
+ report("no deltas for glyph %a",name)
+ end
else
local shape = shapedata[i-1] -- todo 0
if not shape then
- -- no shape
+ if name then
+ report("no shape for glyph %a",name)
+ end
else
lastoffset = startoffset
setposition(f,startoffset)
@@ -1121,7 +1140,7 @@ function readers.gvar(f,fontdata,specification,glyphdata,shapedata)
-- advance = advance + 2*nofaxis
else
if index+1 > #tuples then
- print("error, bad index",index)
+ report("error, bad tuple index",index)
end
peak = tuples[index+1] -- hm, needs checking, only peak?
end
@@ -1182,7 +1201,11 @@ function readers.gvar(f,fontdata,specification,glyphdata,shapedata)
-- * 1
end
end
- if s ~= 0 then
+ if s == 0 then
+ if name then
+ report("no deltas applied for glyph %a",name)
+ end
+ else
deltas[#deltas+1] = {
factor = s,
points = points,
@@ -1192,21 +1215,11 @@ function readers.gvar(f,fontdata,specification,glyphdata,shapedata)
end
end
if shape.type == "glyph" then
--- if fontdata.glyphs[i-1].name == "X" then
--- if deltas then
--- for i=1,#deltas do
--- local d = deltas[i]
--- local x = d.xvalues
--- local y = d.yvalues
--- if x and y then
--- for i=1,#x do
--- print(i-1,x[i],y[i])
--- end
--- end
--- end
--- end
+-- if glyph.name == "u1f31d" then
+-- if glyph.unicode == 127773 then
+-- inspect(deltas)
-- end
- applyaxis(glyphdata[i],shape,shape.points,deltas)
+ applyaxis(glyph,shape,deltas,dowidth)
else
-- todo: args_are_xy_values mess .. i have to be really bored
-- and motivated to deal with it
@@ -1214,6 +1227,7 @@ function readers.gvar(f,fontdata,specification,glyphdata,shapedata)
end
end
end
+ startoffset = nextoffset
end
end
end
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 0440c4cd8..c6da00b91 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 db8b36d2f..89f2632f3 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/base/mkiv/util-fil.lua b/tex/context/base/mkiv/util-fil.lua
index de3c999b7..01bcd571e 100644
--- a/tex/context/base/mkiv/util-fil.lua
+++ b/tex/context/base/mkiv/util-fil.lua
@@ -195,23 +195,41 @@ function files.readinteger4le(f)
end
end
+-- function files.readfixed2(f)
+-- local a, b = byte(f:read(2),1,2)
+-- if a >= 0x80 then
+-- return (0x100 * a + b - 0x10000)/256.0
+-- else
+-- return (0x100 * a + b)/256.0
+-- end
+-- end
+
function files.readfixed2(f)
local a, b = byte(f:read(2),1,2)
if a >= 0x80 then
- return (0x100 * a + b - 0x10000)/256.0
+ return (a - 0x100) + b/0x100
else
- return (0x100 * a + b)/256.0
+ return (a ) + b/0x100
end
end
-- (real) (n>>16) + ((n&0xffff)/65536.0))
+-- function files.readfixed4(f)
+-- local a, b, c, d = byte(f:read(4),1,4)
+-- if a >= 0x80 then
+-- return (0x1000000 * a + 0x10000 * b + 0x100 * c + d - 0x100000000)/65536.0
+-- else
+-- return (0x1000000 * a + 0x10000 * b + 0x100 * c + d)/65536.0
+-- end
+-- end
+
function files.readfixed4(f)
local a, b, c, d = byte(f:read(4),1,4)
if a >= 0x80 then
- return (0x1000000 * a + 0x10000 * b + 0x100 * c + d - 0x100000000)/65536.0
+ return (0x100 * a + b - 0x10000) + (0x100 * c + d)/0x10000
else
- return (0x1000000 * a + 0x10000 * b + 0x100 * c + d)/65536.0
+ return (0x100 * a + b ) + (0x100 * c + d)/0x10000
end
end
@@ -281,8 +299,8 @@ if fio and fio.readcardinal1 then
files.readinteger2 = fio.readinteger2
files.readinteger3 = fio.readinteger3
files.readinteger4 = fio.readinteger4
- files.readfixed2 = fio.readfixed2
- files.readfixed4 = fio.readfixed4
+ -- files.readfixed2 = fio.readfixed2 -- needs recent luatex
+ -- files.readfixed4 = fio.readfixed4 -- needs recent luatex
files.read2dot14 = fio.read2dot14
files.setposition = fio.setposition
files.getposition = fio.getposition
diff --git a/tex/context/base/mkiv/util-sac.lua b/tex/context/base/mkiv/util-sac.lua
index 50bb14d35..b509d9a9b 100644
--- a/tex/context/base/mkiv/util-sac.lua
+++ b/tex/context/base/mkiv/util-sac.lua
@@ -239,9 +239,9 @@ function streams.readfixed4(f)
f[2] = j + 1
local a, b, c, d = byte(f[1],i,j)
if a >= 0x80 then
- return (0x1000000 * a + 0x10000 * b + 0x100 * c + d - 0x100000000)/65536.0
+ return (0x100 * a + b - 0x10000) + (0x100 * c + d)/0x10000
else
- return (0x1000000 * a + 0x10000 * b + 0x100 * c + d)/65536.0
+ return (0x100 * a + b ) + (0x100 * c + d)/0x10000
end
end
@@ -251,9 +251,9 @@ function streams.readfixed2(f)
f[2] = j + 1
local a, b = byte(f[1],i,j)
if a >= 0x80 then
- return (0x100 * a + b - 0x10000)/256.0
+ return (a - 0x100) + b/0x100
else
- return (0x100 * a + b)/256.0
+ return (a ) + b/0x100
end
end
@@ -300,7 +300,7 @@ if sio and sio.readcardinal2 then
local readfixed4 = sio.readfixed4
local read2dot14 = sio.read2dot14
local readbytes = sio.readbytes
- local readbytetable = sio.readbytetable
+ local readbytetable = sio.readbytetable
function streams.readcardinal1(f)
local i = f[2]
@@ -342,16 +342,16 @@ if sio and sio.readcardinal2 then
f[2] = i + 4
return readinteger4(f[1],i)
end
- function streams.readfixed2(f)
- local i = f[2]
- f[2] = i + 2
- return readfixed2(f[1],i)
- end
- function streams.readfixed4(f)
- local i = f[2]
- f[2] = i + 4
- return readfixed4(f[1],i)
- end
+ -- function streams.readfixed2(f) -- needs recent luatex
+ -- local i = f[2]
+ -- f[2] = i + 2
+ -- return readfixed2(f[1],i)
+ -- end
+ -- function streams.readfixed4(f) -- needs recent luatex
+ -- local i = f[2]
+ -- f[2] = i + 4
+ -- return readfixed4(f[1],i)
+ -- end
function streams.read2dot4(f)
local i = f[2]
f[2] = i + 2
diff --git a/tex/context/interface/mkiv/context-en.xml b/tex/context/interface/mkiv/context-en.xml
index 34eb5c821..e8353dbdc 100644
--- a/tex/context/interface/mkiv/context-en.xml
+++ b/tex/context/interface/mkiv/context-en.xml
@@ -11748,6 +11748,26 @@
</cd:keywords>
</cd:arguments>
</cd:command>
+ <cd:command file="font-sym.mkvi" name="resolvedglyphstyled">
+ <cd:arguments>
+ <cd:keywords delimiters="braces">
+ <cd:constant type="cd:font"/>
+ </cd:keywords>
+ <cd:keywords delimiters="braces">
+ <cd:constant type="cd:text"/>
+ </cd:keywords>
+ </cd:arguments>
+ </cd:command>
+ <cd:command file="font-sym.mkvi" name="resolvedglyphdirect">
+ <cd:arguments>
+ <cd:keywords delimiters="braces">
+ <cd:constant type="cd:font"/>
+ </cd:keywords>
+ <cd:keywords delimiters="braces">
+ <cd:constant type="cd:text"/>
+ </cd:keywords>
+ </cd:arguments>
+ </cd:command>
<cd:command file="font-sym.mkvi" name="setfont">
<cd:arguments>
<cd:keywords delimiters="none">
diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf
index 17ac84dd3..361ff877c 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-fonts.xml b/tex/context/interface/mkiv/i-fonts.xml
index 434d1f694..c246905f0 100644
--- a/tex/context/interface/mkiv/i-fonts.xml
+++ b/tex/context/interface/mkiv/i-fonts.xml
@@ -1406,6 +1406,24 @@
</cd:arguments>
</cd:command>
+ <cd:command name="resolvedglyphstyled" file="font-sym.mkvi">
+ <cd:arguments>
+ <cd:resolve name="argument-font"/>
+ <cd:keywords delimiters="braces">
+ <cd:constant type="cd:text"/>
+ </cd:keywords>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="resolvedglyphdirect" file="font-sym.mkvi">
+ <cd:arguments>
+ <cd:resolve name="argument-font"/>
+ <cd:keywords delimiters="braces">
+ <cd:constant type="cd:text"/>
+ </cd:keywords>
+ </cd:arguments>
+ </cd:command>
+
<cd:command name="setfont" file="font-sym.mkvi">
<cd:arguments>
<cd:resolve name="string-font"/>
diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf
index 9b3f5127d..32a57f497 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/modules/mkiv/s-fonts-variable.lua b/tex/context/modules/mkiv/s-fonts-variable.lua
index d4e3244a9..2b2aa1dfc 100644
--- a/tex/context/modules/mkiv/s-fonts-variable.lua
+++ b/tex/context/modules/mkiv/s-fonts-variable.lua
@@ -23,6 +23,7 @@ function moduledata.fonts.variable.showvariations(specification)
specification = interfaces.checkedspecification(specification)
local fontfile = specification.font
+ local maximum = tonumber(specification.max) or 0xFFFF
local fontname = format("testfont-%s",i)
local fontsize = tex.dimen.bodyfontsize
if not fontfile then
@@ -51,6 +52,10 @@ function moduledata.fonts.variable.showvariations(specification)
-- return
-- end
+if not fontdata.shared.rawdata.metadata.fullname then
+ fontdata.shared.rawdata.metadata.fullname = fontdata.shared.rawdata.metadata.fontname
+end
+
context.starttitle { title = fontdata.shared.rawdata.metadata.fullname }
local parameters = fontdata.parameters
@@ -224,16 +229,30 @@ function moduledata.fonts.variable.showvariations(specification)
end
context.stopsubject()
+ local sample = specification.sample
+
for i=1,#collected do
local instance = collected[i]
context.startsubject { title = instance }
context.start()
context.definedfont { "name:" .. instance .. "*default" }
- context.input("zapf.tex")
+ if sample and sample ~= "" then
+ context(sample)
+ else
+ context.input("zapf.tex")
+ end
context.par()
context.stop()
context.stopsubject()
+
+ if i > maximum then
+ context.startsubject { title = "And so on" }
+ context("no more than %i instances are shown",maximum)
+ context.par()
+ context.stopsubject()
+ break
+ end
end
-- local function showregions(tag)
diff --git a/tex/context/modules/mkiv/s-fonts-variable.mkiv b/tex/context/modules/mkiv/s-fonts-variable.mkiv
index 7779eb701..6b84c2ebb 100644
--- a/tex/context/modules/mkiv/s-fonts-variable.mkiv
+++ b/tex/context/modules/mkiv/s-fonts-variable.mkiv
@@ -36,7 +36,29 @@
\starttext
+ \startbuffer[zycon]
+ \char008986\relax\quad
+ \char009728\relax\quad
+ \char010031\relax\quad
+ \char010143\relax\quad
+ \char011044\relax\quad
+ \char127773\relax\quad
+ \char127989\relax\quad
+ \char128008\relax\quad
+ \char128021\relax\quad
+ \char128034\relax\quad
+ \char128161\relax\quad
+ \char128274\relax\quad
+ \char128347\relax\quad
+ \char128400\relax\quad
+ \char128692\relax\quad
+ \char129417\relax\quad
+ \char129422\relax\quad
+ \char983040\relax\par
+ \stopbuffer
+
% \showfontkerns
+% \showglyphs
\showfontvariations
[font=file:adobevfprototype.otf]
@@ -44,23 +66,30 @@
\showfontvariations
[font=file:avenirnextvariable.ttf]
-% \showfontvariations
-% [font=file:kairossansvariable.ttf]
+ \showfontvariations
+ [font=file:DecoVar-VF.ttf]
+
+ \showfontvariations
+ [font=file:VotoSerifGX.ttf,
+ max=15]
-% \showfontvariations
-% [font=file:sourcecode-regular.otf]
+ \showfontvariations
+ [font=file:Selawik-Variable.ttf]
-% \showfontvariations
-% [font=file:AmstelvarAlpha-VF.ttf]
+ \showfontvariations
+ [font=file:LibreFranklinGX-Romans.ttf]
\showfontvariations
- [font=file:DecoVar-VF.ttf]
+ [font=file:Zycon.ttf,
+ sample={\getbuffer[zycon]}]
- % This is Adam's version of noto .. has lots of instances so it takes a while
- % the first time. Looks like I do somethign wrong (bad a's and widths).
+ % \showfontvariations
+ % [font=file:kairossansvariable.ttf]
-% \showfontvariations
-% [font=file:VotoSerifGX.ttf]
+ % \showfontvariations
+ % [font=file:sourcecode-regular.otf]
+ % \showfontvariations
+ % [font=file:AmstelvarAlpha-VF.ttf]
\stoptext
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index a31f35866..90e4e7624 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 : 05/06/17 23:06:49
+-- merge date : 05/09/17 10:14:12
do -- begin closure to overcome local limits and interference
@@ -4439,17 +4439,17 @@ end
function files.readfixed2(f)
local a,b=byte(f:read(2),1,2)
if a>=0x80 then
- return (0x100*a+b-0x10000)/256.0
+ return (a-0x100)+b/0x100
else
- return (0x100*a+b)/256.0
+ return (a )+b/0x100
end
end
function files.readfixed4(f)
local a,b,c,d=byte(f:read(4),1,4)
if a>=0x80 then
- return (0x1000000*a+0x10000*b+0x100*c+d-0x100000000)/65536.0
+ return (0x100*a+b-0x10000)+(0x100*c+d)/0x10000
else
- return (0x1000000*a+0x10000*b+0x100*c+d)/65536.0
+ return (0x100*a+b )+(0x100*c+d)/0x10000
end
end
if extract then
@@ -4503,8 +4503,6 @@ if fio and fio.readcardinal1 then
files.readinteger2=fio.readinteger2
files.readinteger3=fio.readinteger3
files.readinteger4=fio.readinteger4
- files.readfixed2=fio.readfixed2
- files.readfixed4=fio.readfixed4
files.read2dot14=fio.read2dot14
files.setposition=fio.setposition
files.getposition=fio.getposition
@@ -9535,6 +9533,36 @@ local function readdata(f,offset,specification)
readtable("avar",f,fontdata,specification)
readtable("fvar",f,fontdata,specification)
if variablefonts_supported then
+ local variabledata=fontdata.variabledata
+ if variabledata then
+ local instances=variabledata.instances
+ local axis=variabledata.axis
+ if axis and (not instances or #instances==0) then
+ instances={}
+ variabledata.instances=instances
+ local function add(n,subfamily,value)
+ local values={}
+ for i=1,#axis do
+ local a=axis[i]
+ values[i]={
+ axis=a.tag,
+ value=i==n and value or a.default,
+ }
+ end
+ instances[#instances+1]={
+ subfamily=subfamily,
+ values=values,
+ }
+ end
+ for i=1,#axis do
+ local a=axis[i]
+ local tag=a.tag
+ add(i,"default"..tag,a.default)
+ add(i,"minimum"..tag,a.minimum)
+ add(i,"maximum"..tag,a.maximum)
+ end
+ end
+ end
if not specification.factors then
local instance=specification.instance
if type(instance)=="string" then
@@ -9555,13 +9583,11 @@ local function readdata(f,offset,specification)
if factors then
specification.factors=factors
fontdata.factors=factors
- fontdata.instance=instance
- report("font instance: %s, factors: % t",instance,factors)
+ report("factors: % t",factors)
else
- report("user instance: %s, bad factors",instance)
+ report("bad factors")
end
else
- report("unknown instance")
end
end
end
@@ -11738,6 +11764,7 @@ local sqrt,round=math.sqrt,math.round
local char=string.char
local concat=table.concat
local report=logs.reporter("otf reader","ttf")
+local trace_deltas=false
local readers=fonts.handlers.otf.readers
local streamreader=readers.streamreader
local setposition=streamreader.setposition
@@ -11826,9 +11853,12 @@ local function curveto(m_x,m_y,l_x,l_y,r_x,r_y)
r_x+2/3*(m_x-r_x),r_y+2/3*(m_y-r_y),
r_x,r_y,"c"
end
-local function applyaxis(glyph,shape,points,deltas)
+local function applyaxis(glyph,shape,deltas,dowidth)
+ local points=shape.points
if points then
local nofpoints=#points
+ local h=nofpoints+1
+ local width=dowidth and glyph.width
for i=1,#deltas do
local deltaset=deltas[i]
local xvalues=deltaset.xvalues
@@ -11842,18 +11872,22 @@ local function applyaxis(glyph,shape,points,deltas)
local p=points[d]
if p then
if xvalues then
- local x=xvalues[d]
+ local x=xvalues[i]
if x and x~=0 then
p[1]=p[1]+factor*x
end
end
if yvalues then
- local y=yvalues[d]
+ local y=yvalues[i]
if y and y~=0 then
p[2]=p[2]+factor*y
end
end
- elseif width then
+ elseif width then
+ local x=xvalues[d+1]
+ if x then
+ width=width+factor*x
+ end
end
end
else
@@ -11872,8 +11906,19 @@ local function applyaxis(glyph,shape,points,deltas)
end
end
end
+ if width then
+ local x=xvalues[h]
+ if x then
+ width=width+factor*x
+ end
+ end
end
end
+ if width then
+ glyph.width=width
+ end
+ else
+ report("no points for glyph %a",glyph.name)
end
end
local quadratic=false
@@ -12518,8 +12563,9 @@ local function readpoints(f)
return nil,0
else
if count<128 then
+ elseif bittest(count,0x80) then
+ count=band(count,0x7F)*256+readbyte(f)
else
- count=band(count,0x80)*256+readbyte(f)
end
local points={}
local p=0
@@ -12622,13 +12668,14 @@ function readers.gvar(f,fontdata,specification,glyphdata,shapedata)
local data={}
local tuples={}
local glyphdata=fontdata.glyphs
+ local dowidth=fontdata.variabledata.hvarwidths
if bittest(flags,0x0001) then
- for i=1,nofglyphs do
- data[i]=readulong(f)
+ for i=1,nofglyphs+1 do
+ data[i]=dataoffset+readulong(f)
end
else
- for i=1,nofglyphs do
- data[i]=2*readushort(f)
+ for i=1,nofglyphs+1 do
+ data[i]=dataoffset+2*readushort(f)
end
end
if noftuples>0 then
@@ -12637,13 +12684,22 @@ function readers.gvar(f,fontdata,specification,glyphdata,shapedata)
tuples[i]=readtuplerecord(f,nofaxis)
end
end
- local lastoffset=false
+ local nextoffset=false
+ local startoffset=data[1]
for i=1,nofglyphs do
- local startoffset=dataoffset+data[i]
- if startoffset==lastoffset then
+ nextoffset=data[i+1]
+ local glyph=glyphdata[i-1]
+ local name=trace_deltas and glyph.name
+ if startoffset==nextoffset then
+ if name then
+ report("no deltas for glyph %a",name)
+ end
else
local shape=shapedata[i-1]
if not shape then
+ if name then
+ report("no shape for glyph %a",name)
+ end
else
lastoffset=startoffset
setposition(f,startoffset)
@@ -12679,7 +12735,7 @@ function readers.gvar(f,fontdata,specification,glyphdata,shapedata)
peak=readtuplerecord(f,nofaxis)
else
if index+1>#tuples then
- print("error, bad index",index)
+ report("error, bad tuple index",index)
end
peak=tuples[index+1]
end
@@ -12725,7 +12781,11 @@ function readers.gvar(f,fontdata,specification,glyphdata,shapedata)
else
end
end
- if s~=0 then
+ if s==0 then
+ if name then
+ report("no deltas applied for glyph %a",name)
+ end
+ else
deltas[#deltas+1]={
factor=s,
points=points,
@@ -12735,12 +12795,13 @@ function readers.gvar(f,fontdata,specification,glyphdata,shapedata)
end
end
if shape.type=="glyph" then
- applyaxis(glyphdata[i],shape,shape.points,deltas)
+ applyaxis(glyph,shape,deltas,dowidth)
else
shape.deltas=deltas
end
end
end
+ startoffset=nextoffset
end
end
end
@@ -12916,7 +12977,7 @@ local lookupflags=setmetatableindex(function(t,k)
end)
local pattern=lpeg.Cf (
lpeg.Ct("")*lpeg.Cg (
- lpeg.C(lpeg.R("az")^1)*lpeg.S(" :=")*(lpeg.patterns.number/tonumber)*lpeg.S(" ,")^0
+ lpeg.C((lpeg.R("az","09")+lpeg.P(" "))^1)*lpeg.S(" :=")*(lpeg.patterns.number/tonumber)*lpeg.S(" ,")^0
)^1,rawset
)
local hash=table.setmetatableindex(function(t,k)
@@ -12962,7 +13023,10 @@ local function getaxisscale(segments,minimum,default,maximum,user)
local e
for i=1,#segments do
local s=segments[i]
- if s[1]>=default then
+ if type(s)~="number" then
+ report("using default axis scale")
+ return default
+ elseif s[1]>=default then
if s[2]==default then
return default
else
@@ -15500,7 +15564,7 @@ function readers.avar(f,fontdata,specification)
local tableoffset=gotodatatable(f,fontdata,"avar",true)
if tableoffset then
local function collect()
- local nofvalues=readulong(f)
+ local nofvalues=readushort(f)
local values={}
local lastfrom=false
local lastto=false
@@ -15510,7 +15574,7 @@ function readers.avar(f,fontdata,specification)
elseif lastto and t>=lastto then
else
values[#values+1]={ f,t }
- lasfrom,lastto=f,t
+ lastfrom,lastto=f,t
end
end
nofvalues=#values
@@ -15519,7 +15583,7 @@ function readers.avar(f,fontdata,specification)
if some[1]==-1 and some[2]==-1 then
some=values[nofvalues]
if some[1]==1 and some[2]==1 then
- for i=2,size-1 do
+ for i=2,nofvalues-1 do
some=values[i]
if some[1]==0 and some[2]==0 then
return values
@@ -15530,9 +15594,10 @@ function readers.avar(f,fontdata,specification)
end
return false
end
- local version=readulong(f)
- local reserved=readulong(f)
- local nofaxis=readulong(f)
+ local majorversion=readushort(f)
+ local minorversion=readushort(f)
+ local reserved=readushort(f)
+ local nofaxis=readushort(f)
local segments={}
for i=1,nofaxis do
segments[i]=collect()
@@ -15645,6 +15710,7 @@ function readers.hvar(f,fontdata,specification)
outerindex[i]=rshift(mapdata,nofinnerbits)
innerindex[i]=band(mapdata,innermask)
end
+ setvariabledata(fontdata,"hvarwidths",true)
local glyphs=fontdata.glyphs
for i=0,fontdata.nofglyphs-1 do
local glyph=glyphs[i]
diff --git a/tex/generic/context/luatex/luatex-math.tex b/tex/generic/context/luatex/luatex-math.tex
index b24902100..a66aa7d7d 100644
--- a/tex/generic/context/luatex/luatex-math.tex
+++ b/tex/generic/context/luatex/luatex-math.tex
@@ -15,7 +15,9 @@
% we provide a remap feature
-\directlua{dofile(kpse.find_file('luatex-math.lua'))}
+\ifdefined\directlua
+ \directlua{dofile(kpse.find_file('luatex-math.lua'))}
+\fi
% a bunch of fonts:
@@ -55,8 +57,8 @@
\font\sevenrm = file:lucidabrightot.otf:+liga;+kern;+tlig;+trep at 7pt
\font\fiverm = file:lucidabrightot.otf:+liga;+kern;+tlig;+trep at 5pt
%
- \font\tentt = file:lucidabrightot.otf at 10pt
- \font\tenit = file:lucidabrightot.otf:+liga;+kern;+tlig;+trep at 10pt
+ \font\tentt = file:lucidasanstypewriterot.otf at 10pt
+ \font\tensl = file:lucidabrightot.otf:slant=0.2;+liga;+kern;+tlig;+trep at 10pt
\font\tenit = file:lucidabrightot-italic.otf:+liga;+kern;+tlig;+trep at 10pt
\font\tenbf = file:lucidabrightot-demi.otf:+liga;+kern;+tlig;+trep at 10pt
\font\tenbi = file:lucidabrightot-demiitalic.otf:+liga;+kern;+tlig;+trep at 10pt
@@ -71,13 +73,15 @@
%
\tenrm}
-\directlua {
- if arguments["mtx:lucidabright"] then
- tex.print("\string\\lucidabright")
- else
- tex.print("\string\\latinmodern")
- end
-}
+\ifdefined\directlua
+ \directlua {
+ if arguments["mtx:lucidabright"] then
+ tex.print("\string\\lucidabright")
+ else
+ tex.print("\string\\latinmodern")
+ end
+ }
+\fi
\newtoks\everymathrm
\newtoks\everymathmit
@@ -1849,26 +1853,34 @@
\let\OE Œ
\let\O Ø
\let\i ı
+\let\j ȷ
\let\aa å
\let\l ł
\let\L Ł
\let\AA Å
\let\copyright ©
+\let\S §
+\let\P ¶
+\let\dag †
+\let\ddag ‡
+\let\pounds £
% just use utf
-\def\`#1{\string\`\string{#1\string}}
-\def\'#1{\string\'\string{#1\string}}
-\def\v#1{\string\v\string{#1\string}}
-\def\u#1{\string\u\string{#1\string}}
-\def\=#1{\string\=\string{#1\string}}
-\def\^#1{\string\^\string{#1\string}}
-\def\.#1{\string\.\string{#1\string}}
-\def\H#1{\string\H\string{#1\string}}
-\def\~#1{\string\~\string{#1\string}}
-\def\"#1{\string\"\string{#1\string}}
-\def\d#1{\string\d\string{#1\string}}
-\def\b#1{\string\b\string{#1\string}}
-\def\c#1{\string\c\string{#1\string}}
+\def\`#1{#1^^^^0300}
+\def\'#1{#1^^^^0301}
+\def\^#1{#1^^^^0302}
+\def\~#1{#1^^^^0303}
+\def\=#1{#1^^^^0304}
+\def\u#1{#1^^^^0306}
+\def\.#1{#1^^^^0307}
+\def\"#1{#1^^^^0308}
+\def\r#1{#1^^^^030a} % not in plain
+\def\H#1{#1^^^^030b}
+\def\v#1{#1^^^^030c}
+\def\d#1{#1^^^^0323}
+\def\c#1{#1^^^^0327}
+\def\k#1{#1^^^^0328} % not in plain
+\def\b#1{#1^^^^0331}
\endinput