From 7b271baae19db1528fbe6621bdf50af89a5a336b Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Fri, 22 Feb 2019 20:29:46 +0100 Subject: 2019-02-22 19:43:00 --- tex/context/base/mkiv/strc-flt.lua | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'tex/context/base/mkiv/strc-flt.lua') diff --git a/tex/context/base/mkiv/strc-flt.lua b/tex/context/base/mkiv/strc-flt.lua index 466fd515e..e3a0ea30e 100644 --- a/tex/context/base/mkiv/strc-flt.lua +++ b/tex/context/base/mkiv/strc-flt.lua @@ -7,3 +7,37 @@ if not modules then modules = { } end modules ['strc-flt'] = { } -- nothing + +local sequencers = utilities.sequencers +local appendaction = sequencers.appendaction +local enableaction = sequencers.enableaction +local disableaction = sequencers.disableaction + +local texgetdimen = tex.getdimen + +local trace = trackers.register("structure.sidefloats.pageflush") +local report = logs.reporter("structure","floats") + +local forcepageflush = builders.vspacing.forcepageflush + +function builders.checksidefloat(mode,indented) + local s = texgetdimen("d_page_sides_vsize") + if s > 0 then + if trace then + report("force flushing page state, height %p",s) + end + forcepageflush() + end + return indented +end + +appendaction ("newgraf","system","builders.checksidefloat") +disableaction("newgraf","builders.checksidefloat") + +interfaces.implement { + name = "enablesidefloatchecker", + onlyonce = true, + actions = function() + enableaction("newgraf","builders.checksidefloat") + end, +} -- cgit v1.2.3