B:BD[
3.453] → [
4.289:374]
B:BD[
4.374] → [
2.156:282]
B:BD[
4.426] → [
4.426:462]
B:BD[
4.462] → [
2.283:316]
∅:D[
8.1545] → [
3.571:672]
∅:D[
9.4219] → [
3.571:672]
∅:D[
10.6846] → [
3.571:672]
B:BD[
3.571] → [
3.571:672]
B:BD[
3.672] → [
4.517:590]
B:BD[
4.590] → [
2.317:351]
∅:D[
2.351] → [
11.833:910]
∅:D[
6.497] → [
11.833:910]
∅:D[
4.590] → [
11.833:910]
∅:D[
8.1624] → [
11.833:910]
∅:D[
9.4311] → [
11.833:910]
B:BD[
11.833] → [
11.833:910]
B:BD[
12.77] → [
2.352:449]
∅:D[
2.449] → [
11.1105:1160]
B:BD[
11.1105] → [
11.1105:1160]
∅:D[
11.1160] → [
13.809:882]
B:BD[
3.846] → [
13.809:882]
B:BD[
13.882] → [
14.2941:2993]
B:BD[
14.2993] → [
2.450:537]
B:BD[
4.646] → [
4.646:695]
B:BD[
3.1082] → [
15.3991:4067]
∅:D[
15.4067] → [
11.1161:1204]
B:BD[
3.1152] → [
11.1161:1204]
∅:D[
11.1204] → [
13.952:1017]
B:BD[
3.1191] → [
13.952:1017]
B:BD[
13.1017] → [
14.2994:3038]
∅:D[
13.1078] → [
3.1327:1339]
∅:D[
14.3038] → [
3.1327:1339]
B:BD[
3.1327] → [
3.1327:1339]
B:BD[
3.1339] → [
4.696:732]
if x + frag_width > State.right then
while x + frag_width > State.right do
--? print(('checking whether to split fragment ^%s$ of width %d when rendering from %d'):format(frag, frag_width, x))
if x < 0.8*State.right then
--? print('splitting')
-- long word; chop it at some letter
-- We're not going to reimplement TeX here.
local bpos = Text.nearest_pos_less_than(frag, State.right - x)
--? print('bpos', bpos)
assert(bpos > 0) -- avoid infinite loop when window is too narrow
local boffset = Text.offset(frag, bpos+1) -- byte _after_ bpos
--? print('space for '..tostring(bpos)..' graphemes, '..tostring(boffset-1)..' bytes')
local frag1 = string.sub(frag, 1, boffset-1)
local frag1_text = App.newText(love.graphics.getFont(), frag1)
local frag1_width = App.width(frag1_text)
--? print('extracting ^'..frag1..'$ of width '..tostring(frag1_width)..'px')
assert(x + frag1_width <= State.right)
table.insert(line_cache.fragments, {data=frag1, text=frag1_text})
frag = string.sub(frag, boffset)
frag_text = App.newText(love.graphics.getFont(), frag)
frag_width = App.width(frag_text)
end
x = State.left -- new line
while x + frag_width > State.right do
--? print(('checking whether to split fragment ^%s$ of width %d when rendering from %d'):format(frag, frag_width, x))
if x < 0.8*State.right then
--? print('splitting')
-- long word; chop it at some letter
-- We're not going to reimplement TeX here.
local bpos = Text.nearest_pos_less_than(frag, State.right - x)
--? print('bpos', bpos)
assert(bpos > 0) -- avoid infinite loop when window is too narrow
local boffset = Text.offset(frag, bpos+1) -- byte _after_ bpos
--? print('space for '..tostring(bpos)..' graphemes, '..tostring(boffset-1)..' bytes')
local frag1 = string.sub(frag, 1, boffset-1)
local frag1_text = App.newText(love.graphics.getFont(), frag1)
local frag1_width = App.width(frag1_text)
--? print('extracting ^'..frag1..'$ of width '..tostring(frag1_width)..'px')
assert(x + frag1_width <= State.right)
table.insert(line_cache.fragments, {data=frag1, text=frag1_text})
frag = string.sub(frag, boffset)
frag_text = App.newText(love.graphics.getFont(), frag)
frag_width = App.width(frag_text)