summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/strc-flt.lua
blob: e3a0ea30edba9266c8e5a62525d9486c7e3e58db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
if not modules then modules = { } end modules ['strc-flt'] = {
    version   = 1.001,
    comment   = "companion to strc-flt.mkiv",
    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
    copyright = "PRAGMA ADE / ConTeXt Development Team",
    license   = "see context related readme files"
}

-- 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,
}