Allow numeric literal modes

This commit is contained in:
Marcel Krüger 2020-07-01 22:50:50 +02:00
parent 94ba4a2557
commit 780bd4382b

View File

@ -498,8 +498,12 @@ function pdf.write_matrix(a, b, c, d, e, f, p)
pending[1], pending[2], pending[3], pending[4], pending[5], pending[6] = a, b, c, d, e, f pending[1], pending[2], pending[3], pending[4], pending[5], pending[6] = a, b, c, d, e, f
end end
local write_matrix = pdf.write_matrix local write_matrix = pdf.write_matrix
local literal_type_names = { [0] =
'origin', 'page', 'direct', 'raw', 'text'
}
function pdf.write(mode, text, x, y, p) function pdf.write(mode, text, x, y, p)
x, y, p = x or global_x, y or global_y, p or global_p x, y, p = x or global_x, y or global_y, p or global_p
mode = literal_type_names[mode] or mode
if mode == "page" then if mode == "page" then
topage(p) topage(p)
p.strings[#p.strings + 1] = text p.strings[#p.strings + 1] = text