Fix: truncateTextByWidth() should respect kerning and bold (#3139)

This commit is contained in:
Robert
2017-08-28 20:36:15 +02:00
committed by Frans de Jonge
parent 1ab2a542dd
commit c78f6989b4
2 changed files with 4 additions and 3 deletions

View File

@@ -241,7 +241,7 @@ end
local ellipsis, space = "", " "
local ellipsis_width, space_width
function RenderText:truncateTextByWidth(text, face, max_width, prepend_space)
function RenderText:truncateTextByWidth(text, face, max_width, kerning, bold, prepend_space)
if not ellipsis_width then
ellipsis_width = self:sizeUtf8Text(0, max_width, face, ellipsis).x
end
@@ -249,7 +249,7 @@ function RenderText:truncateTextByWidth(text, face, max_width, prepend_space)
space_width = self:sizeUtf8Text(0, max_width, face, space).x
end
local new_txt_width = max_width - ellipsis_width - space_width
local sub_txt = self:getSubTextByWidth(text, face, new_txt_width)
local sub_txt = self:getSubTextByWidth(text, face, new_txt_width, kerning, bold)
if prepend_space then
return space.. sub_txt .. ellipsis
else