summaryrefslogtreecommitdiff
path: root/tex/generic/context/luatex/luatex-fonts-merged.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/generic/context/luatex/luatex-fonts-merged.lua')
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua234
1 files changed, 182 insertions, 52 deletions
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index b8a21fc93..a0a45c63d 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 : 10/29/19 15:00:00
+-- merge date : 11/12/19 18:49:12
do -- begin closure to overcome local limits and interference
@@ -20,9 +20,6 @@ if LUAVERSION<5.2 and jit then
MINORVERSION=2
LUAVERSION=5.2
end
-if lua and lua.openfile then
- io.open=lua.openfile
-end
if not lpeg then
lpeg=require("lpeg")
end
@@ -9032,6 +9029,7 @@ function constructors.scale(tfmdata,specification)
properties.direction=direction
target.size=scaledpoints
target.encodingbytes=properties.encodingbytes or 1
+ target.subfont=properties.subfont
target.embedding=properties.embedding or "subset"
target.tounicode=1
target.cidinfo=properties.cidinfo
@@ -9524,6 +9522,7 @@ function constructors.finalize(tfmdata)
properties.name=properties.name or tfmdata.name
properties.psname=properties.psname or tfmdata.psname
properties.encodingbytes=tfmdata.encodingbytes or 1
+ properties.subfont=tfmdata.subfont or nil
properties.embedding=tfmdata.embedding or "subset"
properties.tounicode=tfmdata.tounicode or 1
properties.cidinfo=tfmdata.cidinfo or nil
@@ -9549,6 +9548,7 @@ function constructors.finalize(tfmdata)
tfmdata.name=nil
tfmdata.psname=nil
tfmdata.encodingbytes=nil
+ tfmdata.subfont=nil
tfmdata.embedding=nil
tfmdata.tounicode=nil
tfmdata.cidinfo=nil
@@ -13981,7 +13981,7 @@ if not modules then modules={} end modules ['font-cff']={
license="see context related readme files"
}
local next,type,tonumber,rawget=next,type,tonumber,rawget
-local byte,char,gmatch=string.byte,string.char,string.gmatch
+local byte,char,gmatch,sub=string.byte,string.char,string.gmatch,string.sub
local concat,remove,unpack=table.concat,table.remove,table.unpack
local floor,abs,round,ceil,min,max=math.floor,math.abs,math.round,math.ceil,math.min,math.max
local P,C,R,S,C,Cs,Ct=lpeg.P,lpeg.C,lpeg.R,lpeg.S,lpeg.C,lpeg.Cs,lpeg.Ct
@@ -14088,6 +14088,37 @@ local defaultstrings={ [0]=
"Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003",
"Black","Bold","Book","Light","Medium","Regular","Roman","Semibold",
}
+local standardnames={ [0]=
+ false,false,false,false,false,false,false,false,false,false,false,
+ false,false,false,false,false,false,false,false,false,false,false,
+ false,false,false,false,false,false,false,false,false,false,
+ "space","exclam","quotedbl","numbersign","dollar","percent",
+ "ampersand","quoteright","parenleft","parenright","asterisk","plus",
+ "comma","hyphen","period","slash","zero","one","two","three","four",
+ "five","six","seven","eight","nine","colon","semicolon","less",
+ "equal","greater","question","at","A","B","C","D","E","F","G","H",
+ "I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W",
+ "X","Y","Z","bracketleft","backslash","bracketright","asciicircum",
+ "underscore","quoteleft","a","b","c","d","e","f","g","h","i","j",
+ "k","l","m","n","o","p","q","r","s","t","u","v","w","x","y",
+ "z","braceleft","bar","braceright","asciitilde",false,false,false,
+ false,false,false,false,false,false,false,false,false,false,false,
+ false,false,false,false,false,false,false,false,false,false,false,
+ false,false,false,false,false,false,false,false,false,"exclamdown",
+ "cent","sterling","fraction","yen","florin","section","currency",
+ "quotesingle","quotedblleft","guillemotleft","guilsinglleft",
+ "guilsinglright","fi","fl",false,"endash","dagger","daggerdbl",
+ "periodcentered",false,"paragraph","bullet","quotesinglbase",
+ "quotedblbase","quotedblright","guillemotright","ellipsis","perthousand",
+ false,"questiondown",false,"grave","acute","circumflex","tilde",
+ "macron","breve","dotaccent","dieresis",false,"ring","cedilla",false,
+ "hungarumlaut","ogonek","caron","emdash",false,false,false,false,
+ false,false,false,false,false,false,false,false,false,false,false,
+ false,"AE",false,"ordfeminine",false,false,false,false,"Lslash",
+ "Oslash","OE","ordmasculine",false,false,false,false,false,"ae",
+ false,false,false,"dotlessi",false,false,"lslash","oslash","oe",
+ "germandbls",false,false,false,false
+}
local cffreaders={
readbyte,
readushort,
@@ -14449,6 +14480,7 @@ do
local x=0
local y=0
local width=false
+ local lsb=0
local r=0
local stems=0
local globalbias=0
@@ -14472,6 +14504,9 @@ do
local factors=false
local axis=false
local vsindex=0
+ local justpass=false
+ local seacs={}
+ local procidx=nil
local function showstate(where)
report("%w%-10s : [%s] n=%i",depth*2,where,concat(stack," ",1,top),top)
end
@@ -15011,14 +15046,14 @@ do
top=0
end
local function divide()
- if version==1 then
+ if version=="cff" then
local d=stack[top]
top=top-1
stack[top]=stack[top]/d
end
end
local function closepath()
- if version==1 then
+ if version=="cff" then
if trace_charstrings then
showstate("closepath")
end
@@ -15026,54 +15061,65 @@ do
top=0
end
local function hsbw()
- if version==1 then
+ if version=="cff" then
if trace_charstrings then
showstate("hsbw")
end
+ lsb=stack[top-1] or 0
width=stack[top]
end
top=0
end
- local function seac()
- if version==1 then
+ local function sbw()
+ if version=="cff" then
if trace_charstrings then
- showstate("seac")
+ showstate("sbw")
end
+ lsb=stack[top-3]
+ width=stack[top-1]
end
top=0
end
- local function sbw()
- if version==1 then
+ local function seac()
+ if version=="cff" then
if trace_charstrings then
- showstate("sbw")
+ showstate("seac")
end
- width=stack[top-1]
end
top=0
end
+ local popped=3
+ local hints=3
local function callothersubr()
- if version==1 then
+ if version=="cff" then
if trace_charstrings then
- showstate("callothersubr (unsupported)")
+ showstate("callothersubr")
end
+ if stack[top]==hints then
+ popped=stack[top-2]
+ else
+ popped=3
+ end
+ top=top-(stack[top-1]+2)
+ else
+ top=0
end
- top=0
end
local function pop()
- if version==1 then
+ if version=="cff" then
if trace_charstrings then
- showstate("pop (unsupported)")
+ showstate("pop")
end
top=top+1
- stack[top]=0
+ stack[top]=popped
else
top=0
end
end
local function setcurrentpoint()
- if version==1 then
+ if version=="cff" then
if trace_charstrings then
- showstate("pop (unsupported)")
+ showstate("setcurrentpoint (unsupported)")
end
x=x+stack[top-1]
y=y+stack[top]
@@ -15199,6 +15245,39 @@ do
vhcurveto,
hvcurveto,
}
+ local reverse={ [0]="unsupported",
+ "getstem",
+ "unsupported",
+ "getstem",
+ "vmoveto",
+ "rlineto",
+ "hlineto",
+ "vlineto",
+ "rrcurveto",
+ "unsupported",
+ "unsupported",
+ "unsupported",
+ "unsupported",
+ "hsbw",
+ "unsupported",
+ "setvsindex",
+ "blend",
+ "unsupported",
+ "getstem",
+ "getmask",
+ "getmask",
+ "rmoveto",
+ "hmoveto",
+ "getstem",
+ "rcurveline",
+ "rlinecurve",
+ "vvcurveto",
+ "hhcurveto",
+ "unsupported",
+ "unsupported",
+ "vhcurveto",
+ "hvcurveto",
+ }
local subactions={
[000]=dotsection,
[001]=getstem3,
@@ -15312,7 +15391,7 @@ do
local function call(scope,list,bias)
depth=depth+1
if top==0 then
- showstate(formatters["unknown %s call %s"](scope,"?"))
+ showstate(formatters["unknown %s call %s, case %s"](scope,"?",1))
top=0
else
local index=stack[top]+bias
@@ -15324,13 +15403,12 @@ do
if tab then
process(tab)
else
- showstate(formatters["unknown %s call %s"](scope,index))
+ showstate(formatters["unknown %s call %s, case %s"](scope,index,2))
top=0
end
end
depth=depth-1
end
- local justpass=false
process=function(tab)
local i=1
local n=#tab
@@ -15401,6 +15479,17 @@ do
r=r+1;result[r]=chars[12]
r=r+1;result[r]=chars[t]
top=0
+ elseif t==6 then
+ seacs[procidx]={
+ asb=stack[1],
+ adx=stack[2],
+ ady=stack[3],
+ base=stack[4],
+ accent=stack[5],
+ width=width,
+ lsb=lsb,
+ }
+ top=0
else
local a=subactions[t]
if a then
@@ -15430,44 +15519,52 @@ do
i=i+s+1
elseif t==1 or t==3 or t==18 or operation==23 then
p_getstem()
-if true then
- if top>0 then
- for i=1,top do
- r=r+1;result[r]=encode[stack[i]]
+ if true then
+ if top>0 then
+ for i=1,top do
+ r=r+1;result[r]=encode[stack[i]]
+ end
+ top=0
end
+ r=r+1;result[r]=chars[t]
+ else
top=0
end
- r=r+1;result[r]=chars[t]
-else
- top=0
-end
i=i+1
elseif t==19 or t==20 then
local s=p_getmask() or 0
-if true then
- if top>0 then
- for i=1,top do
- r=r+1;result[r]=encode[stack[i]]
+ if true then
+ if top>0 then
+ for i=1,top do
+ r=r+1;result[r]=encode[stack[i]]
+ end
+ top=0
end
+ r=r+1;result[r]=chars[t]
+ for j=1,s do
+ i=i+1
+ r=r+1;result[r]=chars[tab[i]]
+ end
+ else
+ i=i+s
top=0
end
- r=r+1;result[r]=chars[t]
- for j=1,s do
- i=i+1
- r=r+1;result[r]=chars[tab[i]]
- end
-else
- i=i+s
- top=0
-end
i=i+1
elseif t==9 then
top=0
i=i+1
elseif t==13 then
- local s=hsbw() or 0
- i=i+s+1
+ hsbw()
+ if version=="cff" then
+ r=r+1;result[r]=encode[lsb]
+ r=r+1;result[r]=chars[22]
+ else
+ end
+ i=i+1
else
+ if trace_charstrings then
+ showstate(reverse[t] or "<action>")
+ end
if top>0 then
for i=1,top do
r=r+1;result[r]=encode[stack[i]]
@@ -15488,7 +15585,7 @@ end
end
else
if trace_charstrings then
- showvalue("<action>",t)
+ showstate(reverse[t] or "<action>")
end
top=0
i=i+1
@@ -15507,7 +15604,7 @@ end
((l<1240 and 107) or (l<33900 and 1131) or 32768)+1
end
end
- local function processshape(tab,index)
+ local function processshape(tab,index,hack)
if not tab then
glyphs[index]={
boundingbox={ 0,0,0,0 },
@@ -15520,10 +15617,13 @@ end
x=0
y=0
width=false
+ lsb=0
r=0
top=0
stems=0
result={}
+ popped=3
+ procidx=index
xmin=0
xmax=0
ymin=0
@@ -15537,6 +15637,9 @@ end
updateregions(vsindex)
end
process(tab)
+ if hack then
+ return x,y
+ end
local boundingbox={
round(xmin),
round(ymin),
@@ -15591,6 +15694,8 @@ end
axis=false
regions=data.regions
justpass=streams==true
+ popped=3
+ seacs={}
if regions then
regions={ regions }
axis=data.factors or false
@@ -15604,6 +15709,8 @@ end
locals=false
globals=false
strings=false
+ popped=3
+ seacs={}
end
local function setwidths(private)
if not private then
@@ -15633,6 +15740,29 @@ end
for index=1,#charstrings do
processshape(charstrings[index],index-1)
end
+ if justpass and next(seacs) then
+ local charset=data.dictionaries[1].charset
+ if charset then
+ local lookup=table.swapped(charset)
+ for index,v in next,seacs do
+ local bindex=lookup[standardnames[v.base]]
+ local aindex=lookup[standardnames[v.accent]]
+ local bglyph=bindex and glyphs[bindex]
+ local aglyph=aindex and glyphs[aindex]
+ if bglyph and aglyph then
+ local jp=justpass
+ justpass=false
+ local x,y=processshape(charstrings[bindex+1],bindex,true)
+ justpass=jp
+ local base=bglyph.stream
+ local accent=aglyph.stream
+ local moveto=encode[-x-v.asb+v.adx]..chars[22]..encode[-y+v.ady]..chars[ 4]
+ base=sub(base,1,#base-1)
+ glyphs[index].stream=base..moveto..accent
+ end
+ end
+ end
+ end
stopparsing(fontdata,data)
else
report("no charstrings")
@@ -15649,6 +15779,7 @@ end
vsindex=dictionary.vsindex or 0
glyphs=glphs or {}
justpass=streams==true
+ seacs={}
globalbias,localbias=setbias(globals,locals,nobias)
nominalwidth,defaultwidth=setwidths(dictionary.private)
processshape(tab,index-1)
@@ -32380,7 +32511,6 @@ do
local pdfshapes={}
local inkscape=runner()
if inkscape then
- local indices=fonts.getindices(tfmdata)
local descriptions=tfmdata.descriptions
local nofshapes=#svgshapes
local f_svgfile=formatters["temp-otf-svg-shape-%i.svg"]