Is there a way to measure the text width? #132
Answered
by
grovesNL
lemleyautomation
asked this question in
Q&A
-
|
I've just started poking around this crate. I am working on a UI Layout library. A function I need is to be able to measure the rendered width of a string. |
Beta Was this translation helpful? Give feedback.
Answered by
grovesNL
Feb 21, 2025
Replies: 1 comment 1 reply
-
|
Hi @lemleyautomation 👋 You can measure text by using |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
lemleyautomation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @lemleyautomation 👋
You can measure text by using
buffer.layout_runs(). You can iterate over the layout runs and use the maxlayout_run.line_wto get maximum line width for example.