improved name exibition

This commit is contained in:
Alexsandro Percy 2024-02-12 21:52:18 -03:00
parent 132acb957d
commit 48943f878d

View file

@ -67,7 +67,7 @@ local function make_text_texture(text, default_color, line_width, line_height, c
local width = 0 local width = 0
local maxw = 0 local maxw = 0
local font_name = "signs_lib_font_"..font_size.."px" local font_name = "signs_lib_font_"..font_size.."px"
local text_ansi = Utf8ToAnsi(text) local text_ansi = signs_lib.Utf8ToAnsi(text)
local text_splited = split(text_ansi)[1] local text_splited = split(text_ansi)[1]
local words = { } local words = { }
@ -142,7 +142,7 @@ local function make_text_texture(text, default_color, line_width, line_height, c
local xpos = start_xpos local xpos = start_xpos
local ypos = line_height local ypos = line_height
if line_height == signs_lib.lineheight31 then ypos = line_height/4 end if line_height == signs_lib.lineheight32 then ypos = line_height/4 end
cur_color = nil cur_color = nil
@ -177,32 +177,32 @@ end
function airutils.convert_text_to_texture(text, default_color, horizontal_aligment) function airutils.convert_text_to_texture(text, default_color, horizontal_aligment)
default_color = default_color or 0 default_color = default_color or 0
horizontal_aligment = horizontal_aligment or 3.4 horizontal_aligment = horizontal_aligment or 3
local font_size local font_size
local line_width local line_width
local line_height local line_height
local char_width local char_width
local colorbgw local colorbgw
local chars_per_line local chars_per_line
local widemult = 0.5 local widemult
text = string.sub(text,1,20) text = string.sub(text,1,20)
if string.len(text) <= 10 then if string.len(text) <= 10 then
widemult = widemult + (widemult/2) widemult = 0.75
horizontal_aligment = horizontal_aligment font_size = 32
font_size = 31
chars_per_line = 10 chars_per_line = 10
line_width = math.floor(signs_lib.avgwidth31 * chars_per_line) * (horizontal_aligment * widemult) line_width = math.floor(signs_lib.avgwidth32 * chars_per_line) * (horizontal_aligment * widemult)
line_height = signs_lib.lineheight31 line_height = signs_lib.lineheight32
char_width = signs_lib.charwidth31 char_width = signs_lib.charwidth32
colorbgw = signs_lib.colorbgw31 colorbgw = signs_lib.colorbgw32
else else
font_size = 15 widemult = 0.5
chars_per_line = 20 font_size = 16
line_width = math.floor(signs_lib.avgwidth15 * chars_per_line) * (horizontal_aligment * widemult) chars_per_line = 21
line_height = signs_lib.lineheight15 line_width = math.floor(signs_lib.avgwidth16 * chars_per_line) * (horizontal_aligment * widemult)
char_width = signs_lib.charwidth15 line_height = signs_lib.lineheight16
colorbgw = signs_lib.colorbgw15 char_width = signs_lib.charwidth16
colorbgw = signs_lib.colorbgw16
end end
local texture = { ("[combine:%dx%d"):format(line_width, line_height) } local texture = { ("[combine:%dx%d"):format(line_width, line_height) }