Summary

Functions

Creates a font through cw.fonts:Add, replacing the engine's surface.CreateFont.
Runs a drawing callback with everything rotated around a point.
Draws text rotated around its top-left corner.
Runs a drawing callback with everything scaled around a point.
Draws text scaled around its top-left corner.
Draws text, translating its phrases first.
Returns the size of a text, translating its phrases first.
Turns automatic translation of drawn text and panel text on or off.

Functions

Creates a font through cw.fonts:Add, replacing the engine's surface.CreateFont.

Fonts created this way can be resized with cw.fonts:GetSize. A font name that already exists is not created again. The engine function is kept as the global CreateFont.

Parameters

  • ... Any The font name and font data Map, as for the engine function

surface.DrawRotated(x, y, angle, callback)

client gamemodes/catwork/gamemode/core/cl_kernel.lua:214

Runs a drawing callback with everything rotated around a point.

The callback is run in a pcall; its errors are printed rather than raised.

Parameters

  • x Number X position of the rotation origin
  • y Number Y position of the rotation origin
  • angle Number Rotation in degrees
  • callback Function Called with x, y and angle while the rotation is active

surface.DrawRotatedText(text, font, x, y, angle, color)

client gamemodes/catwork/gamemode/core/cl_kernel.lua:150

Draws text rotated around its top-left corner.

Parameters

  • text String The text
  • font String Font name
  • x Number X position
  • y Number Y position
  • angle Number Rotation in degrees
  • color Color Text color

See also

surface.DrawScaled(x, y, scale, callback)

client gamemodes/catwork/gamemode/core/cl_kernel.lua:189

Runs a drawing callback with everything scaled around a point.

The callback is run in a pcall; its errors are printed rather than raised.

surface.DrawScaled(x, y, 2, function(x, y, scale)
  draw.SimpleText('Big', 'DermaDefault', x, y)
end)

Parameters

  • x Number X position of the scaling origin
  • y Number Y position of the scaling origin
  • scale Number Scale factor
  • callback Function Called with x, y and scale while the scaling is active

surface.DrawScaledText(text, font, x, y, scale, color)

client gamemodes/catwork/gamemode/core/cl_kernel.lua:126

Draws text scaled around its top-left corner.

Parameters

  • text String The text
  • font String Font name
  • x Number X position
  • y Number Y position
  • scale Number Scale factor
  • color Color Text color

See also

Draws text, translating its phrases first.

Overrides surface.DrawText so everything drawn with it, such as draw.SimpleText, is translated. The original is kept as surface.OldDrawText.

Parameters

Returns the size of a text, translating its phrases first.

Overrides surface.GetTextSize so measured text matches the drawn translation. The original is kept as surface.OldGetTextSize.

Parameters

Returns

  • Number The width
  • Number The height

Turns automatic translation of drawn text and panel text on or off.

Used to keep text such as the chatbox untranslated.

Parameters

  • bValue Boolean true to stop translating, false to translate again

Defined in