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.lua470
1 files changed, 262 insertions, 208 deletions
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 4c5bc8b00..36893a527 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 : 2021-06-14 17:06
+-- merge date : 2021-06-24 18:50
do -- begin closure to overcome local limits and interference
@@ -4202,20 +4202,20 @@ function files.readinteger4le(f)
end
end
function files.readfixed2(f)
- local a,b=byte(f:read(2),1,2)
- if a>=0x80 then
- tonumber((a-0x100).."."..b)
- else
- tonumber((a ).."."..b)
+ local n1,n2=byte(f:read(2),1,2)
+ if n1>=0x80 then
+ n1=n1-0x100
end
+ return n1+n2/0xFF
end
function files.readfixed4(f)
local a,b,c,d=byte(f:read(4),1,4)
- if a>=0x80 then
- tonumber((0x100*a+b-0x10000).."."..(0x100*c+d))
- else
- tonumber((0x100*a+b ).."."..(0x100*c+d))
+ local n1=0x100*a+b
+ local n2=0x100*c+d
+ if n1>=0x8000 then
+ n1=n1-0x10000
end
+ return n1+n2/0xFFFF
end
if bit32 then
local extract=bit32.extract
@@ -11762,7 +11762,7 @@ readers.post=function(f,fontdata,specification)
local version=readulong(f)
fontdata.postscript={
version=version,
- italicangle=round(1000*readfixed(f))/1000,
+ italicangle=readfixed(f),
underlineposition=readfword(f),
underlinethickness=readfword(f),
monospaced=readulong(f),
@@ -13339,7 +13339,8 @@ do
top=0
end
local p_dictionary=(
- p_byte+p_positive+p_negative+p_short+p_long+p_nibbles+p_single+p_double+p_unsupported
+ p_byte+p_positive+p_negative+p_short+p_long+p_nibbles+p_single+p_double
++p_unsupported
)^1
parsedictionaries=function(data,dictionaries,version)
stack={}
@@ -14365,12 +14366,12 @@ do
stack[top]=-t*256+64148-tab[i+1]
i=i+2
else
- local n=0x100*tab[i+1]+tab[i+2]
- if n>=0x8000 then
- stack[top]=n-0x10000+(0x100*tab[i+3]+tab[i+4])/0xFFFF
- else
- stack[top]=n+(0x100*tab[i+3]+tab[i+4])/0xFFFF
+ local n1=0x100*tab[i+1]+tab[i+2]
+ local n2=0x100*tab[i+3]+tab[i+4]
+ if n1>=0x8000 then
+ n1=n1-0x10000
end
+ stack[top]=n1+n2/0xFFFF
i=i+5
end
elseif t==28 then
@@ -21063,7 +21064,7 @@ local function copytotfm(data,cache_id)
local properties=derivetable(data.properties)
local descriptions=derivetable(data.descriptions)
local goodies=derivetable(data.goodies)
- local characters={}
+ local characters={}
local parameters={}
local mathparameters={}
local resources=data.resources
@@ -30398,6 +30399,7 @@ local function validspecification(specification,name)
else
dataset={ { data=specification.data } }
specification.data=nil
+ specification.coverage=dataset
specification.dataset=dataset
end
local first=dataset[1]
@@ -30697,7 +30699,28 @@ local function addfeature(data,feature,specifications)
return coverage
end
local prepare_single=prepare_pair
- local function prepare_chain(list,featuretype,sublookups)
+ local function hassteps(lookups)
+ if lookups then
+ for i=1,#lookups do
+ local l=lookups[i]
+ if l then
+ for j=1,#l do
+ local l=l[j]
+ if l then
+ local n=l.nofsteps
+ if not n then
+ return true
+ elseif n>0 then
+ return true
+ end
+ end
+ end
+ end
+ end
+ end
+ return false
+ end
+ local function prepare_chain(list,featuretype,sublookups,nocheck)
local rules=list.rules
local coverage={}
if rules then
@@ -30733,6 +30756,7 @@ local function addfeature(data,feature,specifications)
local lookups=rule.lookups or false
local subtype=nil
if lookups and sublookups then
+ local l={}
for k,v in sortedhash(lookups) do
local t=type(v)
if t=="table" then
@@ -30742,55 +30766,63 @@ local function addfeature(data,feature,specifications)
v[i]={ vi }
end
end
+ l[k]=v
elseif t=="number" then
local lookup=sublookups[v]
if lookup then
- lookups[k]={ lookup }
+ l[k]={ lookup }
if not subtype then
subtype=lookup.type
end
elseif v==0 then
- lookups[k]={ { type="gsub_remove" } }
+ l[k]={ { type="gsub_remove",nosteps=true } }
else
- lookups[k]=false
+ l[k]=false
end
else
- lookups[k]=false
+ l[k]=false
end
end
+ if nocheck then
+ rule.lookups=l
+ end
+ lookups=l
end
if nofsequences>0 then
- local hashed={}
- for i=1,nofsequences do
- local t={}
- local s=sequence[i]
- for i=1,#s do
- local u=tounicode(s[i])
- if u then
- t[u]=true
+ if hassteps(lookups) then
+ local hashed={}
+ for i=1,nofsequences do
+ local t={}
+ local s=sequence[i]
+ for i=1,#s do
+ local u=tounicode(s[i])
+ if u then
+ t[u]=true
+ end
+ end
+ hashed[i]=t
+ end
+ sequence=hashed
+ rulesize=rulesize+1
+ rulehash[rulesize]={
+ nofrules,
+ lookuptype,
+ sequence,
+ start,
+ stop,
+ lookups,
+ replacements,
+ subtype,
+ }
+ for unic in sortedhash(sequence[start]) do
+ local cu=coverage[unic]
+ if not cu then
+ coverage[unic]=rulehash
end
end
- hashed[i]=t
- end
- sequence=hashed
- rulesize=rulesize+1
- rulehash[rulesize]={
- nofrules,
- lookuptype,
- sequence,
- start,
- stop,
- lookups,
- replacements,
- subtype,
- }
- for unic in sortedhash(sequence[start]) do
- local cu=coverage[unic]
- if not cu then
- coverage[unic]=rulehash
- end
+ sequence.n=nofsequences
+ else
end
- sequence.n=nofsequences
end
end
rulehash.n=rulesize
@@ -30877,126 +30909,148 @@ local function addfeature(data,feature,specifications)
end
local askedfeatures=specification.features or everywhere
local askedsteps=specification.steps or specification.subtables or { specification.data } or {}
- local featuretype=normalized[specification.type or "substitution"] or "substitution"
+ local featuretype=specification.type or "substitution"
+ local featureaction=false
local featureflags=specification.flags or noflags
local nocheck=specification.nocheck
+ local mapping=specification.mapping
local featureorder=specification.order or { feature }
local featurechain=(featuretype=="chainsubstitution" or featuretype=="chainposition") and 1 or 0
local nofsteps=0
local steps={}
local sublookups=specification.lookups
local category=nil
+ local steptype=nil
+ local sequence=nil
+ if fonts.handlers.otf.handlers[featuretype] then
+ featureaction=true
+ else
+ featuretype=normalized[specification.type or "substitution"] or "substitution"
+ end
checkflags(specification,resources)
- if sublookups then
- local s={}
- for i=1,#sublookups do
- local specification=sublookups[i]
- local askedsteps=specification.steps or specification.subtables or { specification.data } or {}
- local featuretype=normalized[specification.type or "substitution"] or "substitution"
- local featureflags=specification.flags or noflags
- local nofsteps=0
- local steps={}
- for i=1,#askedsteps do
- local list=askedsteps[i]
- local coverage=nil
- local format=nil
- if featuretype=="substitution" then
- coverage=prepare_substitution(list,featuretype,nocheck)
- elseif featuretype=="ligature" then
- coverage=prepare_ligature(list,featuretype,nocheck)
- elseif featuretype=="alternate" then
- coverage=prepare_alternate(list,featuretype,nocheck)
- elseif featuretype=="multiple" then
- coverage=prepare_multiple(list,featuretype,nocheck)
- elseif featuretype=="kern" or featuretype=="move" then
- format=featuretype
- coverage=prepare_kern(list,featuretype)
- elseif featuretype=="pair" then
- format="pair"
- coverage=prepare_pair(list,featuretype)
- elseif featuretype=="single" then
- format="single"
- coverage=prepare_single(list,featuretype)
- end
- if coverage and next(coverage) then
- nofsteps=nofsteps+1
- steps[nofsteps]=register(coverage,featuretype,format,feature,nofsteps,descriptions,resources)
+ for k,v in next,askedfeatures do
+ if v[1] then
+ askedfeatures[k]=tohash(v)
+ end
+ end
+ if featureflags[1] then featureflags[1]="mark" end
+ if featureflags[2] then featureflags[2]="ligature" end
+ if featureflags[3] then featureflags[3]="base" end
+ if featureaction then
+ category="gsub"
+ sequence={
+ features={ [feature]=askedfeatures },
+ flags=featureflags,
+ name=feature,
+ order=featureorder,
+ type=featuretype,
+ nofsteps=0,
+ }
+ else
+ if sublookups then
+ local s={}
+ for i=1,#sublookups do
+ local specification=sublookups[i]
+ local askedsteps=specification.steps or specification.subtables or { specification.data } or {}
+ local featuretype=normalized[specification.type or "substitution"] or "substitution"
+ local featureflags=specification.flags or noflags
+ local nofsteps=0
+ local steps={}
+ for i=1,#askedsteps do
+ local list=askedsteps[i]
+ local coverage=nil
+ local format=nil
+ if featuretype=="substitution" then
+ coverage=prepare_substitution(list,featuretype,nocheck)
+ elseif featuretype=="ligature" then
+ coverage=prepare_ligature(list,featuretype,nocheck)
+ elseif featuretype=="alternate" then
+ coverage=prepare_alternate(list,featuretype,nocheck)
+ elseif featuretype=="multiple" then
+ coverage=prepare_multiple(list,featuretype,nocheck)
+ elseif featuretype=="kern" or featuretype=="move" then
+ format=featuretype
+ coverage=prepare_kern(list,featuretype)
+ elseif featuretype=="pair" then
+ format="pair"
+ coverage=prepare_pair(list,featuretype)
+ elseif featuretype=="single" then
+ format="single"
+ coverage=prepare_single(list,featuretype)
+ end
+ if coverage and next(coverage) then
+ nofsteps=nofsteps+1
+ steps[nofsteps]=register(coverage,featuretype,format,feature,nofsteps,descriptions,resources)
+ end
end
+ checkmerge(specification)
+ checksteps(specification)
+ s[i]={
+ [stepkey]=steps,
+ nofsteps=nofsteps,
+ flags=featureflags,
+ type=types[featuretype],
+ }
+ end
+ sublookups=s
+ end
+ for i=1,#askedsteps do
+ local list=askedsteps[i]
+ local coverage=nil
+ local format=nil
+ if featuretype=="substitution" then
+ category="gsub"
+ coverage=(mapping and list) or prepare_substitution(list,featuretype,nocheck)
+ elseif featuretype=="ligature" then
+ category="gsub"
+ coverage=prepare_ligature(list,featuretype,nocheck)
+ elseif featuretype=="alternate" then
+ category="gsub"
+ coverage=prepare_alternate(list,featuretype,nocheck)
+ elseif featuretype=="multiple" then
+ category="gsub"
+ coverage=prepare_multiple(list,featuretype,nocheck)
+ elseif featuretype=="kern" or featuretype=="move" then
+ category="gpos"
+ format=featuretype
+ coverage=prepare_kern(list,featuretype)
+ elseif featuretype=="pair" then
+ category="gpos"
+ format="pair"
+ coverage=prepare_pair(list,featuretype)
+ elseif featuretype=="single" then
+ category="gpos"
+ format="single"
+ coverage=prepare_single(list,featuretype)
+ elseif featuretype=="chainsubstitution" then
+ category="gsub"
+ coverage=prepare_chain(list,featuretype,sublookups,nocheck)
+ elseif featuretype=="chainposition" then
+ category="gpos"
+ coverage=prepare_chain(list,featuretype,sublookups,nocheck)
+ else
+ report_otf("not registering feature %a, unknown category",feature)
+ return
end
- checkmerge(specification)
- checksteps(specification)
- s[i]={
+ if coverage and next(coverage) then
+ nofsteps=nofsteps+1
+ steps[nofsteps]=register(coverage,featuretype,format,feature,nofsteps,descriptions,resources)
+ end
+ end
+ if nofsteps>0 then
+ sequence={
+ chain=featurechain,
+ features={ [feature]=askedfeatures },
+ flags=featureflags,
+ name=feature,
+ order=featureorder,
[stepkey]=steps,
nofsteps=nofsteps,
- flags=featureflags,
type=types[featuretype],
}
end
- sublookups=s
- end
- for i=1,#askedsteps do
- local list=askedsteps[i]
- local coverage=nil
- local format=nil
- if featuretype=="substitution" then
- category="gsub"
- coverage=prepare_substitution(list,featuretype,nocheck)
- elseif featuretype=="ligature" then
- category="gsub"
- coverage=prepare_ligature(list,featuretype,nocheck)
- elseif featuretype=="alternate" then
- category="gsub"
- coverage=prepare_alternate(list,featuretype,nocheck)
- elseif featuretype=="multiple" then
- category="gsub"
- coverage=prepare_multiple(list,featuretype,nocheck)
- elseif featuretype=="kern" or featuretype=="move" then
- category="gpos"
- format=featuretype
- coverage=prepare_kern(list,featuretype)
- elseif featuretype=="pair" then
- category="gpos"
- format="pair"
- coverage=prepare_pair(list,featuretype)
- elseif featuretype=="single" then
- category="gpos"
- format="single"
- coverage=prepare_single(list,featuretype)
- elseif featuretype=="chainsubstitution" then
- category="gsub"
- coverage=prepare_chain(list,featuretype,sublookups)
- elseif featuretype=="chainposition" then
- category="gpos"
- coverage=prepare_chain(list,featuretype,sublookups)
- else
- report_otf("not registering feature %a, unknown category",feature)
- return
- end
- if coverage and next(coverage) then
- nofsteps=nofsteps+1
- steps[nofsteps]=register(coverage,featuretype,format,feature,nofsteps,descriptions,resources)
- end
end
- if nofsteps>0 then
- for k,v in next,askedfeatures do
- if v[1] then
- askedfeatures[k]=tohash(v)
- end
- end
- if featureflags[1] then featureflags[1]="mark" end
- if featureflags[2] then featureflags[2]="ligature" end
- if featureflags[3] then featureflags[3]="base" end
- local steptype=types[featuretype]
- local sequence={
- chain=featurechain,
- features={ [feature]=askedfeatures },
- flags=featureflags,
- name=feature,
- order=featureorder,
- [stepkey]=steps,
- nofsteps=nofsteps,
- type=steptype,
- }
+ if sequence then
checkflags(sequence,resources)
checkmerge(sequence)
checksteps(sequence)
@@ -31111,7 +31165,8 @@ local flushnode=nuts.flushnode
local copyinjection=nodes.injections.copy
local unsetvalue=attributes.unsetvalue
local fontdata=fonts.hashes.identifiers
-local a_syllabe=attributes.private('syllabe')
+local a_syllabe="syllable"
+local a_reordered="reordered"
local dotted_circle=0x25CC
local c_nbsp=0x00A0
local c_zwnj=0x200C
@@ -32187,7 +32242,7 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
if getchar(base)==c_nbsp then
nbspaces=nbspaces-1
if base==stop then
- stop=getprev(stop)
+ stop=getprev(stop)
end
head=remove_node(head,base)
flushnode(base)
@@ -32304,7 +32359,7 @@ function handlers.devanagari_reorder_reph(head,start)
start=startnext
startattr=getprop(start,a_syllabe)
break
- elseif not c and (vowel_modifier[char] or stress_tone_mark[char] ) then
+ elseif not c and (vowel_modifier[char] or stress_tone_mark[char]) then
c=current
end
current=getnext(current)
@@ -32372,9 +32427,8 @@ function handlers.devanagari_reorder_reph(head,start)
end
return head,start,true
end
-local reordered_pre_base_reordering_consonants={}
function handlers.devanagari_reorder_pre_base_reordering_consonants(head,start)
- if reordered_pre_base_reordering_consonants[start] then
+ if getprop(start,a_reordered) then
return head,start,true
end
local current=start
@@ -32396,7 +32450,7 @@ function handlers.devanagari_reorder_pre_base_reordering_consonants(head,start)
head=remove_node(head,start)
setlink(start,next)
setlink(current,start)
- reordered_pre_base_reordering_consonants[start]=true
+ setprop(start,"reordered",true)
start=startnext
return head,start,true
end
@@ -32419,7 +32473,7 @@ function handlers.devanagari_reorder_pre_base_reordering_consonants(head,start)
setlink(getprev(current),start)
setlink(start,current)
end
- reordered_pre_base_reordering_consonants[start]=true
+ setprop(start,"reordered",true)
start=startnext
break
end
@@ -32930,20 +32984,20 @@ local function analyze_next_chars_one(c,font,variant)
local already_below_mark
local already_post_mark
while dependent_vowel[v] do
- local vowels=twopart_mark[v] or { v }
- for k,v in next,vowels do
- if pre_mark[v] and not already_pre_mark then
- already_pre_mark=true
- elseif above_mark[v] and not already_above_mark then
- already_above_mark=true
- elseif below_mark[v] and not already_below_mark then
- already_below_mark=true
- elseif post_mark[v] and not already_post_mark then
- already_post_mark=true
- else
- return c
- end
- end
+ local vowels=twopart_mark[v] or { v }
+ for k,v in next,vowels do
+ if pre_mark[v] and not already_pre_mark then
+ already_pre_mark=true
+ elseif above_mark[v] and not already_above_mark then
+ already_above_mark=true
+ elseif below_mark[v] and not already_below_mark then
+ already_below_mark=true
+ elseif post_mark[v] and not already_post_mark then
+ already_post_mark=true
+ else
+ return c
+ end
+ end
c=getnext(c)
n=getnext(c)
if not n then
@@ -33113,21 +33167,21 @@ local function analyze_next_chars_two(c,font)
local already_above_mark
local already_below_mark
local already_post_mark
- while dependent_vowel[v] do
- local vowels=twopart_mark[v] or { v }
- for k,v in next,vowels do
- if pre_mark[v] and not already_pre_mark then
- already_pre_mark=true
- elseif above_mark[v] and not already_above_mark then
- already_above_mark=true
- elseif below_mark[v] and not already_below_mark then
- already_below_mark=true
- elseif post_mark[v] and not already_post_mark then
- already_post_mark=true
- else
- return c
- end
- end
+ while dependent_vowel[v] do
+ local vowels=twopart_mark[v] or { v }
+ for k,v in next,vowels do
+ if pre_mark[v] and not already_pre_mark then
+ already_pre_mark=true
+ elseif above_mark[v] and not already_above_mark then
+ already_above_mark=true
+ elseif below_mark[v] and not already_below_mark then
+ already_below_mark=true
+ elseif post_mark[v] and not already_post_mark then
+ already_post_mark=true
+ else
+ return c
+ end
+ end
c=n
n=getnext(c)
if not n then
@@ -33383,15 +33437,15 @@ local function method_one(head,font,attr)
while current do
local char=ischar(current,font)
if char then
- if n==0 and not getstate(current) then
- setstate(current,s_init)
- end
- n=n+1
- else
- n=0
- end
- current=getnext(current)
- end
+ if n==0 and not getstate(current) then
+ setstate(current,s_init)
+ end
+ n=n+1
+ else
+ n=0
+ end
+ current=getnext(current)
+ end
return head,done
end
local function method_two(head,font,attr)
@@ -33478,15 +33532,15 @@ local function method_two(head,font,attr)
while current do
local char=ischar(current,font)
if char then
- if n==0 and not getstate(current) then
- setstate(current,s_init)
- end
- n=n+1
- else
- n=0
- end
- current=getnext(current)
- end
+ if n==0 and not getstate(current) then
+ setstate(current,s_init)
+ end
+ n=n+1
+ else
+ n=0
+ end
+ current=getnext(current)
+ end
return head,done
end
for i=1,nofscripts do