From 7635c09a0cab08e0c03efced85b6b8ffc0b508c1 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Mon, 27 Sep 2010 11:54:00 +0200 Subject: beta 2010.09.27 11:54 --- scripts/context/lua/mtx-fonts.lua | 2 +- tex/context/base/char-ini.lua | 5 +- tex/context/base/cont-new.tex | 2 +- tex/context/base/context.tex | 2 +- tex/context/base/font-otp.lua | 10 +- tex/context/base/font-syn.lua | 44 +++++-- tex/context/base/s-fnt-23.tex | 120 +++++++++---------- tex/context/base/sort-ini.lua | 180 +++++++++++++++++----------- tex/context/base/type-otf.mkiv | 1 - tex/context/fonts/antykwapoltawskiego.lfg | 80 ++++++------- tex/generic/context/luatex-fonts-merged.lua | 2 +- 11 files changed, 260 insertions(+), 188 deletions(-) diff --git a/scripts/context/lua/mtx-fonts.lua b/scripts/context/lua/mtx-fonts.lua index b64b07dd6..b42627c95 100644 --- a/scripts/context/lua/mtx-fonts.lua +++ b/scripts/context/lua/mtx-fonts.lua @@ -10,7 +10,7 @@ if not modules then modules = { } end modules ['mtx-fonts'] = { if not fontloader then fontloader = fontforge end ---~ dofile(resolvers.findfile("font-otp.lua","tex")) +dofile(resolvers.findfile("font-otp.lua","tex")) -- we need to unpack the font for analysis dofile(resolvers.findfile("font-syn.lua","tex")) dofile(resolvers.findfile("font-mis.lua","tex")) diff --git a/tex/context/base/char-ini.lua b/tex/context/base/char-ini.lua index a16178bf2..10df66e47 100644 --- a/tex/context/base/char-ini.lua +++ b/tex/context/base/char-ini.lua @@ -814,9 +814,10 @@ setmetatable(specialchars, { __index = function(t,u) if s then local t = { } for i=2,#s do - local c = data[s[i]] + local si = s[i] + local c = data[si] if is_letter[c.category] then - t[#t+1] = c + t[#t+1] = utfchar(si) end end c = concat(t) diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index 9f8b62cc3..b88f76336 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2010.09.23 11:35} +\newcontextversion{2010.09.27 11:54} %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/context.tex b/tex/context/base/context.tex index 08aa83d6b..cc9a439d2 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2010.09.23 11:35} +\edef\contextversion{2010.09.27 11:54} %D For those who want to use this: diff --git a/tex/context/base/font-otp.lua b/tex/context/base/font-otp.lua index 6453268bf..6c4f185b3 100644 --- a/tex/context/base/font-otp.lua +++ b/tex/context/base/font-otp.lua @@ -509,5 +509,11 @@ local function unpackdata(data) end end -otf.enhancers.register( "pack", packdata) -otf.enhancers.register("unpack",unpackdata) +if otf.enhancers.register then + + otf.enhancers.register( "pack", packdata) + otf.enhancers.register("unpack",unpackdata) + +end + +otf.enhancers.unpack = unpackdata -- used elsewhere diff --git a/tex/context/base/font-syn.lua b/tex/context/base/font-syn.lua index c9b9f3aee..7cd4b2a37 100644 --- a/tex/context/base/font-syn.lua +++ b/tex/context/base/font-syn.lua @@ -6,6 +6,17 @@ if not modules then modules = { } end modules ['font-syn'] = { license = "see context related readme files" } +local keyisvalue = { __index = function(t,k) + t[k] = k + return k +end } + +function table.initialysparse(t) + t = t or { } + setmetatable(t,keyisvalue) + return t +end + -- todo: subs in lookups requests local utf = unicode.utf8 @@ -79,6 +90,10 @@ local weights = Cs ( -- not extra + P("regular") / "normal" ) +local normalized_weights = table.initialysparse { + regular = "normal", +} + local styles = Cs ( P("reverseoblique") / "reverseitalic" + P("regular") / "normal" @@ -90,6 +105,12 @@ local styles = Cs ( + P("ita") / "italic" ) +local normalized_styles = table.initialysparse { + reverseoblique = "reverseitalic", + regular = "normal", + oblique = "italic", +} + local widths = Cs( P("condensed") + P("thin") @@ -99,12 +120,16 @@ local widths = Cs( + P("book") / "normal" ) +local normalized_widths = table.initialysparse() + local variants = Cs( -- fax casual P("smallcaps") + P("oldstyle") + P("caps") / "smallcaps" ) +local normalized_variants = table.initialysparse() + local any = P(1) local analyzed_table @@ -1540,10 +1565,10 @@ function names.register(files) for filename, filespec in next, list do local name = lower(filespec.name or commonname) if name and name ~= "" then - local style = lower(filespec.style or "normal") - local width = lower(filespec.width or "normal") - local weight = lower(filespec.weight or "normal") - local variant = lower(filespec.variant or "normal") + local style = normalized_styles [lower(filespec.style or "normal")] + local width = normalized_widths [lower(filespec.width or "normal")] + local weight = normalized_weights [lower(filespec.weight or "normal")] + local variant = normalized_variants[lower(filespec.variant or "normal")] local weights = specifications[name ] if not weights then weights = { } specifications[name ] = weights end local styles = weights [weight] if not styles then styles = { } weights [weight] = styles end local widths = styles [style ] if not widths then widths = { } styles [style ] = widths end @@ -1563,10 +1588,10 @@ end function names.registered(name,weight,style,width,variant) local ok = specifications[name] - ok = ok and (ok[weight and weight ~= "" and weight or "normal"] or ok[normal]) - ok = ok and (ok[style and style ~= "" and style or "normal"] or ok[normal]) - ok = ok and (ok[width and width ~= "" and width or "normal"] or ok[normal]) - ok = ok and (ok[variant and variant ~= "" and variant or "normal"] or ok[normal]) + ok = ok and (ok[(weight and weight ~= "" and weight ) or "normal"] or ok.normal) + ok = ok and (ok[(style and style ~= "" and style ) or "normal"] or ok.normal) + ok = ok and (ok[(width and width ~= "" and width ) or "normal"] or ok.normal) + ok = ok and (ok[(variant and variant ~= "" and variant) or "normal"] or ok.normal) -- -- todo: same fallbacks as with database -- @@ -1581,6 +1606,9 @@ end function names.resolvespec(askedname,sub) -- overloads previous definition local name, weight, style, width, variant = names.splitspec(askedname) + if trace_specifications then + report_names("resolving specification: %s -> name=%s, weight=%s, style=%s, width=%s, variant=%s",askedname,name,weight,style,width,variant) + end local found = names.registered(name,weight,style,width,variant) if found and found.filename then if trace_specifications then diff --git a/tex/context/base/s-fnt-23.tex b/tex/context/base/s-fnt-23.tex index dedcf06e4..d2d6f4af5 100644 --- a/tex/context/base/s-fnt-23.tex +++ b/tex/context/base/s-fnt-23.tex @@ -16,10 +16,6 @@ \startluacode local last_data = nil local format = string.format - local function tpf(...) --- print("!!!!",...) - tex.print(tex.ctxcatcodes,format(...)) - end function fonts.otf.show_shape(n) local tfmdata = fonts.ids[font.current()] last_data = tfmdata @@ -36,13 +32,13 @@ local width, italic = (d.width or 0)*factor, (d.italic or 0)*factor local top_accent, bot_accent = (d.top_accent or 0)*factor, (d.bot_accent or 0)*factor local anchors, math = d.anchors, d.math - tpf("\\startMPcode") - tpf("pickup pencircle scaled .25bp ; ") - tpf('picture p ; p := image(draw textext.drt("\\gray\\char%s");); draw p ;',charnum) - tpf('draw (%s,%s)--(%s,%s)--(%s,%s)--(%s,%s)--cycle withcolor green ;',llx,lly,urx,lly,urx,ury,llx,ury) - tpf('draw (%s,%s)--(%s,%s) withcolor green ;',llx,0,urx,0) - tpf('draw boundingbox p withcolor .2white withpen pencircle scaled .065bp ;') - tpf("defaultscale := 0.05 ; ") + context.startMPcode() + context("pickup pencircle scaled .25bp ; ") + context('picture p ; p := image(draw textext.drt("\\gray\\char%s");); draw p ;',charnum) + context('draw (%s,%s)--(%s,%s)--(%s,%s)--(%s,%s)--cycle withcolor green ;',llx,lly,urx,lly,urx,ury,llx,ury) + context('draw (%s,%s)--(%s,%s) withcolor green ;',llx,0,urx,0) + context('draw boundingbox p withcolor .2white withpen pencircle scaled .065bp ;') + context("defaultscale := 0.05 ; ") -- inefficient but non critical local function slant_1(v,dx,dy,txt,xsign,ysign,loc,labloc) if #v > 0 then @@ -53,11 +49,11 @@ l[#l+1] = format("((%s,%s) shifted (%s,%s))",xsign*k*factor,ysign*h*factor,dx,dy) end end - tpf("draw ((%s,%s) shifted (%s,%s))--%s dashed (evenly scaled .25) withcolor .5white;", xsign*v[1].kern*factor,lly,dx,dy,l[1]) - tpf("draw laddered (%s) withcolor .5white ;",table.concat(l,"..")) - tpf("draw ((%s,%s) shifted (%s,%s))--%s dashed (evenly scaled .25) withcolor .5white;", xsign*v[#v].kern*factor,ury,dx,dy,l[#l]) + context("draw ((%s,%s) shifted (%s,%s))--%s dashed (evenly scaled .25) withcolor .5white;", xsign*v[1].kern*factor,lly,dx,dy,l[1]) + context("draw laddered (%s) withcolor .5white ;",table.concat(l,"..")) + context("draw ((%s,%s) shifted (%s,%s))--%s dashed (evenly scaled .25) withcolor .5white;", xsign*v[#v].kern*factor,ury,dx,dy,l[#l]) for k, v in ipairs(l) do - tpf("draw %s withcolor blue withpen pencircle scaled 1bp;",v) + context("draw %s withcolor blue withpen pencircle scaled 1bp;",v) end end end @@ -71,14 +67,14 @@ end end if loc == "top" then - tpf('label.%s("\\type{%s}",%s shifted (0,-1bp)) ;',loc,txt,l[#l]) + context('label.%s("\\type{%s}",%s shifted (0,-1bp)) ;',loc,txt,l[#l]) else - tpf('label.%s("\\type{%s}",%s shifted (0,2bp)) ;',loc,txt,l[1]) + context('label.%s("\\type{%s}",%s shifted (0,2bp)) ;',loc,txt,l[1]) end for kk, vv in ipairs(v) do local h, k = vv.height, vv.kern if h and k then - tpf('label.top("(%s,%s)",%s shifted (0,-2bp));',k,h,l[kk]) + context('label.top("(%s,%s)",%s shifted (0,-2bp));',k,h,l[kk]) end end end @@ -103,9 +99,9 @@ end local function show(x,y,txt) local xx, yy = x*factor, y*factor - tpf("draw (%s,%s) withcolor blue withpen pencircle scaled 1bp;",xx,yy) - tpf('label.top("\\type{%s}",(%s,%s-2bp)) ;',txt,xx,yy) - tpf('label.bot("(%s,%s)",(%s,%s+2bp)) ;',x,y,xx,yy) + context("draw (%s,%s) withcolor blue withpen pencircle scaled 1bp;",xx,yy) + context('label.top("\\type{%s}",(%s,%s-2bp)) ;',txt,xx,yy) + context('label.bot("(%s,%s)",(%s,%s+2bp)) ;',x,y,xx,yy) end if anchors then local a = anchors.baselig @@ -142,59 +138,59 @@ end end if italic ~= 0 then - tpf('draw (%s,%s-1bp)--(%s,%s-0.5bp) withcolor blue;',width,ury,width,ury) - tpf('draw (%s,%s-1bp)--(%s,%s-0.5bp) withcolor blue;',width+italic,ury,width+italic,ury) - tpf('draw (%s,%s-1bp)--(%s,%s-1bp) withcolor blue;',width,ury,width+italic,ury) - tpf('label.lft("\\type{%s}",(%s+2bp,%s-1bp));',"italic",width,ury) - tpf('label.rt("%s",(%s-2bp,%s-1bp));',d.italic,width+italic,ury) + context('draw (%s,%s-1bp)--(%s,%s-0.5bp) withcolor blue;',width,ury,width,ury) + context('draw (%s,%s-1bp)--(%s,%s-0.5bp) withcolor blue;',width+italic,ury,width+italic,ury) + context('draw (%s,%s-1bp)--(%s,%s-1bp) withcolor blue;',width,ury,width+italic,ury) + context('label.lft("\\type{%s}",(%s+2bp,%s-1bp));',"italic",width,ury) + context('label.rt("%s",(%s-2bp,%s-1bp));',d.italic,width+italic,ury) end if top_accent ~= 0 then - tpf('draw (%s,%s+1bp)--(%s,%s-1bp) withcolor blue;',top_accent,ury,top_accent,ury) - tpf('label.bot("\\type{%s}",(%s,%s+1bp));',"top_accent",top_accent,ury) - tpf('label.top("%s",(%s,%s-1bp));',d.top_accent,top_accent,ury) + context('draw (%s,%s+1bp)--(%s,%s-1bp) withcolor blue;',top_accent,ury,top_accent,ury) + context('label.bot("\\type{%s}",(%s,%s+1bp));',"top_accent",top_accent,ury) + context('label.top("%s",(%s,%s-1bp));',d.top_accent,top_accent,ury) end if bot_accent ~= 0 then - tpf('draw (%s,%s+1bp)--(%s,%s-1bp) withcolor blue;',bot_accent,lly,bot_accent,lly) - tpf('label.top("\\type{%s}",(%s,%s-1bp));',"bot_accent",top_accent,ury) - tpf('label.bot("%s",(%s,%s+1bp));',d.bot_accent,bot_accent,lly) + context('draw (%s,%s+1bp)--(%s,%s-1bp) withcolor blue;',bot_accent,lly,bot_accent,lly) + context('label.top("\\type{%s}",(%s,%s-1bp));',"bot_accent",top_accent,ury) + context('label.bot("%s",(%s,%s+1bp));',d.bot_accent,bot_accent,lly) end - tpf('draw origin withcolor red withpen pencircle scaled 1bp;') - tpf("setbounds currentpicture to boundingbox currentpicture enlarged 1bp ;") - tpf("currentpicture := currentpicture scaled 8 ;") - tpf("\\stopMPcode") + context('draw origin withcolor red withpen pencircle scaled 1bp;') + context("setbounds currentpicture to boundingbox currentpicture enlarged 1bp ;") + context("currentpicture := currentpicture scaled 8 ;") + context.stopMPcode() elseif c then local factor = (7200/7227)/65536 - tpf("\\startMPcode") - tpf("pickup pencircle scaled .25bp ; ") - tpf('picture p ; p := image(draw textext.drt("\\gray\\char%s");); draw p ;',charnum) - tpf('draw boundingbox p withcolor .2white withpen pencircle scaled .065bp ;') - tpf("defaultscale := 0.05 ; ") + context.startMPcode() + context("pickup pencircle scaled .25bp ; ") + context('picture p ; p := image(draw textext.drt("\\gray\\char%s");); draw p ;',charnum) + context('draw boundingbox p withcolor .2white withpen pencircle scaled .065bp ;') + context("defaultscale := 0.05 ; ") local italic, top_accent, bot_accent = (c.italic or 0)*factor, (c.top_accent or 0)*factor, (c.bot_accent or 0)*factor local width, height, depth = (c.width or 0)*factor, (c.height or 0)*factor, (c.depth or 0)*factor local ury = height if italic ~= 0 then - tpf('draw (%s,%s-1bp)--(%s,%s-0.5bp) withcolor blue;',width,ury,width,ury) - tpf('draw (%s,%s-1bp)--(%s,%s-0.5bp) withcolor blue;',width+italic,ury,width+italic,ury) - tpf('draw (%s,%s-1bp)--(%s,%s-1bp) withcolor blue;',width,ury,width+italic,height) - tpf('label.lft("\\type{%s}",(%s+2bp,%s-1bp));',"italic",width,height) - tpf('label.rt("%6.3f bp",(%s-2bp,%s-1bp));',italic,width+italic,height) + context('draw (%s,%s-1bp)--(%s,%s-0.5bp) withcolor blue;',width,ury,width,ury) + context('draw (%s,%s-1bp)--(%s,%s-0.5bp) withcolor blue;',width+italic,ury,width+italic,ury) + context('draw (%s,%s-1bp)--(%s,%s-1bp) withcolor blue;',width,ury,width+italic,height) + context('label.lft("\\type{%s}",(%s+2bp,%s-1bp));',"italic",width,height) + context('label.rt("%6.3f bp",(%s-2bp,%s-1bp));',italic,width+italic,height) end if top_accent ~= 0 then - tpf('draw (%s,%s+1bp)--(%s,%s-1bp) withcolor blue;',top_accent,ury,top_accent,height) - tpf('label.bot("\\type{%s}",(%s,%s+1bp));',"top_accent",top_accent,height) - tpf('label.top("%6.3f bp",(%s,%s-1bp));',top_accent,top_accent,height) + context('draw (%s,%s+1bp)--(%s,%s-1bp) withcolor blue;',top_accent,ury,top_accent,height) + context('label.bot("\\type{%s}",(%s,%s+1bp));',"top_accent",top_accent,height) + context('label.top("%6.3f bp",(%s,%s-1bp));',top_accent,top_accent,height) end if bot_accent ~= 0 then - tpf('draw (%s,%s+1bp)--(%s,%s-1bp) withcolor blue;',bot_accent,lly,bot_accent,height) - tpf('label.top("\\type{%s}",(%s,%s-1bp));',"bot_accent",top_accent,height) - tpf('label.bot("%6.3f bp",(%s,%s+1bp));',bot_accent,bot_accent,height) + context('draw (%s,%s+1bp)--(%s,%s-1bp) withcolor blue;',bot_accent,lly,bot_accent,height) + context('label.top("\\type{%s}",(%s,%s-1bp));',"bot_accent",top_accent,height) + context('label.bot("%6.3f bp",(%s,%s+1bp));',bot_accent,bot_accent,height) end - tpf('draw origin withcolor red withpen pencircle scaled 1bp;') - tpf("setbounds currentpicture to boundingbox currentpicture enlarged 1bp ;") - tpf("currentpicture := currentpicture scaled 8 ;") - tpf("\\stopMPcode") + context('draw origin withcolor red withpen pencircle scaled 1bp;') + context("setbounds currentpicture to boundingbox currentpicture enlarged 1bp ;") + context("currentpicture := currentpicture scaled 8 ;") + context.stopMPcode() else - tpf("no such shape: %s",n) + context("no such shape: %s",n) end end function fonts.otf.show_all_shapes(start,stop) @@ -205,10 +201,10 @@ for _, unicode in next, table.sortedkeys(descriptions) do local d = descriptions[unicode] local name = d.name - tpf("%s{%s}%%",start,unicode) - tpf("\\writestatus{glyph}{U+%04X -> %s}%%",unicode,name) + context("%s{%s}%%",start,unicode) + context("\\writestatus{glyph}{U+%04X -> %s}%%",unicode,name) fonts.otf.show_shape(unicode) - tpf(stop) + context(stop) end end function fonts.otf.show_shape_field(unicode,name) @@ -216,11 +212,11 @@ local d = tfmdata.descriptions[unicode] if d then if name == "unicode" then - tpf("U+%04X",unicode) + context("U+%04X",unicode) else d = d[name] if d then - tpf(d) + context(d) end end end diff --git a/tex/context/base/sort-ini.lua b/tex/context/base/sort-ini.lua index 5cecafb6e..eca0e68c5 100644 --- a/tex/context/base/sort-ini.lua +++ b/tex/context/base/sort-ini.lua @@ -38,6 +38,15 @@ local shchars = characters.shchars local variables = interfaces.variables +local validmethods = table.tohash{ "mm", "zm", "pm", "mc", "zc", "pc", "uc" } + +local predefinedmethods = { + [variables.before] = "mm,mc,uc", + [variables.after] = "pm,mc,uc", + [variables.first] = "pc,mm,uc", + [variables.last] = "mc,mm,uc", +} + sorters = { comparers = comparers, splitters = splitters, @@ -49,7 +58,7 @@ sorters = { digitsoffset = digitsoffset, digitsmaximum = digitsmaximum, defaultlanguage = variables.default, - defaultmethod = variables.before, + defaultmethod = "before", } } @@ -57,7 +66,7 @@ local sorters = sorters local constants = sorters.constants local data, language, method -local replacements, mappings, entries, orders, lower, upper +local replacements, m_mappings, z_mappings, p_mappings, entries, orders, lower, upper, method, sequence --~ local shchars = characters.specialchars -- no specials for AE and ae @@ -90,12 +99,12 @@ local mte = { } local function preparetables(data) - local orders, lower, method, mappings = data.orders, data.lower, data.method, { } + local orders, lower, m_mappings, z_mappings, p_mappings = data.orders, data.lower, { }, { }, { } for i=1,#orders do local oi = orders[i] - mappings[oi] = { 2*i } + local n = { 2 * i } + m_mappings[oi], z_mappings[oi], p_mappings[oi] = n, n, n end - local delta = (method == variables.before or method == variables.first or method == variables.last) and -1 or 1 local mtm = { __index = function(t,k) local n @@ -112,7 +121,7 @@ local function preparetables(data) if ml then n = { } for i=1,#ml do - n[#n+1] = ml[i] + delta + n[#n+1] = ml[i] + (t.__delta or 0) end if trace_tests then report_sorters(" 2 order: %s",concat(n," ")) @@ -146,7 +155,7 @@ local function preparetables(data) local ml = rawget(t,l) if ml then for i=1,#ml do - n[#n+1] = ml[i] + delta + n[#n+1] = ml[i] + (t.__delta or 0) end end end @@ -173,10 +182,16 @@ local function preparetables(data) return n end } - data.mappings = mappings + data.m_mappings = m_mappings + data.z_mappings = z_mappings + data.p_mappings = p_mappings + m_mappings.__delta = -1 + z_mappings.__delta = 0 + p_mappings.__delta = 1 setmetatable(data.entries,mte) - setmetatable(data.mappings,mtm) - return mappings + setmetatable(data.m_mappings,mtm) + setmetatable(data.z_mappings,mtm) + setmetatable(data.p_mappings,mtm) end local function update() -- prepare parent chains, needed when new languages are added @@ -185,9 +200,11 @@ local function update() -- prepare parent chains, needed when new languages are if language ~= "default" then setmetatable(data,{ __index = definitions[parent] or definitions.default }) end - data.language = language - data.parent = parent - data.mappings = { } -- free temp data + data.language = language + data.parent = parent + data.m_mappings = { } -- free temp data + data.z_mappings = { } -- free temp data + data.p_mappings = { } -- free temp data end end @@ -198,13 +215,32 @@ local function setlanguage(l,m) if trace_tests then report_sorters("setting language '%s', method '%s'",language,method) end - data.method = method replacements = data.replacements entries = data.entries orders = data.orders lower = data.lower upper = data.upper - mappings = preparetables(data) + preparetables(data) + m_mappings = data.m_mappings + z_mappings = data.z_mappings + p_mappings = data.p_mappings + -- + method = predefinedmethods[method] or method + data.method = method + -- + local seq = utilities.parsers.settings_to_array(method or "") -- check the list + sequence = { } + for i=1,#seq do + local s = seq[i] + if validmethods[s] then + sequence[#sequence+1] = s + else + report_sorters("invalid sorter method '%s' in '%s'",s,method) + end + end + data.sequence = sequence + report_sorters("using sort sequence: %s",concat(sequence," ")) + -- return data end @@ -269,12 +305,13 @@ function comparers.basic(a,b) -- trace ea and eb local na, nb = #ea, #eb if na == 0 and nb == 0 then -- simple variant (single word) - local result = basicsort(ea.m,eb.m) - if result == 0 then - result = basicsort(ea.c,eb.c) - end - if result == 0 then - result = basicsort(ea.u,eb.u) + local result = 0 + for j=1,#sequence do + local m = sequence[j] + result = basicsort(ea[m],eb[m]) + if result ~= 0 then + return result + end end return result else @@ -282,17 +319,15 @@ function comparers.basic(a,b) -- trace ea and eb local result = 0 for i=1,nb < na and nb or na do local eai, ebi = ea[i], eb[i] - if result == 0 then - result = basicsort(eai.m,ebi.m) - end - if result == 0 then - result = basicsort(eai.c,ebi.c) - end - if result == 0 then - result = basicsort(eai.u,ebi.u) + for j=1,#sequence do + local m = sequence[j] + result = basicsort(eai[m],ebi[m]) + if result ~= 0 then + return result + end end if result ~= 0 then - break + return result end end if result ~= 0 then @@ -334,9 +369,9 @@ local function firstofsplit(entry) -- numbers are left padded by spaces local split = entry.split if #split > 0 then - split = split[1].s + split = split[1].ch else - split = split.s + split = split.ch end local entry = split and split[1] or "" return entry, entries[entry] or "\000" @@ -344,6 +379,9 @@ end sorters.firstofsplit = firstofsplit +-- for the moment we use an inefficient bunch of tables but once +-- we know what combinations make sense we can optimize this + function splitters.utf(str) -- we could append m and u but this is cleaner, s is for tracing if #replacements > 0 then -- todo make an lpeg for this @@ -352,49 +390,53 @@ function splitters.utf(str) -- we could append m and u but this is cleaner, s is str = gsub(str,v[1],v[2]) end end - local s, u, m, c, n = { }, { }, { }, { }, 0 - if method == variables.last then - for sc in utfcharacters(str) do - local b = utfbyte(sc) - local l = lower[sc] - l = l and utfbyte(l) or lccodes[b] - if l ~= b then l = l - 1 end -- brrrr, can clash - n = n + 1 - s[n], u[n], m[n] = sc, b, l - local msc = mappings[sc] - for i=1,#msc do - c[#c+1] = msc[i] - end + + local m_case, z_case, p_case, m_mapping, z_mapping, p_mapping, char, byte, n = { }, { }, { }, { }, { }, { }, { }, { }, 0 + for sc in utfcharacters(str) do + local b = utfbyte(sc) + local l = lower[sc] + n = n + 1 + l = l and utfbyte(l) or lccodes[b] + z_case[n] = l + if l ~= b then + m_case[n] = l - 1 + p_case[n] = l + 1 + else + m_case[n] = l + p_case[n] = l end - elseif method == variables.first then - for sc in utfcharacters(str) do - local b = utfbyte(sc) - local l = lower[sc] - l = l and utfbyte(l) or lccodes[b] - if l ~= b then l = l + 1 end -- brrrr, can clash - n = n + 1 - s[n], u[n], m[n] = sc, b, l - local msc = mappings[sc] - for i=1,#msc do - c[#c+1] = msc[i] - end + char[n], byte[n] = sc, b + local msc = m_mappings[sc] + for i=1,#msc do + m_mapping[#m_mapping+1] = msc[i] end - else - for sc in utfcharacters(str) do - local b = utfbyte(sc) - n = n + 1 - s[n], u[n], c[n] = sc, b, b - local msc = mappings[sc] - for i=1,#msc do - m[#m+1] = msc[i] - end + local zsc = z_mappings[sc] + for i=1,#zsc do + z_mapping[#z_mapping+1] = zsc[i] + end + local psc = p_mappings[sc] + for i=1,#psc do + p_mapping[#p_mapping+1] = psc[i] end end - local t = { s = s, m = m, u = u, c = c } + + local t = { + ch = char, + uc = byte, + mc = m_case, + zc = z_case, + pc = p_case, + mm = m_mapping, + zm = z_mapping, + pm = p_mapping, + } + -- table.print(t) + return t end + function table.remap(t) local tt = { } for k,v in next, t do @@ -408,7 +450,7 @@ local function pack(entry) local split = entry.split if #split > 0 then for i=1,#split do - local tt, li = { }, split[i].s + local tt, li = { }, split[i].ch for j=1,#li do local lij = li[j] tt[j] = utfbyte(lij) > ignoredoffset and "[]" or lij @@ -417,7 +459,7 @@ local function pack(entry) end return concat(t," + ") else - local t, li = { }, split.s + local t, li = { }, split.ch for j=1,#li do local lij = li[j] t[j] = utfbyte(lij) > ignoredoffset and "[]" or lij diff --git a/tex/context/base/type-otf.mkiv b/tex/context/base/type-otf.mkiv index 07ed5d008..2a710a528 100644 --- a/tex/context/base/type-otf.mkiv +++ b/tex/context/base/type-otf.mkiv @@ -137,7 +137,6 @@ \stoptypescript \starttypescript [mono] [modern,modern-variable,modern-condensed,latin-modern,latin-modern-variable,latin-modern-condensed,computer-modern] - \definefontsynonym [LMTypewriter8-Regular] [\s!file:lmmono8-regular] [\s!features=\s!none] \definefontsynonym [LMTypewriter9-Regular] [\s!file:lmmono9-regular] [\s!features=\s!none] \definefontsynonym [LMTypewriter10-Regular] [\s!file:lmmono10-regular] [\s!features=\s!none] diff --git a/tex/context/fonts/antykwapoltawskiego.lfg b/tex/context/fonts/antykwapoltawskiego.lfg index ee4ea6dcd..0cd6f53bb 100644 --- a/tex/context/fonts/antykwapoltawskiego.lfg +++ b/tex/context/fonts/antykwapoltawskiego.lfg @@ -9,203 +9,203 @@ return { list = { ["AntPoltLtCond-Regular.otf"] = { -- name = "antykwapoltawskiego", - style = "regular", weight = "light", + style = "regular", width = "condensed", }, ["AntPoltLtCond-Italic.otf"] = { - style = "italic", weight = "light", + style = "italic", width = "condensed", }, ["AntPoltCond-Regular.otf"] = { - style = "regular", weight = "normal", + style = "regular", width = "condensed", }, ["AntPoltCond-Italic.otf"] = { - style = "italic", weight = "normal", + style = "italic", width = "condensed", }, ["AntPoltLtCond-Bold.otf"] = { - style = "regular", weight = "medium", + style = "regular", width = "condensed", }, ["AntPoltLtCond-BoldItalic.otf"] = { - style = "italic", weight = "medium", + style = "italic", width = "condensed", }, ["AntPoltCond-Bold.otf"] = { - style = "regular", weight = "bold", + style = "regular", width = "condensed", }, ["AntPoltCond-BoldItalic.otf"] = { - style = "italic", weight = "bold", + style = "italic", width = "condensed", }, ["AntPoltLtSemiCond-Regular.otf"] = { - style = "regular", weight = "light", + style = "regular", width = "semicondensed", }, ["AntPoltLtSemiCond-Italic.otf"] = { - style = "italic", weight = "light", + style = "italic", width = "semicondensed", }, ["AntPoltSemiCond-Regular.otf"] = { - style = "regular", weight = "normal", + style = "regular", width = "semicondensed", }, ["AntPoltSemiCond-Italic.otf"] = { - style = "italic", weight = "normal", + style = "italic", width = "semicondensed", }, ["AntPoltLtSemiCond-Bold.otf"] = { - style = "regular", weight = "medium", + style = "regular", width = "semicondensed", }, ["AntPoltLtSemiCond-BoldItalic.otf"] = { - style = "italic", weight = "medium", + style = "italic", width = "semicondensed", }, ["AntPoltSemiCond-Bold.otf"] = { - style = "regular", weight = "bold", + style = "regular", width = "semicondensed", }, ["AntPoltSemiCond-BoldItalic.otf"] = { - style = "italic", weight = "bold", + style = "italic", width = "semicondensed", }, ["AntPoltLt-Regular.otf"] = { - style = "regular", weight = "light", + style = "regular", width = "normal", }, ["AntPoltLt-Italic.otf"] = { - style = "italic", weight = "light", + style = "italic", width = "normal", }, ["AntPolt-Regular.otf"] = { - style = "regular", weight = "normal", + style = "regular", width = "normal", }, ["AntPolt-Italic.otf"] = { - style = "italic", weight = "normal", + style = "italic", width = "normal", }, ["AntPoltLt-Bold.otf"] = { - style = "regular", weight = "medium", + style = "regular", width = "normal", }, ["AntPoltLt-BoldItalic.otf"] = { - style = "italic", weight = "medium", + style = "italic", width = "normal", }, ["AntPolt-Bold.otf"] = { - style = "regular", weight = "bold", + style = "regular", width = "normal", }, ["AntPolt-BoldItalic.otf"] = { - style = "italic", weight = "bold", + style = "italic", width = "normal", }, ["AntPoltLtSemiExpd-Regular.otf"] = { - style = "regular", weight = "light", + style = "regular", width = "semiexpanded", }, ["AntPoltLtSemiExpd-Italic.otf"] = { - style = "italic", weight = "light", + style = "italic", width = "semiexpanded", }, ["AntPoltSemiExpd-Regular.otf"] = { - style = "regular", weight = "normal", + style = "regular", width = "semiexpanded", }, ["AntPoltSemiExpd-Italic.otf"] = { - style = "italic", weight = "normal", + style = "italic", width = "semiexpanded", }, ["AntPoltLtSemiExpd-Bold.otf"] = { - style = "regular", weight = "medium", + style = "regular", width = "semiexpanded", }, ["AntPoltLtSemiExpd-BoldItalic.otf"] = { - style = "italic", weight = "medium", + style = "italic", width = "semiexpanded", }, ["AntPoltSemiExpd-Bold.otf"] = { - style = "regular", weight = "bold", + style = "regular", width = "semiexpanded", }, ["AntPoltSemiExpd-BoldItalic.otf"] = { - style = "italic", weight = "bold", + style = "italic", width = "semiexpanded", }, ["AntPoltLtExpd-Regular.otf"] = { - style = "regular", weight = "light", + style = "regular", width = "expanded", }, ["AntPoltLtExpd-Italic.otf"] = { - style = "italic", weight = "light", + style = "italic", width = "expanded", }, ["AntPoltExpd-Regular.otf"] = { + weight = "normal", style = "regular", width = "expanded", - weight = "normal", }, ["AntPoltExpd-Italic.otf"] = { + weight = "normal", style = "italic", width = "expanded", - weight = "normal", }, ["AntPoltLtExpd-Bold.otf"] = { + weight = "medium", style = "regular", width = "expanded", - weight = "medium", }, ["AntPoltLtExpd-BoldItalic.otf"] = { + weight = "medium", style = "italic", width = "expanded", - weight = "medium", }, ["AntPoltExpd-Bold.otf"] = { - style = "regular", weight = "bold", + style = "regular", width = "expanded", }, ["AntPoltExpd-BoldItalic.otf"] = { - style = "italic", weight = "bold", + style = "italic", width = "expanded", }, }, diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 1cd549c18..d58d5ac90 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 09/24/10 11:40:36 +-- merge date : 09/27/10 11:54:49 do -- begin closure to overcome local limits and interference -- cgit v1.2.3