summaryrefslogtreecommitdiff
path: root/tex/generic
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/generic
parent57c3891a6b93b57f91ea77c9bbecffacbcc0da28 (diff)
downloadcontext-2498bbe606e7cca22799e33dc29ae5160693b3d8.tar.gz
2017-05-09 10:20:00
Diffstat (limited to 'tex/generic')
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua134
-rw-r--r--tex/generic/context/luatex/luatex-math.tex58
2 files changed, 135 insertions, 57 deletions
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