Determine Pixel Length of Text String
이전 댓글 표시
Hi Guys,
I was wondering if there was a way to determine the pixel length for a given text? I know there is a way to do this once a text object has been created on a graph etc., but I am particular looking for a way to do this without having to even create an object. That way I would know what the bounding box size would have to be.
Thanks
댓글 수: 2
Matt Kindig
2013년 7월 1일
This question doesn't make sense to me. Fonts are usually defined in terms of Bezier curves, which by definition are vectorized and thus can be rendered at any scale. So the pixel representation of the text string isn't defined until it is a rendered, and the number of pixels will of course depend on the font size. I'm not exactly sure what you are asking to do.
Nitin
2013년 7월 1일
an example of what you are trying to achieve would probably make it easier..
채택된 답변
추가 답변 (1개)
Jasper van Casteren
2017년 5월 10일
3 개 추천
The answers seem to miss the point. Often, to make a nice app dialog, you want to set the width of text boxes to the largest width. So you would have to find the size of a text in pixels if you cannot design your whole dialog in character units (which is often the case). So, the question is not whether you need to render before you know it, but whether there is a "quite" renderer that does the rendering but only returns the size of the box, without actually displaying something.
카테고리
도움말 센터 및 File Exchange에서 Labels and Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!