summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-merged.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luaotfload/luaotfload-merged.lua')
-rw-r--r--Master/texmf-dist/tex/luatex/luaotfload/luaotfload-merged.lua118
1 files changed, 90 insertions, 28 deletions
diff --git a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-merged.lua b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-merged.lua
index bf22bac29e3..008b02af7ab 100644
--- a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-merged.lua
+++ b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 04/29/13 20:30:03
+-- merge date : 05/10/13 15:05:28
do -- begin closure to overcome local limits and interference
@@ -4586,7 +4586,7 @@ local floor=math.floor
local trace_loading=false trackers.register("fonts.loading",function(v) trace_loading=v end)
local trace_mapping=false trackers.register("fonts.mapping",function(v) trace_unimapping=v end)
local report_fonts=logs.reporter("fonts","loading")
-local fonts=fonts
+local fonts=fonts or {}
local mappings=fonts.mappings or {}
fonts.mappings=mappings
local function loadlumtable(filename)
@@ -4602,7 +4602,7 @@ local function loadlumtable(filename)
end
local hex=R("AF","09")
local hexfour=(hex*hex*hex*hex)/function(s) return tonumber(s,16) end
-local hexsix=(hex^1)/function(s) return tonumber(s,16) end
+local hexsix=(hex*hex*hex*hex*hex*hex)/function(s) return tonumber(s,16) end
local dec=(R("09")^1)/tonumber
local period=P(".")
local unicode=P("uni")*(hexfour*(period+P(-1))*Cc(false)+Ct(hexfour^1)*Cc(true))
@@ -4622,16 +4622,16 @@ local function makenameparser(str)
return p
end
end
-local function tounicode16(unicode)
+local function tounicode16(unicode,name)
if unicode<0x10000 then
return format("%04X",unicode)
elseif unicode<0x1FFFFFFFFF then
return format("%04X%04X",floor(unicode/1024),unicode%1024+0xDC00)
else
- report_fonts("can't convert %a into tounicode",unicode)
+ report_fonts("can't convert %a in %a into tounicode",unicode,name)
end
end
-local function tounicode16sequence(unicodes)
+local function tounicode16sequence(unicodes,name)
local t={}
for l=1,#unicodes do
local unicode=unicodes[l]
@@ -4640,7 +4640,7 @@ local function tounicode16sequence(unicodes)
elseif unicode<0x1FFFFFFFFF then
t[l]=format("%04X%04X",floor(unicode/1024),unicode%1024+0xDC00)
else
- report_fonts ("can't convert %a into tounicode",unicode)
+ report_fonts ("can't convert %a in %a into tounicode",unicode,name)
end
end
return concat(t)
@@ -4702,7 +4702,7 @@ function mappings.addtounicode(data,filename)
local unicode=lumunic and lumunic[name] or unicodevector[name]
if unicode then
originals[index]=unicode
- tounicode[index]=tounicode16(unicode)
+ tounicode[index]=tounicode16(unicode,name)
ns=ns+1
end
if (not unicode) and usedmap then
@@ -4711,7 +4711,7 @@ function mappings.addtounicode(data,filename)
unicode=cidcodes[foundindex]
if unicode then
originals[index]=unicode
- tounicode[index]=tounicode16(unicode)
+ tounicode[index]=tounicode16(unicode,name)
ns=ns+1
else
local reference=cidnames[foundindex]
@@ -4721,11 +4721,11 @@ function mappings.addtounicode(data,filename)
unicode=cidcodes[foundindex]
if unicode then
originals[index]=unicode
- tounicode[index]=tounicode16(unicode)
+ tounicode[index]=tounicode16(unicode,name)
ns=ns+1
end
end
- if not unicode then
+ if not unicode or unicode=="" then
local foundcodes,multiple=lpegmatch(uparser,reference)
if foundcodes then
originals[index]=foundcodes
@@ -4734,7 +4734,7 @@ function mappings.addtounicode(data,filename)
nl=nl+1
unicode=true
else
- tounicode[index]=tounicode16(foundcodes)
+ tounicode[index]=tounicode16(foundcodes,name)
ns=ns+1
unicode=foundcodes
end
@@ -4744,7 +4744,7 @@ function mappings.addtounicode(data,filename)
end
end
end
- if not unicode then
+ if not unicode or unicode=="" then
local split=lpegmatch(ligsplitter,name)
local nplit=split and #split or 0
if nplit>=2 then
@@ -4765,7 +4765,7 @@ function mappings.addtounicode(data,filename)
if n==0 then
elseif n==1 then
originals[index]=t[1]
- tounicode[index]=tounicode16(t[1])
+ tounicode[index]=tounicode16(t[1],name)
else
originals[index]=t
tounicode[index]=tounicode16sequence(t)
@@ -4775,17 +4775,17 @@ function mappings.addtounicode(data,filename)
else
end
end
- if not unicode then
+ if not unicode or unicode=="" then
local foundcodes,multiple=lpegmatch(uparser,name)
if foundcodes then
if multiple then
originals[index]=foundcodes
- tounicode[index]=tounicode16sequence(foundcodes)
+ tounicode[index]=tounicode16sequence(foundcodes,name)
nl=nl+1
unicode=true
else
originals[index]=foundcodes
- tounicode[index]=tounicode16(foundcodes)
+ tounicode[index]=tounicode16(foundcodes,name)
ns=ns+1
unicode=foundcodes
end
@@ -5046,7 +5046,7 @@ local report_otf=logs.reporter("fonts","otf loading")
local fonts=fonts
local otf=fonts.handlers.otf
otf.glists={ "gsub","gpos" }
-otf.version=2.742
+otf.version=2.743
otf.cache=containers.define("fonts","otf",otf.version,true)
local fontdata=fonts.hashes.identifiers
local chardata=characters and characters.data
@@ -5065,6 +5065,7 @@ local usemetatables=false
local packdata=true
local syncspace=true
local forcenotdef=false
+local includesubfonts=false
local wildcard="*"
local default="dflt"
local fontloaderfields=fontloader.fields
@@ -5191,8 +5192,8 @@ local ordered_enhancers={
"check glyphs",
"check metadata",
"check extra features",
- "add duplicates",
"check encoding",
+ "add duplicates",
"cleanup tables",
}
local actions=allocate()
@@ -5536,7 +5537,7 @@ actions["prepare glyphs"]=function(data,filename,raw)
local duplicates=resources.duplicates
local variants=resources.variants
if rawsubfonts then
- metadata.subfonts={}
+ metadata.subfonts=includesubfonts and {}
properties.cidinfo=rawcidinfo
if rawcidinfo.registry then
local cidmap=fonts.cid.getmap(rawcidinfo)
@@ -5547,7 +5548,9 @@ actions["prepare glyphs"]=function(data,filename,raw)
for cidindex=1,#rawsubfonts do
local subfont=rawsubfonts[cidindex]
local cidglyphs=subfont.glyphs
- metadata.subfonts[cidindex]=somecopy(subfont)
+ if includesubfonts then
+ metadata.subfonts[cidindex]=somecopy(subfont)
+ end
for index=0,subfont.glyphcnt-1 do
local glyph=cidglyphs[index]
if glyph then
@@ -5556,6 +5559,10 @@ actions["prepare glyphs"]=function(data,filename,raw)
if not unicode or unicode==-1 or unicode>=criterium then
unicode=cidunicodes[index]
end
+ if unicode and descriptions[unicode] then
+ report_otf("preventing glyph %a at index %H to overload unicode %U",name or "noname",index,unicode)
+ unicode=-1
+ end
if not unicode or unicode==-1 or unicode>=criterium then
if not name then
name=format("u%06X",private)
@@ -5659,7 +5666,8 @@ actions["check encoding"]=function(data,filename,raw)
local resources=data.resources
local properties=data.properties
local unicodes=resources.unicodes
- local indices=resources.indices
+ local indices=resources.indices
+ local duplicates=resources.duplicates
local mapdata=raw.map or {}
local unicodetoindex=mapdata and mapdata.map or {}
local encname=lower(data.enc_name or mapdata.enc_name or "")
@@ -5671,10 +5679,35 @@ actions["check encoding"]=function(data,filename,raw)
for unicode,index in next,unicodetoindex do
if unicode<=criterium and not descriptions[unicode] then
local parent=indices[index]
- if parent then
- report_otf("weird, unicode %U points to %U with index %H",unicode,parent,index)
- else
+ if not parent then
report_otf("weird, unicode %U points to nowhere with index %H",unicode,index)
+ else
+ local parentdescription=descriptions[parent]
+ if parentdescription then
+ local altuni=parentdescription.altuni
+ if not altuni then
+ altuni={ { unicode=parent } }
+ parentdescription.altuni=altuni
+ duplicates[parent]={ unicode }
+ else
+ local done=false
+ for i=1,#altuni do
+ if altuni[i].unicode==parent then
+ done=true
+ break
+ end
+ end
+ if not done then
+ altuni[#altuni+1]={ unicode=parent }
+ table.insert(duplicates[parent],unicode)
+ end
+ end
+ if trace_loading then
+ report_otf("weird, unicode %U points to nowhere with index %H",unicode,index)
+ end
+ else
+ report_otf("weird, unicode %U points to %U with index %H",unicode,index)
+ end
end
end
end
@@ -8468,16 +8501,18 @@ local function toligature(kind,lookupname,head,start,stop,char,markflag,discfoun
logwarning("%s: keep mark %s, gets index %s",pref(kind,lookupname),gref(char),start[a_ligacomp])
end
head,current=insert_node_after(head,current,copy_node(start))
+ elseif trace_marks then
+ logwarning("%s: delete mark %s",pref(kind,lookupname),gref(char))
end
start=start.next
end
- local start=components
- while start and start.id==glyph_code do
+ local start=current.next
+ while start and start.id==glyph_code do
local char=start.char
if marks[char] then
start[a_ligacomp]=baseindex+(start[a_ligacomp] or componentindex)
if trace_marks then
- logwarning("%s: keep mark %s, gets index %s",pref(kind,lookupname),gref(char),start[a_ligacomp])
+ logwarning("%s: set mark %s, gets index %s",pref(kind,lookupname),gref(char),start[a_ligacomp])
end
else
break
@@ -8751,6 +8786,10 @@ function handlers.gpos_mark2ligature(head,start,kind,lookupname,markanchors,sequ
pref(kind,lookupname),anchor,index,bound,gref(markchar),gref(basechar),index,dx,dy)
end
return head,start,true
+ else
+ if trace_bugs then
+ logwarning("%s: no matching anchors for mark %s and baselig %s with index %a",pref(kind,lookupname),gref(markchar),gref(basechar),index)
+ end
end
end
end
@@ -10685,6 +10724,12 @@ local function packdata(data)
end
end
end
+ local altuni=description.altuni
+ if altuni then
+ for i=1,#altuni do
+ altuni[i]=pack_flat(altuni[i])
+ end
+ end
end
local lookups=data.lookups
if lookups then
@@ -10789,6 +10834,10 @@ local function packdata(data)
mlookups[tag]=pack_normal(mlookup)
end
end
+ local altuni=description.altuni
+ if altuni then
+ description.altuni=pack_normal(altuni)
+ end
end
local lookups=data.lookups
if lookups then
@@ -10980,6 +11029,19 @@ local function unpackdata(data)
end
end
end
+ local altuni=description.altuni
+ if altuni then
+ local altuni=tables[altuni]
+ if altuni then
+ description.altuni=altuni
+ for i=1,#altuni do
+ local tv=tables[altuni[i]]
+ if tv then
+ altuni[i]=tv
+ end
+ end
+ end
+ end
end
local lookups=data.lookups
if lookups then