Wrapping text in draw.DrawText in cam2d3d

Hello all;

I want to make a textscreen, Easy, but I have an issue.
If the text on the first line get’s too long then it will pop out the screen.

What I want to do is when the first line of words get too long, the words which fell out get moved to the second line, and with the second line the same. And with all the other lines, how can I do this?

Is 3d derma better to use instead?

Thanks.

Use this http://wiki.garrysmod.com/page/markup/Parse

Thanks!!

[editline]12th July 2014[/editline]

http://cloud-4.steampowered.com/ugc/584656846155034500/0A96AD8BF514415C59122B8D8BC112C3FB1F9A86/

[lua]
surface.CreateFont( “Sfont”, {
font = “Arial”,
size = 100,
weight = 10000,
blursize = 0,
scanlines = 0,
antialias = true
} )

local parsed = markup.Parse( “<font=Sfont>Here is a long text which should be nicely parsed trough several lines.</font>” )

function ENT:Draw()
self:DrawModel()

local DrawPos = self:LocalToWorld(Vector(5.99, -28, 36))

local DrawAngles = self:GetAngles()
DrawAngles:RotateAroundAxis(self:GetAngles():Forward(), 90)
DrawAngles:RotateAroundAxis(self:GetAngles():Up(), 90)

cam.Start3D2D(DrawPos, DrawAngles, 0.05)
	draw.RoundedBox(0, 0, 0, 1150, 700, Color(0,0,0,255))
	parsed:Draw( 10, 60, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
cam.End3D2D()

end
[/lua]

How does it work?

Try using a DLabel with a fixed with DLabel.SetWrap(true).

Is there no way with the draw function?

You will have to do the wrapping manually.

How could I make that possible?

By manually checking the whole string for overflow and rendering another string if there is any overflow.

second parameter is width, tune it.

http://cloud-4.steampowered.com/ugc/584656846156444187/A3053427EAE844393622B84A08EF073A8967CDD0/