∅:D[
9.7881] → [
4.1184:1230]
B:BD[
4.1184] → [
4.1184:1230]
B:BD[
4.1230] → [
2.1692:1912]
∅:D[
2.1912] → [
10.1079:1226]
B:BD[
4.1290] → [
10.1079:1226]
∅:D[
11.271] → [
4.1433:1438]
∅:D[
10.1226] → [
4.1433:1438]
B:BD[
4.1433] → [
4.1433:1438]
B:BD[
4.1438] → [
5.3053:3092]
B:BD[
5.3092] → [
2.1913:2040]
∅:D[
2.2040] → [
10.1227:1366]
B:BD[
5.3141] → [
10.1227:1366]
function Text.cursor_x(line_data, cursor_pos)
--? print(cursor_pos, #line_data, line_data)
local cursor_offset = utf8.offset(line_data, cursor_pos)
--? print(cursor_offset)
assert(cursor_offset)
local line_before_cursor = line_data:sub(1, cursor_offset-1)
local text_before_cursor = App.newText(love.graphics.getFont(), line_before_cursor)
return 25 + math.floor(App.width(text_before_cursor)*Zoom)
end
function Text.cursor_x2(s, cursor_pos)
local cursor_offset = utf8.offset(s, cursor_pos)
assert(cursor_offset)
local s_before_cursor = s:sub(1, cursor_offset-1)
local text_before_cursor = App.newText(love.graphics.getFont(), s_before_cursor)
return math.floor(App.width(text_before_cursor)*Zoom)
function Text.x(s, pos)
local offset = utf8.offset(s, pos)
assert(offset)
local s_before = s:sub(1, offset-1)
local text_before = App.newText(love.graphics.getFont(), s_before)
return math.floor(App.width(text_before)*Zoom)