diff options
author | Marius <mariausol@gmail.com> | 2011-01-06 18:20:16 +0200 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2011-01-06 18:20:16 +0200 |
commit | 3acd1a913a387fafef7c61d9158a5c60715a31be (patch) | |
tree | e61ff9cbab6fd543097d844b8e7d8e2701bd668c /tex | |
parent | f67b9a6b70277a30f7e7ef9a7a3913447ee525f8 (diff) | |
download | context-3acd1a913a387fafef7c61d9158a5c60715a31be.tar.gz |
beta 2011.01.06 17:08
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/back-exp.lua | 31 | ||||
-rw-r--r-- | tex/context/base/cont-new.tex | 2 | ||||
-rw-r--r-- | tex/context/base/context.tex | 2 | ||||
-rw-r--r-- | tex/context/base/m-translate.tex | 34 | ||||
-rw-r--r-- | tex/context/base/s-fnt-31.tex | 144 | ||||
-rw-r--r-- | tex/context/base/s-mod-01.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/strc-mar.lua | 4 | ||||
-rw-r--r-- | tex/context/base/type-one.mkii | 2 | ||||
-rw-r--r-- | tex/generic/context/luatex-fonts-merged.lua | 2 |
9 files changed, 195 insertions, 28 deletions
diff --git a/tex/context/base/back-exp.lua b/tex/context/base/back-exp.lua index 7185fbc29..56eea251b 100644 --- a/tex/context/base/back-exp.lua +++ b/tex/context/base/back-exp.lua @@ -44,10 +44,11 @@ local lpegmatch = lpeg.match local utfchar = utf.char local insert, remove = table.insert, table.remove -local trace_export = false trackers.register ("structures.export", function(v) trace_export = v end) -local trace_spaces = false trackers.register ("structures.export.spaces", function(v) trace_spaces = v end) -local trace_tree = false trackers.register ("structures.export.showtree", function(v) trace_tree = v end) -local less_state = false directives.register("structures.export.lessstate", function(v) less_state = v end) +local trace_export = false trackers.register ("structures.export", function(v) trace_export = v end) +local trace_spaces = false trackers.register ("structures.export.spaces", function(v) trace_spaces = v end) +local trace_tree = false trackers.register ("structures.export.showtree", function(v) trace_tree = v end) +local less_state = false directives.register("structures.export.lessstate", function(v) less_state = v end) +local page_breaks = false directives.register("structures.export.pagebreaks", function(v) page_breaks = v end) local report_export = logs.new("export") @@ -130,7 +131,7 @@ local last = nil local lastpar = nil local joiner_1 = " " -local joiner_2 = " " -- todo: test if this one can alwasy be "" +local joiner_2 = " " -- todo: test if this one can always be "" local joiner_3 = " " local joiner_4 = " " local joiner_5 = " " @@ -153,7 +154,8 @@ local spaces = { } -- watch how we also moved the -1 in depth-1 to the creator setmetatable(spaces, { __index = function(t,k) t[k] = rep(" ",k-1) return t[k] end } ) -properties.vspace = { export = "break", nature = "display" } +properties.vspace = { export = "break", nature = "display" } +properties.pbreak = { export = "pagebreak", nature = "display" } local function makebreak(entry) nofbreaks = nofbreaks + 1 @@ -717,7 +719,7 @@ local function flushtree(data) linedone = false elseif not di.collapsed then local element = di.element - if element == "break" then + if element == "break" or element == "pagebreak" then emptytag(element,nature,di.depth) else local nature, depth = di.nature, di.depth @@ -890,7 +892,9 @@ local function collectresults(head,list,p) local id = n.id -- 14: image, 8: literal (mp) if id == glyph_code then local at = has_attribute(n,a_tagged) - if at then + if not at then + report_export("skipping character: 0x%05X %s (no attribute)",n.char,utfchar(n.char)) + else -- we could add tonunicodes for ligatures local components = n.components if components then @@ -942,13 +946,15 @@ local function collectresults(head,list,p) fc = fc and fc[c] if fc then local u = fc.tounicode - if u then + if u and u ~= "" then for s in gmatch(u,"....") do -- is this ok? result[#result+1] = utfchar(tonumber(s,16)) end else result[#result+1] = utfchar(c) end + else -- weird, happens in hz (we really need to get rid of the pseudo fonts) + result[#result+1] = utfchar(c) end else result[#result+1] = utfchar(c) @@ -1024,6 +1030,13 @@ function nodes.handlers.export(head) joiner_1 = "<S1/>" joiner_2 = "<S2/>" joiner_3 = "<S3/>" joiner_4 = "<S4/>" joiner_5 = "<S5/>" joiner_6 = "<S6/>" joiner_7 = "<S7/>" joiner_8 = "<S8/>" joiner_9 = "<S9/>" joiner_0 = "<S0/>" end + if result then + -- maybe we need a better test for what is in result so far + if page_breaks then + joiner_0 = "<pagebreak/>" + end + result[#result+1] = joiner_0 + end collectresults(head) -- no flush here, pending page stuff return head, true diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index f30487135..7552c0f50 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.12.31 08:59} +\newcontextversion{2011.01.06 17:08} %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 cf8581536..544bf7765 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.12.31 08:59} +\edef\contextversion{2011.01.06 17:08} %D For those who want to use this: diff --git a/tex/context/base/m-translate.tex b/tex/context/base/m-translate.tex index 9c550eca7..25e3c8618 100644 --- a/tex/context/base/m-translate.tex +++ b/tex/context/base/m-translate.tex @@ -18,7 +18,9 @@ %D better to fix your source. \startluacode - translators = { } + local translators = { } + + moduledata.translators = translators local compiled, list = nil, nil @@ -43,27 +45,35 @@ end end - function translators.reset(s) - resolvers.install_text_filter("user",nil) - list, compiled = nil, nil + local textlineactions = resolvers.openers.helpers.textlineactions + + utilities.sequencers.appendaction(textlineactions,"after","moduledata.translators.translate") + + function translators.enable() + utilities.sequencers.enableaction(textlineactions,"moduledata.translators.translate") end - function translators.enable(s) - resolvers.install_text_filter("user",translators.translate) + + function translators.disable() + utilities.sequencers.disableaction(textlineactions,"moduledata.translators.translate") end - function translators.disable(s) - resolvers.install_text_filter("user",nil) + + function translators.reset(s) + translators.enable() + list, compiled = nil, nil end + + translators.disable() \stopluacode \unprotect \def\translateinput{\dodoubleargument\dotranslateinput} -\def\dotranslateinput[#1][#2]{\ctxlua{translators.register(\!!bs#1\!!es,\!!bs#2\!!es)}} +\def\dotranslateinput[#1][#2]{\ctxlua{moduledata.translators.register(\!!bs#1\!!es,\!!bs#2\!!es)}} -\def\resetinputtranslation {\ctxlua{translators.reset()}} -\def\enableinputtranslation {\ctxlua{translators.enable()}} -\def\disableinputtranslation{\ctxlua{translators.disable()}} +\def\resetinputtranslation {\ctxlua{moduledata.translators.reset()}} +\def\enableinputtranslation {\ctxlua{moduledata.translators.enable()}} +\def\disableinputtranslation{\ctxlua{moduledata.translators.disable()}} \def\readtranslatedfile#1% {\enableinputtranslation diff --git a/tex/context/base/s-fnt-31.tex b/tex/context/base/s-fnt-31.tex new file mode 100644 index 000000000..8ef65b204 --- /dev/null +++ b/tex/context/base/s-fnt-31.tex @@ -0,0 +1,144 @@ +\startluacode + +local format, upper, find = string.format, string.upper, string.find +local chardata = characters.data + +function fonts.tracers.coverage(fontfiles,pattern) -- todo: patterns + + local present, names = { }, { } + local pattern = pattern and upper(pattern) + + for i=1,#fontfiles do + local fontname = format("testfont-%s",i) + local fontfile = fontfiles[i] + local fontsize = tex.dimen.bodyfontsize + local id, fontdata = fonts.definers.define { + name = fontfile, + size = fontsize, + cs = fontname, + } + for k, v in next, fontdata.characters do + present[k] = true + end + names[i] = fontname + end + + context.starttabulate {"|Tr" .. string.rep("|l",#names) .. "|" } + for i=1,#names do + context.NC() + context(i) + context.NC() + -- context.getvalue(names[i]) + context.type(fontfiles[i]) + context.NC() + context.NR() + end + context.stoptabulate() + + context.starttabulate {"|Tl" .. string.rep("|c",#names) .. "|Tl|" } + context.NC() + context.type("unicode") + context.NC() + for i=1,#names do + context.type(i) + context.NC() + end + context.type("description") + context.NC() + context.NR() + context.HL() + for k, v in table.sortedpairs(present) do + local description = chardata[k].description + if not pattern or (pattern == k) or (description and find(description,pattern)) then + context.NC() + context(format("%05X",k)) + context.NC() + for i=1,#names do + context.getvalue(names[i]) + context.char(k) + context.NC() + end + context(description) + context.NC() + context.NR() + end + end + context.stoptabulate() + +end + +\stopluacode + +\doifnotmode{demo}{\endinput} + +\setupbodyfont[10pt] + +\setuplayout + [backspace=1cm, + topspace=1cm, + footer=1cm, + header=0cm, + height=middle, + width=middle] + +\starttext + +% \startluacode +% fonts.tracers.coverage { +% "pirat.ttf", +% } +% \stopluacode + +% \startluacode +% fonts.tracers.coverage { +% -- "cambria.ttf", +% "lbr.afm", +% "LucidaBrightRegular.ttf", +% "lbi.afm", +% "LucidaBrightItalic.ttf", +% "lbd.afm", +% "LucidaBrightDemiBold.ttf", +% "lbdi.afm", +% "LucidaBrightDemiItalic.ttf", +% } +% \stopluacode + +% \startluacode +% fonts.tracers.coverage ( { +% "LucidaBrightRegular.ttf", +% "cambria.ttf", +% "iwona-regular.otf", +% "texgyrepagella-regular.otf", +% "texgyretermes-regular.otf", +% "texgyrebonum-regular.otf", +% "antpolt-regular.otf", +% }, "OGONEK") +% \stopluacode + +% \loadfontgoodies[lucida-math] +% \loadfontgoodies[lm-math] + +% \startluacode +% fonts.tracers.coverage { +% "LucidaBrightRegular.ttf", +% "LucidaBrightOne@lucida-math", +% "cambria.ttc(Cambria Math)", +% "xits-math.otf", +% "LMMath10-Regular@lmroman10-math", +% } +% \stopluacode + +\loadfontgoodies[px-math] +\loadfontgoodies[lm-math] + +\startluacode + fonts.tracers.coverage { + "cambria.ttc(Cambria Math)", + "xits-math.otf", + "LMMath10-Regular@lmroman10-math", + "pxmath@px-math", + "LinLibertine_Re-4.7.5.otf", + } +\stopluacode + +\stoptext diff --git a/tex/context/base/s-mod-01.mkiv b/tex/context/base/s-mod-01.mkiv index fe42b832f..ed87346d6 100644 --- a/tex/context/base/s-mod-01.mkiv +++ b/tex/context/base/s-mod-01.mkiv @@ -37,7 +37,7 @@ [\v!big] \setuptolerance - [\v!verytolerant,\v!!stretch] + [\v!verytolerant,\v!stretch] \setuplayout [\c!backspace=3.5cm, diff --git a/tex/context/base/strc-mar.lua b/tex/context/base/strc-mar.lua index cc7e5a397..d990b4fff 100644 --- a/tex/context/base/strc-mar.lua +++ b/tex/context/base/strc-mar.lua @@ -509,8 +509,8 @@ methods[v_first_nocheck] = function(name,range) return resolve(name,range,false, methods[v_last_nocheck ] = function(name,range) return resolve(name,range,true,false,-1,false) end methods[v_current] = function(name,range) -- range is ignored here - local top = stack[#topofstack] - return top and top[name] or "" + local top = stack[topofstack] + return top and top[parentname(name)] or "" end local function fetched(name,range,method) diff --git a/tex/context/base/type-one.mkii b/tex/context/base/type-one.mkii index 140f91e61..82da8e9ff 100644 --- a/tex/context/base/type-one.mkii +++ b/tex/context/base/type-one.mkii @@ -1943,7 +1943,7 @@ \loadmapfile[q\typescriptprefix{f:\typescripttwo}-\typescriptthree.map] \stoptypescript - \starttypescript [serif] [chorus,chancery] [ec,texnansi,cs,qx,rm,t5,t2a,t2b,t2c,l7x] + \starttypescript [serif,calligraphy] [chorus,chancery] [ec,texnansi,cs,qx,rm,t5,t2a,t2b,t2c,l7x] \definefontsynonym [TeXGyreChorus-MediumItalic] [\typescriptthree-qzcmi] [encoding=\typescriptthree] \loadmapfile[qzc-\typescriptthree.map] \stoptypescript diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index a182687cd..661011901 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 : 12/31/10 08:59:52 +-- merge date : 01/06/11 17:08:04 do -- begin closure to overcome local limits and interference |