Class TextRenderer
Namespace: ValveResourceFormat.Renderer
Assembly: Renderer.dll
Renders text using multi-channel signed distance field fonts.
public class TextRendererInheritance
Constructors
TextRenderer(RendererContext, Camera)
Initializes the text renderer.
public TextRenderer(RendererContext rendererContext, Camera camera)Parameters
rendererContext RendererContext
Renderer context for loading shaders.
camera Camera
Camera (unused at construction; required at render time).
Methods
AddText(TextRenderRequest)
Queues a text render request at absolute pixel coordinates for rendering.
public void AddText(TextRenderer.TextRenderRequest textRenderRequest)Parameters
textRenderRequest TextRenderer.TextRenderRequest
Text rendering parameters with pixel-space and .
AddTextBillboard(Vector3, TextRenderRequest, Camera, bool)
Projects a 3D world position to screen space and queues the text for rendering.
public void AddTextBillboard(Vector3 position, TextRenderer.TextRenderRequest textRenderRequest, Camera camera, bool fixedScale = true)Parameters
position Vector3
World-space position to project.
textRenderRequest TextRenderer.TextRenderRequest
Text rendering parameters.
camera Camera
Camera used for the projection.
fixedScale bool
When true, the scale is unchanged; when false, the scale is attenuated by depth.
AddTextRelative(string, float, float, float, Color32, Camera)
Queues text at a viewport-relative position (0–1 range) for rendering.
public void AddTextRelative(string text, float x, float y, float scale, Color32 color, Camera camera)Parameters
text string
String to render.
x float
Horizontal position as a fraction of the viewport width.
y float
Vertical position as a fraction of the viewport height.
scale float
Text scale in pixels-per-em.
color Color32
Text color.
camera Camera
Camera providing the viewport dimensions.
AddTextRelative(TextRenderRequest, Camera)
Queues a text render request at a viewport-relative position (0–1 range) for rendering.
public void AddTextRelative(TextRenderer.TextRenderRequest textRenderRequest, Camera camera)Parameters
textRenderRequest TextRenderer.TextRenderRequest
Text rendering parameters; and are treated as fractions of the viewport dimensions.
camera Camera
Camera providing the viewport dimensions.
Load()
Loads the MSDF font atlas texture and compiles the font shader.
public void Load()Render(Camera)
Flushes all queued text requests to the GPU and renders them for the current frame.
public void Render(Camera camera)Parameters
camera Camera
Camera providing the viewport dimensions for the orthographic projection.

