Hello,
It seems there is an issue with the width/height of emoji in text with SetDrawOrigin
when changing the scale or maybe drawing multiple emojis.
The issue is that the scale is often wrong and not dynamic.
You can check a video here:
Around 00:03 you can see the scale changing, you can also see that the scale of emoji does not adapt when the scale of the text changes.
Here is a simple repro:
local function drawText(intFont, strText, floatScale, intPosX, intPosY, color, boolShadow, intAlign, addWarp)
SetTextFont(intFont)
SetTextScale(floatScale, floatScale)
if boolShadow then
SetTextDropShadow(0, 0, 0, 0, 0)
end
SetTextColour(color[1], color[2], color[3], 255)
SetTextJustification(intAlign or 1)
if intAlign == 2 then
SetTextWrap(.0, addWarp or intPosX)
end
BeginTextCommandDisplayText("STRING")
AddTextComponentSubstringPlayerName(strText)
EndTextCommandDisplayText(intPosX, intPosY)
end
local scale = 0.5
CreateThread(function()
while true do
Wait(400)
if scale == 0.5 then
scale = 0.75
else
scale = 0.5
end
end
end)
CreateThread(function()
while true do
Wait(0)
local ped = PlayerPedId()
local fwdVec, rgtVec, upVec, posVec = GetEntityMatrix(ped)
local lastPosition = posVec + fwdVec * 2 + vec3(0, 0, 1)
SetDrawOrigin(lastPosition.x, lastPosition.y, lastPosition.z, 0)
drawText(0, "๐ ~r~Some text ๐", scale, 0.0, 0.0, { 255, 255, 255, 255 }, false, 1)
ClearDrawOrigin()
SetDrawOrigin(lastPosition.x, lastPosition.y, lastPosition.z, 0)
drawText(0, "๐ ~r~Some text ๐", 0.5, 0.0, 0.2, { 255, 255, 255, 255 }, false, 1)
ClearDrawOrigin()
end
end)