diff options
author | Hans Hagen <pragma@wxs.nl> | 2017-07-30 00:12:09 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2017-07-30 00:12:09 +0200 |
commit | 488dc02c27841eced466d9b6594666c923fef649 (patch) | |
tree | 4f47b6abe28679284a27f6edcfa1f4e7af782730 /tex | |
parent | c6715fb7e284831f7172cbac1df945f63c0abbed (diff) | |
download | context-488dc02c27841eced466d9b6594666c923fef649.tar.gz |
2017-07-29 23:14:00
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/mkii/cont-new.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/mkii/context.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/font-fbk.lua | 16 | ||||
-rw-r--r-- | tex/context/base/mkiv/font-ots.lua | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/status-files.pdf | bin | 25743 -> 25748 bytes | |||
-rw-r--r-- | tex/context/base/mkiv/status-lua.pdf | bin | 426318 -> 426317 bytes | |||
-rw-r--r-- | tex/context/base/mkiv/strc-ren.mkiv | 6 | ||||
-rw-r--r-- | tex/context/base/mkiv/trac-vis.lua | 160 | ||||
-rw-r--r-- | tex/context/base/mkiv/trac-vis.mkiv | 3 | ||||
-rw-r--r-- | tex/context/base/mkiv/typo-itc.lua | 8 | ||||
-rw-r--r-- | tex/context/interface/mkiv/context-en.xml | 1 | ||||
-rw-r--r-- | tex/context/interface/mkiv/i-context.pdf | bin | 848083 -> 848226 bytes | |||
-rw-r--r-- | tex/context/interface/mkiv/i-readme.pdf | bin | 60775 -> 60775 bytes | |||
-rw-r--r-- | tex/context/interface/mkiv/i-visualizer.xml | 2 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 4 |
17 files changed, 110 insertions, 100 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 6b7505b9d..270ec5086 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2017.07.28 22:51} +\newcontextversion{2017.07.29 23: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/mkii/context.mkii b/tex/context/base/mkii/context.mkii index 1a3a8d816..a6d1ac5d8 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2017.07.28 22:51} +\edef\contextversion{2017.07.29 23:08} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index ce26b17dc..8db3813cb 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2017.07.28 22:51} +\newcontextversion{2017.07.29 23:08} %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/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 03c954ab9..4685eef17 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -41,7 +41,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2017.07.28 22:51} +\edef\contextversion{2017.07.29 23:08} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/font-fbk.lua b/tex/context/base/mkiv/font-fbk.lua index 5008887b8..8c706e9f6 100644 --- a/tex/context/base/mkiv/font-fbk.lua +++ b/tex/context/base/mkiv/font-fbk.lua @@ -65,10 +65,10 @@ local function composecharacters(tfmdata) local vfspecials = backends.tables.vfspecials --brr local red, green, blue, black if trace_combining_visualize then - red = vfspecials.red - green = vfspecials.green - blue = vfspecials.blue - black = vfspecials.black + red = vfspecials.startcolor("red") + green = vfspecials.startcolor("green") + blue = vfspecials.startcolor("blue") + black = vfspecials.stopcolor end local compose = fonts.goodies.getcompositions(tfmdata) if compose and trace_combining_visualize then @@ -214,15 +214,15 @@ local function composecharacters(tfmdata) dy = - deltaxheight + extraxheight end if trace_combining_visualize then - t.commands = { push, {"right", dx+dd}, {"down", dy}, green, acc_t, black, pop, chr_t } + t.commands = { push, { "right", dx+dd }, { "down", dy }, green, acc_t, black, pop, chr_t } else - t.commands = { push, {"right", dx+dd}, {"down", dy}, acc_t, pop, chr_t } + t.commands = { push, { "right", dx+dd }, { "down", dy }, acc_t, pop, chr_t } end else if trace_combining_visualize then - t.commands = { push, {"right", dx+dd}, blue, acc_t, black, pop, chr_t } + t.commands = { push, { "right", dx+dd }, blue, acc_t, black, pop, chr_t } else - t.commands = { push, {"right", dx+dd}, acc_t, pop, chr_t } + t.commands = { push, { "right", dx+dd }, acc_t, pop, chr_t } end end end diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua index 1c0a6c063..fa779a6af 100644 --- a/tex/context/base/mkiv/font-ots.lua +++ b/tex/context/base/mkiv/font-ots.lua @@ -2893,7 +2893,7 @@ local function optimized_handle_contextchain(head,start,dataset,sequence,context local n = f + 1 last = startnext -- the second in current (first already matched) while n <= l do - if not last and postreplace then + if postreplace and not last then last = getnext(sweepnode) sweeptype = nil end diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex f0f17a95f..8d8045647 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 2cc639bf2..3caa8ff2c 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/strc-ren.mkiv b/tex/context/base/mkiv/strc-ren.mkiv index 132f0f115..93463b095 100644 --- a/tex/context/base/mkiv/strc-ren.mkiv +++ b/tex/context/base/mkiv/strc-ren.mkiv @@ -373,6 +373,10 @@ % \nonoindentation % recently added, was a bug % \fi} +\def\strc_sectioning_stay_on_this_line + {\directcheckedvspacing{\v!samepage,-\v!line}% + \directcheckedvspacing\v!disable} + \def\strc_rendering_stop_placement {\n_strc_rendering_hang_lines\zerocount \ifconditional\headisdisplay @@ -409,7 +413,7 @@ \unhbox\b_strc_rendering_head \getheadsyncs \ifconditional\headissomewhere - % nothing special + \strc_sectioning_stay_on_this_line % test case: alternative=margintext and \startparagraph .. \else %\hskip\headnumberdistance\s!plus\headnumberdistance\s!minus.25\dimexpr\headnumberdistance\relax \hskip\headtextdistance\relax diff --git a/tex/context/base/mkiv/trac-vis.lua b/tex/context/base/mkiv/trac-vis.lua index d53b1191a..0dccc8d89 100644 --- a/tex/context/base/mkiv/trac-vis.lua +++ b/tex/context/base/mkiv/trac-vis.lua @@ -12,22 +12,16 @@ local gmatch = string.gmatch local formatters = string.formatters local compactfloat = number.compactfloat --- This module started out in the early days of mkiv and luatex with --- visualizing kerns related to fonts. In the process of cleaning up the --- visual debugger code it made sense to integrate some other code that --- I had laying around and replace the old supp-vis debugging code. As --- only a subset of the old visual debugger makes sense it has become a --- different implementation. Soms of the m-visual functionality will also --- be ported. The code is rather trivial. The caching is not really needed --- but saves upto 50% of the time needed to add visualization. Of course --- the overall runtime is larger because of color and layer processing in --- the backend (can be times as much) so the runtime is somewhat larger --- with full visualization enabled. In practice this will never happen --- unless one is demoing. - --- We could use pdf literals and re stream codes but it's not worth the --- trouble because we would end up in color etc mess. Maybe one day I'll --- make a nodeinjection variant. +-- This module started out in the early days of mkiv and luatex with visualizing +-- kerns related to fonts. In the process of cleaning up the visual debugger code it +-- made sense to integrate some other code that I had laying around and replace the +-- old supp-vis debugging code. As only a subset of the old visual debugger makes +-- sense it has become a different implementation. Soms of the m-visual +-- functionality will also be ported. The code is rather trivial. The caching is not +-- really needed but saves upto 50% of the time needed to add visualization. Of +-- course the overall runtime is larger because of color and layer processing in the +-- backend (can be times as much) so the runtime is somewhat larger with full +-- visualization enabled. In practice this will never happen unless one is demoing. -- todo: global switch (so no attributes) -- todo: maybe also xoffset, yoffset of glyph @@ -37,32 +31,6 @@ local compactfloat = number.compactfloat -- todo: dir and localpar nodes local nodecodes = nodes.nodecodes -local disc_code = nodecodes.disc -local kern_code = nodecodes.kern -local glyph_code = nodecodes.glyph -local hlist_code = nodecodes.hlist -local vlist_code = nodecodes.vlist -local glue_code = nodecodes.glue -local penalty_code = nodecodes.penalty -local whatsit_code = nodecodes.whatsit -local user_code = nodecodes.user -local math_code = nodecodes.math -local gluespec_code = nodecodes.gluespec - -local kerncodes = nodes.kerncodes -local font_kern_code = kerncodes.fontkern -local user_kern_code = kerncodes.userkern - -local gluecodes = nodes.gluecodes -local cleaders_code = gluecodes.cleaders -local userskip_code = gluecodes.userskip -local space_code = gluecodes.space -local xspace_code = gluecodes.xspace -local leftskip_code = gluecodes.leftskip -local rightskip_code = gluecodes.rightskip - -local whatsitcodes = nodes.whatsitcodes -local mathcodes = nodes.mathcodes local nuts = nodes.nuts local tonut = nuts.tonut @@ -446,19 +414,17 @@ end local caches = setmetatableindex("table") -local fontkern do +local fontkern, italickern do local f_cache = caches["fontkern"] + local i_cache = caches["italickern"] - fontkern = function(head,current) + local function somekern(head,current,cache,color,layer) local width = getkern(current) local extra = getfield(current,"expansion_factor") local kern = width + extra - local info = f_cache[kern] - -- report_visualize("fontkern: %p ex %p",width,extra) - if info then - -- print("hit fontkern") - else + local info = cache[kern] + if not info then local text = hpack_string(formatters[" %0.3f"](kern*pt_factor),usedfont) local rule = new_rule(emwidth/fraction,6*exheight,2*exheight) local list = getlist(text) @@ -469,18 +435,26 @@ local fontkern do else setlistcolor(list,c_zero_d) end - setlisttransparency(list,c_text_d) - setcolor(rule,c_text_d) - settransparency(rule,c_text_d) + setlisttransparency(list,color) + setcolor(rule,color) + settransparency(rule,color) setshift(text,-5 * exheight) info = new_hlist(setlink(rule,text)) - setattr(info,a_layer,l_fontkern) + setattr(info,a_layer,layer) f_cache[kern] = info end head = insert_node_before(head,current,copy_list(info)) return head, current end + fontkern = function(head,current) + return somekern(head,current,f_cache,c_text_d,l_fontkern) + end + + italickern = function(head,current) + return somekern(head,current,i_cache,c_glyph_d,l_italic) + end + end local glyphexpansion do @@ -492,9 +466,7 @@ local glyphexpansion do if extra ~= 0 then extra = extra / 1000 local info = f_cache[extra] - if info then - -- print("hit fontkern") - else + if not info then local text = hpack_string(compactfloat(extra,"%.1f"),usedfont) local rule = new_rule(emwidth/fraction,exheight,2*exheight) local list = getlist(text) @@ -528,9 +500,7 @@ local kernexpansion do if extra ~= 0 then extra = extra / 1000 local info = f_cache[extra] - if info then - -- print("hit fontkern") - else + if not info then local text = hpack_string(compactfloat(extra,"%.1f"),usedfont) local rule = new_rule(emwidth/fraction,exheight,4*exheight) local list = getlist(text) @@ -557,9 +527,10 @@ end local whatsit do - local w_cache = caches["whatsit"] + local whatsitcodes = nodes.whatsitcodes + local w_cache = caches["whatsit"] - local tags = { + local tags = { open = "FIC", write = "FIW", close = "FIC", @@ -625,12 +596,12 @@ end local math do - local m_cache = { + local mathcodes = nodes.mathcodes + local m_cache = { beginmath = caches["bmath"], endmath = caches["emath"], } - - local tags = { + local tags = { beginmath = "B", endmath = "E", } @@ -799,13 +770,13 @@ local ruledbox do if next then setlink(info,next) end - if prev then - if getid(prev) == gluespec_code then - report_visualize("ignoring invalid prev") - -- weird, how can this happen, an inline glue-spec, probably math - else + if prev and prev > 0 then + -- if getid(prev) == gluespec_code then + -- report_visualize("ignoring invalid prev") + -- -- weird, how can this happen, an inline glue-spec, probably math + -- else setlink(prev,info) - end + -- end end if head == current then return info, info @@ -923,6 +894,14 @@ end local ruledglue do + local gluecodes = nodes.gluecodes + local cleaders_code = gluecodes.cleaders + local userskip_code = gluecodes.userskip + local space_code = gluecodes.space + local xspace_code = gluecodes.xspace + local leftskip_code = gluecodes.leftskip + local rightskip_code = gluecodes.rightskip + local g_cache_v = caches["vglue"] local g_cache_h = caches["hglue"] @@ -1029,9 +1008,7 @@ local ruleditalic do ruleditalic = function(head,current) local kern = getkern(current) local info = i_cache[kern] - if info then - -- print("kern hit") - else + if not info then local amount = formatters["%s:%0.3f"]("IC",kern*pt_factor) if kern > 0 then info = sometext(amount,l_kern,c_positive) @@ -1106,6 +1083,22 @@ end do + local disc_code = nodecodes.disc + local kern_code = nodecodes.kern + local glyph_code = nodecodes.glyph + local glue_code = nodecodes.glue + local penalty_code = nodecodes.penalty + local whatsit_code = nodecodes.whatsit + local user_code = nodecodes.user + local math_code = nodecodes.math + local hlist_code = nodecodes.hlist + local vlist_code = nodecodes.vlist + + local kerncodes = nodes.kerncodes + local font_kern_code = kerncodes.fontkern + local italic_kern_code = kerncodes.italiccorrection + ----- user_kern_code = kerncodes.userkern + local function visualize(head,vertical,forced,parent) local trace_hbox = false local trace_vbox = false @@ -1126,12 +1119,14 @@ do local previous = nil local attr = unsetvalue local prev_trace_fontkern = nil + local prev_trace_italic = nil local prev_trace_expansion = nil while current do local id = getid(current) local a = forced or getattr(current,a_visual) or unsetvalue if a ~= attr then prev_trace_fontkern = trace_fontkern + prev_trace_italic = trace_italic prev_trace_expansion = trace_expansion if a == unsetvalue then trace_hbox = false @@ -1205,10 +1200,14 @@ do if trace_expansion or prev_trace_expansion then head, current = kernexpansion(head,current) end - else -- if subtype == user_kern_code then - if trace_italic then - head, current = ruleditalic(head,current) + elseif subtype == italic_kern_code then + if trace_italic or prev_trace_italic then + head, current = italickern(head,current) elseif trace_kern then + head, current = ruleditalic(head,current) + end + else + if trace_kern then head, current = ruledkern(head,current,vertical) end end @@ -1304,10 +1303,13 @@ end do - local last = nil - local used = nil + local hlist_code = nodecodes.hlist + local vlist_code = nodecodes.vlist + + local last = nil + local used = nil - local mark = { + local mark = { "trace:1", "trace:2", "trace:3", "trace:4", "trace:5", "trace:6", "trace:7", diff --git a/tex/context/base/mkiv/trac-vis.mkiv b/tex/context/base/mkiv/trac-vis.mkiv index fbe59a875..8f9a90f2f 100644 --- a/tex/context/base/mkiv/trac-vis.mkiv +++ b/tex/context/base/mkiv/trac-vis.mkiv @@ -119,6 +119,9 @@ \unexpanded\def\showfontkerns {\clf_setvisual{fontkern}} +\unexpanded\def\showfontitalics + {\clf_setvisual{italic}} + \unexpanded\def\showfontexpansion {\clf_setvisual{expansion}} diff --git a/tex/context/base/mkiv/typo-itc.lua b/tex/context/base/mkiv/typo-itc.lua index 312832d5b..781d44d30 100644 --- a/tex/context/base/mkiv/typo-itc.lua +++ b/tex/context/base/mkiv/typo-itc.lua @@ -251,7 +251,7 @@ local function domath(head,current, done) if trace_italics then report_italics("adding italic between math %C and non punctuation %C",getchar(glyph),char) end - insert_node_after(head,glyph,new_correction_kern(a)) + insert_node_after(head,glyph,correction_kern(a,glyph)) done = true end end @@ -415,7 +415,6 @@ local function texthandler(head) lastattr = attr replacechar = char replacehead = replace - replace = current updated = true end end @@ -439,7 +438,7 @@ local function texthandler(head) if attr and attr > 0 then local cd = data[char] if not cd then - -- this really can happen + -- this really can happen -- postitalic = 0 else postitalic = cd.italic @@ -452,8 +451,7 @@ local function texthandler(head) lastattr = attr postchar = char posthead = post - post = current - updated = true + updated = true end end end diff --git a/tex/context/interface/mkiv/context-en.xml b/tex/context/interface/mkiv/context-en.xml index ce9a81b5a..341011255 100644 --- a/tex/context/interface/mkiv/context-en.xml +++ b/tex/context/interface/mkiv/context-en.xml @@ -44859,6 +44859,7 @@ <cd:command file="trc-vis.mkiv" name="showboxes"/> <cd:command file="trc-vis.mkiv" name="showglyphs"/> <cd:command file="trc-vis.mkiv" name="showfontkerns"/> + <cd:command file="trc-vis.mkiv" name="showfontitalics"/> <cd:command file="trc-vis.mkiv" name="setvisualizerfont"> <cd:arguments> <cd:keywords optional="yes"> diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 909024974..d1f8f2779 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex 357e1bf22..96fcd18d2 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/context/interface/mkiv/i-visualizer.xml b/tex/context/interface/mkiv/i-visualizer.xml index f5ff1f942..0e037c9e5 100644 --- a/tex/context/interface/mkiv/i-visualizer.xml +++ b/tex/context/interface/mkiv/i-visualizer.xml @@ -145,6 +145,8 @@ <cd:command name="showfontkerns" file="trc-vis.mkiv"/> + <cd:command name="showfontitalics" file="trc-vis.mkiv"/> + <cd:command name="setvisualizerfont" file="trc-vis.mkiv"> <cd:arguments> <cd:resolve name="keyword-font-optional"/> diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 0445af9cf..e43baa5c0 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 : 07/28/17 22:51:33 +-- merge date : 07/29/17 23:08:35 do -- begin closure to overcome local limits and interference @@ -24914,7 +24914,7 @@ local function optimized_handle_contextchain(head,start,dataset,sequence,context local n=f+1 last=startnext while n<=l do - if not last and postreplace then + if postreplace and not last then last=getnext(sweepnode) sweeptype=nil end |