Estimating width of SeparatorText
Author: bostickCreated Sep 24, 2026Updated Sep 24, 2026
Labelsfont/textlayout
Version/Branch of Dear ImGui:
xx
Back-ends:
xx
Compiler, OS:
xx
Full config/build information:
No response
Details:
I am using a SeparatorText on a small screen (mobile device) and the text gets truncated. This is fine. However, I would like to supply the shorter text myself instead of just relying on "..."
This is the actual problem I'd like to solve, but it doesn't look like there is a way to supply custom truncation text.
As a second approach, I would like to know whether the SeparatorText was going to be truncated, and supply shorter text for the label myself.
What is a good way to estimate the width of the SeparatorText, horizontal bars and everything? I would like to compare that with available width, and supply different text accordingly.
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
Source: ocornut/imgui