From 06d7e58122d6238c80fc91825d110322bb3c051b Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Sat, 6 Oct 2012 14:55:00 +0200 Subject: beta 2012.10.06 14:55 --- tex/context/base/cont-new.mkii | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4142 -> 4152 bytes tex/context/base/context-version.png | Bin 105863 -> 105960 bytes tex/context/base/context.mkii | 2 +- tex/context/base/context.mkiv | 2 +- tex/context/base/font-otn.lua | 270 +++++++++++--------- tex/context/base/status-files.pdf | Bin 24573 -> 24592 bytes tex/context/base/status-lua.pdf | Bin 195300 -> 195299 bytes tex/context/base/symb-run.mkiv | 4 +- tex/generic/context/luatex/luatex-fonts-merged.lua | 272 ++++++++++++--------- 11 files changed, 325 insertions(+), 229 deletions(-) (limited to 'tex') diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index cd49e7efc..30db55abd 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2012.10.05 19:52} +\newcontextversion{2012.10.06 14:55} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index d8adcf388..8e09c1b5c 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2012.10.05 19:52} +\newcontextversion{2012.10.06 14:55} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index e9bc07c32..837960a4b 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png index 8f66709c2..6c3ff5231 100644 Binary files a/tex/context/base/context-version.png and b/tex/context/base/context-version.png differ diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index a69d67d62..8f8b27688 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2012.10.05 19:52} +\edef\contextversion{2012.10.06 14:55} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 7cfee6b89..f19017f27 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2012.10.05 19:52} +\edef\contextversion{2012.10.06 14:55} %D For those who want to use this: diff --git a/tex/context/base/font-otn.lua b/tex/context/base/font-otn.lua index ba9b0ed94..51b6e03a4 100644 --- a/tex/context/base/font-otn.lua +++ b/tex/context/base/font-otn.lua @@ -322,70 +322,62 @@ end -- However, for arabic we need to keep them around for the sake of mark placement -- and indices. --- local function collapsecomponents(start) --- local c = start --- while c do --- local cp = c.components --- if cp then --- flush_node_list(cp) --- c.components = nil --- end --- c = c.next +local function copy_glyph(g) -- next and prev are untouched ! + local components = g.components + if components then + g.components = nil + local n = copy_node(g) + g.components = components + return n + else + return copy_node(g) + end +end + +-- start is a mark and we need to keep that one + +-- local function markstoligature(kind,lookupname,start,stop,char) +-- -- [start]..[stop] +-- local keep = start +-- local prev = start.prev +-- local next = stop.next +-- local base = copy_glyph(start) +-- local current, start = insert_node_after(start,start,base) +-- -- [current][start]..[stop] +-- current.next = next +-- if next then +-- next.prev = current -- end --- return start +-- start.prev = nil +-- stop.next = nil +-- current.char = char +-- current.subtype = ligature_code +-- current.components = start +-- return keep -- end -local function collapsecomponents(start) - if not start.next then - report_warning("suspicious ligature components") - -- actually an error - return components +local function markstoligature(kind,lookupname,start,stop,char) + if start == stop and start.char == char then + return start else - local head = nil - local tail = nil - while start do - local components = start.components - if components then - if head then - tail.next = components - components.prev = tail - else - head = components - end - tail = find_node_tail(components) - start.components = nil - else - if head then - tail.next = start - start.prev = tail - tail = start - else - head = start - tail = start - end - end - start = start.next + local prev = start.prev + local next = stop.next + start.prev = nil + stop.next = nil + local base = copy_glyph(start) + base.char = char + base.subtype = ligature_code + base.components = start + if prev then + prev.next = base end - return head - end -end - -local function markstoligature(kind,lookupname,start,stop,char) -- some trickery to keep head as is - -- [start]..[stop] - local keep = start - local current, start = insert_node_after(start,start,copy_node(start)) - -- [current][start]..[stop] - local snext = stop.next - current.next = snext - if snext then - snext.prev = current + if next then + next.prev = base + end + base.next = next + base.prev = prev + return base end - start.prev = nil - stop.next = nil - current.char = char - current.subtype = ligature_code - current.components = collapsecomponents(start) - return keep end -- The next code is somewhat complicated by the fact that some fonts can have ligatures made @@ -411,67 +403,124 @@ local function getcomponentindex(start) -- so we cannot remove components ! end end +-- local function toligature(kind,lookupname,start,stop,char,markflag,discfound) -- brr head +-- if start == stop and start.char == char then +-- start.char = char +-- return start +-- elseif discfound then +-- local prev = start.prev +-- local next = stop.next +-- start.prev = nil +-- stop.next = nil +-- local base = copy_glyph(start) +-- base.char = char +-- base.subtype = ligature_code +-- base.components = start -- start can have components +-- if prev then +-- prev.next = base +-- end +-- if next then +-- next.prev = base +-- end +-- base.next = next +-- base.prev = prev +-- return base +-- else +-- -- start is the ligature +-- local deletemarks = markflag ~= "mark" +-- local prev = start.prev +-- local next = stop.next +-- local base = copy_glyph(start) +-- local current, start = insert_node_after(start,start,base) +-- -- [start->current][copyofstart->start]...[stop] +-- current.next = next +-- if next then +-- next.prev = current +-- end +-- start.prev = nil +-- stop.next = nil +-- current.char = char +-- current.subtype = ligature_code +-- current.components = start +-- local head = current +-- -- this is messy ... we should get rid of the components eventually +-- local baseindex = 0 +-- local componentindex = 0 +-- while start do +-- local char = start.char +-- if not marks[char] then +-- baseindex = baseindex + componentindex +-- componentindex = getcomponentindex(start) +-- elseif not deletemarks then -- quite fishy +-- set_attribute(start,ligacomp,baseindex + (has_attribute(start,ligacomp) or componentindex)) +-- if trace_marks then +-- logwarning("%s: keep mark %s, gets index %s",pref(kind,lookupname),gref(char),has_attribute(start,ligacomp)) +-- end +-- head, current = insert_node_after(head,current,copy_glyph(start)) -- unlikely that mark has components +-- end +-- start = start.next +-- end +-- start = current.next +-- while start and start.id == glyph_code do -- hm, is id test needed ? +-- local char = start.char +-- if marks[char] then +-- set_attribute(start,ligacomp,baseindex + (has_attribute(start,ligacomp) or componentindex)) +-- if trace_marks then +-- logwarning("%s: keep mark %s, gets index %s",pref(kind,lookupname),gref(char),has_attribute(start,ligacomp)) +-- end +-- else +-- break +-- end +-- start = start.next +-- end +-- return head +-- end +-- end + local function toligature(kind,lookupname,start,stop,char,markflag,discfound) -- brr head - if start == stop then + if start == stop and start.char == char then start.char = char return start - elseif discfound then - -- print("start->stop",nodes.tosequence(start,stop)) - local lignode = copy_node(start) - lignode.font = start.font - lignode.char = char - lignode.subtype = ligature_code - local next = stop.next - local prev = start.prev - stop.next = nil - start.prev = nil - lignode.components = collapsecomponents(start) - -- print("lignode",nodes.tosequence(lignode)) - -- print("components",nodes.tosequence(lignode.components)) - prev.next = lignode - if next then - next.prev = lignode - end - lignode.next = next - lignode.prev = prev - -- print("start->end",nodes.tosequence(start)) - return lignode - else - -- start is the ligature + end + local prev = start.prev + local next = stop.next + start.prev = nil + stop.next = nil + local base = copy_glyph(start) + base.char = char + base.subtype = ligature_code + base.components = start -- start can have components + if prev then + prev.next = base + end + if next then + next.prev = base + end + base.next = next + base.prev = prev + if not discfound then local deletemarks = markflag ~= "mark" - local prev = start.prev - local next = stop.next - local current, start = insert_node_after(start,start,copy_node(start)) - -- [start->current][copyofstart->start]...[stop] - current.next = next - if next then - next.prev = current - end - start.prev = nil - stop.next = nil - current.char = char - current.subtype = ligature_code - current.components = collapsecomponents(start) - local head = current - -- this is messy ... we should get rid of the components eventually + local components = start local baseindex = 0 local componentindex = 0 + local head = base + local current = base while start do local char = start.char if not marks[char] then - baseindex = baseindex + componentindex - componentindex = getcomponentindex(start) + baseindex = baseindex + componentindex + componentindex = getcomponentindex(start) elseif not deletemarks then -- quite fishy set_attribute(start,ligacomp,baseindex + (has_attribute(start,ligacomp) or componentindex)) if trace_marks then logwarning("%s: keep mark %s, gets index %s",pref(kind,lookupname),gref(char),has_attribute(start,ligacomp)) end - head, current = insert_node_after(head,current,copy_node(start)) + head, current = insert_node_after(head,current,copy_node(start)) -- unlikely that mark has components end start = start.next end - start = current.next - while start and start.id == glyph_code do + local start = components + while start and start.id == glyph_code do -- hm, is id test needed ? local char = start.char if marks[char] then set_attribute(start,ligacomp,baseindex + (has_attribute(start,ligacomp) or componentindex)) @@ -483,8 +532,8 @@ local function toligature(kind,lookupname,start,stop,char,markflag,discfound) -- end start = start.next end - return head end + return base end function handlers.gsub_single(start,kind,lookupname,replacement) @@ -539,7 +588,7 @@ local function multiple_glyphs(start,multiple) -- marks ? if nofmultiples > 1 then local sn = start.next for k=2,nofmultiples do -- todo: use insert_node - local n = copy_node(start) + local n = copy_node(start) -- ignore components n.char = multiple[k] n.next = sn n.prev = start @@ -564,12 +613,12 @@ function handlers.gsub_alternate(start,kind,lookupname,alternative,sequence) local choice = get_alternative_glyph(start,alternative,value) if choice then if trace_alternatives then - logprocess("%s: replacing %s by alternative %s (%s)",pref(kind,lookupname),gref(char),gref(choice),choice) + logprocess("%s: replacing %s by alternative %s (%s)",pref(kind,lookupname),gref(start.char),gref(choice),choice) end start.char = choice else if trace_alternatives then - logwarning("%s: no variant %s for %s",pref(kind,lookupname),tostring(value),gref(char)) + logwarning("%s: no variant %s for %s",pref(kind,lookupname),tostring(value),gref(start.char)) end end return start, true @@ -652,7 +701,6 @@ function handlers.gsub_ligature(start,kind,lookupname,ligature,sequence) local stopchar = stop.char start = toligature(kind,lookupname,start,stop,lig,skipmark,discfound) logprocess("%s: replacing %s upto %s by ligature %s",pref(kind,lookupname),gref(startchar),gref(stopchar),gref(start.char)) --- print("start",nodes.listtoutf(start.components)) else start = toligature(kind,lookupname,start,stop,lig,skipmark,discfound) end @@ -1065,8 +1113,8 @@ local function delete_till_stop(start,stop,ignoremarks) -- keeps start local next = start.next if not marks[next.char] then local components = next.components -if components then - node.flush_list(components) +if components then -- probably not needed + flush_node_list(components) end delete_node(start,next) end @@ -1076,8 +1124,8 @@ end repeat local next = start.next local components = next.components -if components then - node.flush_list(components) +if components then -- probably not needed + flush_node_list(components) end delete_node(start,next) n = n + 1 diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index e4b35c632..fa2ac8f1b 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index cedb02ae4..fefabbcc8 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/symb-run.mkiv b/tex/context/base/symb-run.mkiv index e5bac89d9..3d92c4416 100644 --- a/tex/context/base/symb-run.mkiv +++ b/tex/context/base/symb-run.mkiv @@ -44,8 +44,8 @@ \unprotect -\unexpanded\gdef\symb_show_set - {\dosingleargument\doshowsymbolset} +\unexpanded\gdef\showsymbolset + {\dosingleargument\symb_show_set} \gdef\symb_show_set[#1]% {\ctxcommand{showsymbolset("#1","\symbolset{#1}")}} diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 920b43eff..37b52d9fc 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/05/12 19:52:22 +-- merge date : 10/06/12 14:55:25 do -- begin closure to overcome local limits and interference @@ -9141,70 +9141,62 @@ end -- However, for arabic we need to keep them around for the sake of mark placement -- and indices. --- local function collapsecomponents(start) --- local c = start --- while c do --- local cp = c.components --- if cp then --- flush_node_list(cp) --- c.components = nil --- end --- c = c.next +local function copy_glyph(g) -- next and prev are untouched ! + local components = g.components + if components then + g.components = nil + local n = copy_node(g) + g.components = components + return n + else + return copy_node(g) + end +end + +-- start is a mark and we need to keep that one + +-- local function markstoligature(kind,lookupname,start,stop,char) +-- -- [start]..[stop] +-- local keep = start +-- local prev = start.prev +-- local next = stop.next +-- local base = copy_glyph(start) +-- local current, start = insert_node_after(start,start,base) +-- -- [current][start]..[stop] +-- current.next = next +-- if next then +-- next.prev = current -- end --- return start +-- start.prev = nil +-- stop.next = nil +-- current.char = char +-- current.subtype = ligature_code +-- current.components = start +-- return keep -- end -local function collapsecomponents(start) - if not start.next then - report_warning("suspicious ligature components") - -- actually an error - return components +local function markstoligature(kind,lookupname,start,stop,char) + if start == stop and start.char == char then + return start else - local head = nil - local tail = nil - while start do - local components = start.components - if components then - if head then - tail.next = components - components.prev = tail - else - head = components - end - tail = find_node_tail(components) - start.components = nil - else - if head then - tail.next = start - start.prev = tail - tail = start - else - head = start - tail = start - end - end - start = start.next + local prev = start.prev + local next = stop.next + start.prev = nil + stop.next = nil + local base = copy_glyph(start) + base.char = char + base.subtype = ligature_code + base.components = start + if prev then + prev.next = base end - return head - end -end - -local function markstoligature(kind,lookupname,start,stop,char) -- some trickery to keep head as is - -- [start]..[stop] - local keep = start - local current, start = insert_node_after(start,start,copy_node(start)) - -- [current][start]..[stop] - local snext = stop.next - current.next = snext - if snext then - snext.prev = current + if next then + next.prev = base + end + base.next = next + base.prev = prev + return base end - start.prev = nil - stop.next = nil - current.char = char - current.subtype = ligature_code - current.components = collapsecomponents(start) - return keep end -- The next code is somewhat complicated by the fact that some fonts can have ligatures made @@ -9230,67 +9222,124 @@ local function getcomponentindex(start) -- so we cannot remove components ! end end +-- local function toligature(kind,lookupname,start,stop,char,markflag,discfound) -- brr head +-- if start == stop and start.char == char then +-- start.char = char +-- return start +-- elseif discfound then +-- local prev = start.prev +-- local next = stop.next +-- start.prev = nil +-- stop.next = nil +-- local base = copy_glyph(start) +-- base.char = char +-- base.subtype = ligature_code +-- base.components = start -- start can have components +-- if prev then +-- prev.next = base +-- end +-- if next then +-- next.prev = base +-- end +-- base.next = next +-- base.prev = prev +-- return base +-- else +-- -- start is the ligature +-- local deletemarks = markflag ~= "mark" +-- local prev = start.prev +-- local next = stop.next +-- local base = copy_glyph(start) +-- local current, start = insert_node_after(start,start,base) +-- -- [start->current][copyofstart->start]...[stop] +-- current.next = next +-- if next then +-- next.prev = current +-- end +-- start.prev = nil +-- stop.next = nil +-- current.char = char +-- current.subtype = ligature_code +-- current.components = start +-- local head = current +-- -- this is messy ... we should get rid of the components eventually +-- local baseindex = 0 +-- local componentindex = 0 +-- while start do +-- local char = start.char +-- if not marks[char] then +-- baseindex = baseindex + componentindex +-- componentindex = getcomponentindex(start) +-- elseif not deletemarks then -- quite fishy +-- set_attribute(start,ligacomp,baseindex + (has_attribute(start,ligacomp) or componentindex)) +-- if trace_marks then +-- logwarning("%s: keep mark %s, gets index %s",pref(kind,lookupname),gref(char),has_attribute(start,ligacomp)) +-- end +-- head, current = insert_node_after(head,current,copy_glyph(start)) -- unlikely that mark has components +-- end +-- start = start.next +-- end +-- start = current.next +-- while start and start.id == glyph_code do -- hm, is id test needed ? +-- local char = start.char +-- if marks[char] then +-- set_attribute(start,ligacomp,baseindex + (has_attribute(start,ligacomp) or componentindex)) +-- if trace_marks then +-- logwarning("%s: keep mark %s, gets index %s",pref(kind,lookupname),gref(char),has_attribute(start,ligacomp)) +-- end +-- else +-- break +-- end +-- start = start.next +-- end +-- return head +-- end +-- end + local function toligature(kind,lookupname,start,stop,char,markflag,discfound) -- brr head - if start == stop then + if start == stop and start.char == char then start.char = char return start - elseif discfound then - -- print("start->stop",nodes.tosequence(start,stop)) - local lignode = copy_node(start) - lignode.font = start.font - lignode.char = char - lignode.subtype = ligature_code - local next = stop.next - local prev = start.prev - stop.next = nil - start.prev = nil - lignode.components = collapsecomponents(start) - -- print("lignode",nodes.tosequence(lignode)) - -- print("components",nodes.tosequence(lignode.components)) - prev.next = lignode - if next then - next.prev = lignode - end - lignode.next = next - lignode.prev = prev - -- print("start->end",nodes.tosequence(start)) - return lignode - else - -- start is the ligature + end + local prev = start.prev + local next = stop.next + start.prev = nil + stop.next = nil + local base = copy_glyph(start) + base.char = char + base.subtype = ligature_code + base.components = start -- start can have components + if prev then + prev.next = base + end + if next then + next.prev = base + end + base.next = next + base.prev = prev + if not discfound then local deletemarks = markflag ~= "mark" - local prev = start.prev - local next = stop.next - local current, start = insert_node_after(start,start,copy_node(start)) - -- [start->current][copyofstart->start]...[stop] - current.next = next - if next then - next.prev = current - end - start.prev = nil - stop.next = nil - current.char = char - current.subtype = ligature_code - current.components = collapsecomponents(start) - local head = current - -- this is messy ... we should get rid of the components eventually + local components = start local baseindex = 0 local componentindex = 0 + local head = base + local current = base while start do local char = start.char if not marks[char] then - baseindex = baseindex + componentindex - componentindex = getcomponentindex(start) + baseindex = baseindex + componentindex + componentindex = getcomponentindex(start) elseif not deletemarks then -- quite fishy set_attribute(start,ligacomp,baseindex + (has_attribute(start,ligacomp) or componentindex)) if trace_marks then logwarning("%s: keep mark %s, gets index %s",pref(kind,lookupname),gref(char),has_attribute(start,ligacomp)) end - head, current = insert_node_after(head,current,copy_node(start)) + head, current = insert_node_after(head,current,copy_node(start)) -- unlikely that mark has components end start = start.next end - start = current.next - while start and start.id == glyph_code do + local start = components + while start and start.id == glyph_code do -- hm, is id test needed ? local char = start.char if marks[char] then set_attribute(start,ligacomp,baseindex + (has_attribute(start,ligacomp) or componentindex)) @@ -9302,8 +9351,8 @@ local function toligature(kind,lookupname,start,stop,char,markflag,discfound) -- end start = start.next end - return head end + return base end function handlers.gsub_single(start,kind,lookupname,replacement) @@ -9358,7 +9407,7 @@ local function multiple_glyphs(start,multiple) -- marks ? if nofmultiples > 1 then local sn = start.next for k=2,nofmultiples do -- todo: use insert_node - local n = copy_node(start) + local n = copy_node(start) -- ignore components n.char = multiple[k] n.next = sn n.prev = start @@ -9383,12 +9432,12 @@ function handlers.gsub_alternate(start,kind,lookupname,alternative,sequence) local choice = get_alternative_glyph(start,alternative,value) if choice then if trace_alternatives then - logprocess("%s: replacing %s by alternative %s (%s)",pref(kind,lookupname),gref(char),gref(choice),choice) + logprocess("%s: replacing %s by alternative %s (%s)",pref(kind,lookupname),gref(start.char),gref(choice),choice) end start.char = choice else if trace_alternatives then - logwarning("%s: no variant %s for %s",pref(kind,lookupname),tostring(value),gref(char)) + logwarning("%s: no variant %s for %s",pref(kind,lookupname),tostring(value),gref(start.char)) end end return start, true @@ -9471,7 +9520,6 @@ function handlers.gsub_ligature(start,kind,lookupname,ligature,sequence) local stopchar = stop.char start = toligature(kind,lookupname,start,stop,lig,skipmark,discfound) logprocess("%s: replacing %s upto %s by ligature %s",pref(kind,lookupname),gref(startchar),gref(stopchar),gref(start.char)) --- print("start",nodes.listtoutf(start.components)) else start = toligature(kind,lookupname,start,stop,lig,skipmark,discfound) end @@ -9884,8 +9932,8 @@ local function delete_till_stop(start,stop,ignoremarks) -- keeps start local next = start.next if not marks[next.char] then local components = next.components -if components then - node.flush_list(components) +if components then -- probably not needed + flush_node_list(components) end delete_node(start,next) end @@ -9895,8 +9943,8 @@ end repeat local next = start.next local components = next.components -if components then - node.flush_list(components) +if components then -- probably not needed + flush_node_list(components) end delete_node(start,next) n = n + 1 -- cgit v1.2.3