• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

sile-typesetter / sile / 6713098919

31 Oct 2023 10:21PM UTC coverage: 52.831% (-21.8%) from 74.636%
6713098919

push

github

web-flow
Merge d0a2a1ee9 into b185d4972

45 of 45 new or added lines in 3 files covered. (100.0%)

8173 of 15470 relevant lines covered (52.83%)

6562.28 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/typesetters/firstfit.lua
1
local base = require("typesetters.base")
×
2

3
local typesetter = pl.class(base)
×
4
typesetter._name = "firstfit"
×
5

6
function typesetter:breakIntoLines (nl, breakWidth)
×
7
  local breaks = {}
×
8
  local length = SILE.length()
×
9
  for i = 1,#nl do local n = nl[i]
×
10
    if n.is_box then
×
11
      SU.debug("break", n .. " " .. tostring(n:lineContribution()))
×
12
      length = length + n:lineContribution()
×
13
      SU.debug("break", " Length now " .. tostring(length) .. " breakwidth ".. tostring(breakWidth))
×
14
    end
15
    if not n.is_box or n.isHangable then
×
16
      SU.debug("break", n )
×
17
      if n.is_glue then
×
18
        length = length + n.width:absolute()
×
19
      end
20
      SU.debug("break", " Length now " .. tostring(length) .. " breakwidth " .. tostring(breakWidth))
×
21
      -- Can we break?
22
      if length:tonumber() >= breakWidth:tonumber() then
×
23
        SU.debug("break", "Breaking!")
×
24
        breaks[#breaks+1] = { position = i, width = breakWidth}
×
25
        length = SILE.length()
×
26
      end
27
    end
28
  end
29
  breaks[#breaks+1] = { position = #nl, width = breakWidth}
×
30
  return self:breakpointsToLines(breaks)
×
31
end
32

33
return typesetter
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc