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
There's no built-in pixel sizing option for text at the moment, you'll have to scale it manually with Draw.Scale or Draw.FontSize, based on whatever heuristic you want to use