ent:GetPrintName() broken?

For some reason wep:GetPrintName() return GRENADE but when I do draw.DrawText( wep:GetPrintName() ) it turns it into #HL2_Grenade.

Opposite thing happens in my PostDrawOpaqueRenderables hook where surface.GetTextSize( wep:GetPrintName() ) returns the scale of #HL2_Grenade and then when I draw the text it makes it into GRENADE which causes the scaling to be incorrect.

This only happens with non-lua weapons.

Try at the beginning of the PostDrawOpaqueRenderables hook to have a local variable called “name” or something that is the GetPrintName() so the string remains the same. Also mind showing some of the code? Where did you get wep?

local texty = wep:GetPrintName()
local textwide, texthigh = surface.GetTextSize( texty )

Thats how I set it all up. I wont use HL2 weapons anyways so I might just ignore this problem.

Not sure if you did it on purpose but having a print(“texty”) won’t print the texty variable but it will just print “texty” as it’s a string.
Anyways, you haven’t told me if it works yet.

Strings that start with # go through automatic translation. Might be a bug if it’s not measuring their size of the text properly.

To extend on this, it is getting the length of the #<text> not the translated outcome, to get the outcome you can use this;