Skip to content

Commit

Permalink
feat(backends): Aproximate space and break in text output to PDF
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Jan 14, 2020
1 parent 26afcec commit 9577ae4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions core/text-output.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 27,9 @@ SILE.outputters.text = {
popColor = function () end,
outputHbox = function (value, width)
width = SU.cast("number", width)
if not value.text then return end
writeline(value.text)
if width > 0 then
writeline(value.text)
started = true
cursorX = cursorX width
end
Expand All @@ -37,10 38,12 @@ SILE.outputters.text = {
drawImage = function () end,
imageSize = function () end,
moveTo = function (x, y)
local bs = SILE.measurement("0.8bs"):tonumber()
local spc = SILE.measurement("0.8spc"):tonumber()
if started then
if y > cursorY or x < cursorX then
if y > cursorY and y - cursorY > bs or x < cursorX then
outfile:write("\n")
elseif x > cursorX then
elseif x > cursorX and x - cursorX > spc then
outfile:write(" ")
end
end
Expand Down

0 comments on commit 9577ae4

Please sign in to comment.