How to scale Draw.Text() in Immediate-Mode Drawing?
Hi there,
I work on an application, where one can draw lines and each line has a measure text, which shows its length in Meter. Everything is drawn using the “Immediate-Mode Drawing”.
To scale the placed lines and their points (discs) I use something like the pseudo-code below. But the text is not scaled (see screenshots).
Is there another Draw-Property to set? Maybe something like “Draw.TextFontSpace” or do you know of another possibility to scale Draw.Text()?
public void Enable () { RenderPipelineManager.beginCameraRendering += DrawShapes; } private void DrawShapes(ScriptableRenderContext context, Camera cam) { using (Draw.Command(cam)) { // scales all thicknesses and radius according to the set sizes in pixel // see example from documentation Draw.ThicknessSpace = ThicknessSpace.Pixels; Draw.RadiusSpace = ThicknessSpace.Pixels; // draw lines and points (using discs) // is scaled Draw.Line(…); Draw.Disc(…); // draw measure Text // >>> text is not scaled <<< Draw.Text(…); } }
Best regards,
Richard
Is it possible to check the width/height of a text element drawn in immediate mode?
I want to be able to draw a line under my text, for instance, and need to know how big of a line to draw.
if you're using the persistent TextElement types, then you have access to all the TMP properties in myTextElement.Tmp, which should give you access to all the properties text mesh pro exposes for their text. There's info in the online docs on how to use TextElements!