how to count visible lines in textArea?
2 views (last 30 days)
Show older comments
I have a long text in Text Area, which is too long to fit. As the app window and the text area is changing size (possibly also font size), the text is partially hidden. I'd like to know, how many lines of text are actually visible.
0 Comments
Answers (1)
Image Analyst
on 29 Jun 2022
I'd take a vertical profile and threshold it. You forgot to attach your picture. But if you have an image with black text on a white background
verticalProfile = mean(grayImage, 2);
mask = verticalProfile < 128;
[labeledLines, numberOfLines] = bwlabel(mask)
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!