Fix use of pens in render_text

If you ever pass in a number to `dc:pen` rather than a pen table, it
will assume the old pen's other attributes, such as `bg` and `bold`.

To workaround this, we just never pass in a number, and always call
`to_pen` aka `dfhack.pen.parse` first.
develop
Kelvie Wong 2023-02-16 21:54:44 -08:00
parent 94ae9973cf
commit 61227eeca1
1 changed files with 2 additions and 2 deletions

@ -1139,11 +1139,11 @@ function render_text(obj,dc,x0,y0,pen,dpen,disabled,hpen,hovered)
if dc then
local tpen = getval(token.pen)
local dcpen = tpen or pen
local dcpen = to_pen(tpen or pen)
-- If disabled, figure out which dpen to use
if disabled or is_disabled(token) then
dccpen = getval(token.dpen) or tpen or dpen
dcpen = to_pen(getval(token.dpen) or tpen or dpen)
if keypen.fg ~= COLOR_BLACK then
keypen.bold = false
end