draw.DrawText sizing

How can I get the text to size down when they get further away. I hope that makes sense to you… thanks!

Let me guess, you’re drawing the persons name or something in HUDPaint using Vector:ToScreen()?
You can kind of scale it using that method but you should use cam.Start3D2D() instead.

[Lua]function DrawName( ply )
if !ply:Alive() then return end

local MaxView = 2000
local dist = ply:GetPos():Distance(LocalPlayer():GetPos())
if(dist <= MaxView)then
	local ang = Vector(0,0,0)
	local offset = Vector( 0, 0, 85 )
	if(LocalPlayer():InVehicle())then
		ang = LocalPlayer():GetVehicle():GetAngles() + LocalPlayer():EyeAngles()
	else
		ang = LocalPlayer():EyeAngles()
	end
	local pos = ply:GetPos() + offset + ang:Up()
	local alpha = ((MaxView-dist)/MaxView)*255
	ang:RotateAroundAxis( ang:Forward(), 90 )
	ang:RotateAroundAxis( ang:Right(), 90 )
	
	cam.Start3D2D( pos, Angle( 0, ang.y, 90 ), 0.5 )
		draw.DrawText( ply:GetName(), "CV20", 2, 2, Color(GAMEMODE:GetTeamColor(ply).r, GAMEMODE:GetTeamColor(ply).g, GAMEMODE:GetTeamColor(ply).b, alpha), TEXT_ALIGN_CENTER )
	cam.End3D2D()
end

end
hook.Add( “PostPlayerDraw”, “DrawName”, DrawName )[/Lua]

The colour is fadded in this script but just do the same with size where distance is proportional to size

You could also a certain amount of fonts and then draw with the most fitting one for a distance.

^ Yah that’s the way I was going to do it if I couldn’t find something like sweeneypauls.

I wish we could override fonts I guess I will post in niggles

But uh. I don’t like how 3D2D is so I just set certain fonts for each distance range. Like under 100 units away is the biggest font, 500 units away is smaller, etc.

If there’s a way to do just make it shrink instead of changing fonts with draw.DrawText I’d appreciate it if someone helped me out here

Uhm, what?
cam.3D2D() is the best option here. Using multiple fonts for one thing like this is pretty dumb, imo.
What is there not to like about cam.3D2D()? Because its not quick and easy like vector:ToScreen()?
Heaven forbid you should have to do some work >.>

Lol no that’s not it. It’s the fact that it’s less define and more blurry.

Yah It is pretty dumb, I agree.

Uhm? If its more blurry then theres something wrong.
Either your scaling is off or something else is fucking up, because a draw function is a draw function.