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 で Creating, Deleting, and Querying Graphics Objects についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!