diff options
author | Marius <mariausol@gmail.com> | 2011-10-12 11:40:13 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2011-10-12 11:40:13 +0300 |
commit | c766ac76f88d4542235043790e8048c12b37d4ff (patch) | |
tree | 61e4e4fe4150eeb24e7bdb2fa5a95df1dd4d138f /tex/generic | |
parent | d67c88b277ff5d781397fb99ef9470f51b8eeced (diff) | |
download | context-c766ac76f88d4542235043790e8048c12b37d4ff.tar.gz |
beta 2011.10.12 10:14
Diffstat (limited to 'tex/generic')
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 175 |
1 files changed, 106 insertions, 69 deletions
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 7156e0a00..7d2846b28 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 : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 10/08/11 11:42:24 +-- merge date : 10/12/11 10:14:56 do -- begin closure to overcome local limits and interference @@ -3184,30 +3184,30 @@ local report_defining = logs.reporter("fonts","defining") <p>Here we only implement a few helper functions.</p> --ldx]]-- -local fonts = fonts -local constructors = { } -fonts.constructors = constructors -local handlers = { } -fonts.handlers = handlers +local fonts = fonts +local constructors = { } +fonts.constructors = constructors +local handlers = { } +fonts.handlers = handlers -local specifiers = fonts.specifiers -local contextsetups = specifiers.contextsetups -local contextnumbers = specifiers.contextnumbers +local specifiers = fonts.specifiers +local contextsetups = specifiers.contextsetups +local contextnumbers = specifiers.contextnumbers -local allocate = utilities.storage.allocate -local setmetatableindex = table.setmetatableindex +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex -- will be directives -constructors.dontembed = allocate() -constructors.mathactions = { } -constructors.autocleanup = true -constructors.namemode = "fullpath" -- will be a function +constructors.dontembed = allocate() +constructors.mathactions = { } +constructors.autocleanup = true +constructors.namemode = "fullpath" -- will be a function -constructors.version = 1.01 -constructors.cache = containers.define("fonts", "constructors", constructors.version, false) +constructors.version = 1.01 +constructors.cache = containers.define("fonts", "constructors", constructors.version, false) -constructors.privateoffset = 0xF0000 -- 0x10FFFF +constructors.privateoffset = 0xF0000 -- 0x10FFFF -- This might become an interface; @@ -3564,6 +3564,26 @@ function constructors.scale(tfmdata,specification) target.mathparameters = nil -- nop end -- + local italickey = "italic" + if hasmath then + if properties.no_mathitalics then + italickey = "italic_correction" -- context specific trickery + if trace_defining then + report_defining("math italics disabled for: name '%s', fullname: '%s', filename: '%s'", + name or "noname",fullname or "nofullname",filename or "nofilename") + end + end + autoitalic = false -- new + else + if properties.no_textitalics then + italickey = "italic_correction" -- context specific trickery + if trace_defining then + report_defining("text italics disabled for: name '%s', fullname: '%s', filename: '%s'", + name or "noname",fullname or "nofullname",filename or "nofilename") + end + end + end + -- local sharedkerns = { } -- for unicode, character in next, characters do @@ -3659,16 +3679,16 @@ function constructors.scale(tfmdata,specification) chr.right_protruding = protrusionfactor*width*vr end end - -- todo: hasitalic + -- if autoitalic then local vi = description.italic or (description.boundingbox[3] - description.width + autoitalic) if vi and vi ~= 0 then - chr.italic = vi*hdelta + chr[italickey] = vi*hdelta end elseif hasitalic then local vi = description.italic or character.italic -- why character if vi and vi ~= 0 then - chr.italic = vi*hdelta + chr[italickey] = vi*hdelta end end -- to be tested @@ -4286,7 +4306,7 @@ function constructors.collectprocessors(what,tfmdata,features,trace,report) end end end - else + elseif trace then report("no feature processors for mode %s for font %s", mode or 'unknown', tfmdata.properties.fullname or 'unknown') end @@ -8640,7 +8660,7 @@ local function alternative_glyph(start,alternatives,kind,chainname,chainlookupna return choice, value end -local function multiple_glyphs(start,multiple) +local function multiple_glyphs(start,multiple) -- marks ? local nofmultiples = #multiple if nofmultiples > 0 then start.char = multiple[1] @@ -9152,7 +9172,7 @@ single lookup case. The efficiency of the replacements can be improved by deleti as less as needed but that would also make the code even more messy.</p> --ldx]]-- -local function delete_till_stop(start,stop,ignoremarks) +local function delete_till_stop(start,stop,ignoremarks) -- keeps start local n = 1 if start == stop then -- done @@ -9181,10 +9201,6 @@ match.</p> function chainprocs.gsub_single(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,chainindex) -- todo: marks ? ---~ if not chainindex then ---~ delete_till_stop(start,stop) -- ,currentlookup.flags[1] ---~ stop = start ---~ end local current = start local subtables = currentlookup.subtables if #subtables > 1 then @@ -9230,7 +9246,7 @@ the match.</p> --ldx]]-- function chainprocs.gsub_multiple(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname) - delete_till_stop(start,stop) -- we can assume that marks are to be deleted + delete_till_stop(start,stop) -- we could pass ignoremarks as #3 .. local startchar = start.char local subtables = currentlookup.subtables local lookupname = subtables[1] @@ -9760,37 +9776,41 @@ local function show_skip(kind,chainname,char,ck,class) end local function normal_handle_contextchain(start,kind,chainname,contexts,sequence,lookuphash) - -- local rule, lookuptype, sequence, f, l, lookups = ck[1], ck[2] ,ck[3], ck[4], ck[5], ck[6] - local flags, done = sequence.flags, false - local skipmark, skipligature, skipbase = flags[1], flags[2], flags[3] - local someskip = skipmark or skipligature or skipbase -- could be stored in flags for a fast test (hm, flags could be false !) - local markclass = sequence.markclass -- todo, first we need a proper test - local skipped = false + -- local rule, lookuptype, sequence, f, l, lookups = ck[1], ck[2] ,ck[3], ck[4], ck[5], ck[6] + local flags = sequence.flags + local done = false + local skipmark = flags[1] + local skipligature = flags[2] + local skipbase = flags[3] + local someskip = skipmark or skipligature or skipbase -- could be stored in flags for a fast test (hm, flags could be false !) + local markclass = sequence.markclass -- todo, first we need a proper test + local skipped = false for k=1,#contexts do - local match, current, last = true, start, start - local ck = contexts[k] - local seq = ck[3] - local s = #seq + local match = true + local current = start + local last = start + local ck = contexts[k] + local seq = ck[3] + local s = #seq -- f..l = mid string if s == 1 then -- never happens match = current.id == glyph_code and current.subtype<256 and current.font == currentfont and seq[1][current.char] else - -- todo: better space check (maybe check for glue) + -- maybe we need a better space check (maybe check for glue or category or combination) + -- we cannot optimize for n=2 because there can be disc nodes local f, l = ck[4], ck[5] -- current match - if f == 1 and f == l then + if f == 1 and f == l then -- current only -- already a hit - match = true - else + -- match = true + else -- before/current/after | before/current | current/after -- no need to test first hit (to be optimized) - local n = f + 1 - last = last.next - -- we cannot optimize for n=2 because there can be disc nodes - -- if not someskip and n == l then - -- -- n=2 and no skips then faster loop - -- match = last and last.id == glyph_code and last.subtype<256 and last.font == currentfont and seq[n][last.char] - -- else + if f == l then -- new, else last out of sync (f is > 1) + -- match = true + else + local n = f + 1 + last = last.next while n <= l do if last then local id = last.id @@ -9812,24 +9832,29 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence end n = n + 1 else - match = false break + match = false + break end else - match = false break + match = false + break end else - match = false break + match = false + break end - elseif id == disc_code then -- what to do with kerns? + elseif id == disc_code then last = last.next else - match = false break + match = false + break end else - match = false break + match = false + break end end - -- end + end end -- before if match and f > 1 then @@ -9853,26 +9878,31 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence elseif seq[n][char] then n = n -1 else - match = false break + match = false + break end else - match = false break + match = false + break end else - match = false break + match = false + break end elseif id == disc_code then -- skip 'm elseif seq[n][32] then n = n -1 else - match = false break + match = false + break end prev = prev.prev elseif seq[n][32] then -- somehat special, as zapfino can have many preceding spaces n = n -1 else - match = false break + match = false + break end end elseif f == 2 then @@ -9880,7 +9910,8 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence else for n=f-1,1 do if not seq[n][32] then - match = false break + match = false + break end end end @@ -9908,26 +9939,31 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence elseif seq[n][char] then n = n + 1 else - match = false break + match = false + break end else - match = false break + match = false + break end else - match = false break + match = false + break end elseif id == disc_code then -- skip 'm elseif seq[n][32] then -- brrr n = n + 1 else - match = false break + match = false + break end current = current.next elseif seq[n][32] then n = n + 1 else - match = false break + match = false + break end end elseif s-l == 1 then @@ -9935,7 +9971,8 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence else for n=l+1,s do if not seq[n][32] then - match = false break + match = false + break end end end |