LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

calculating text string size

I want to fit the size of a string indicator to the string itself.
In attachment (LV 8.2), the size(width and height) of each string line was calculated by using Get Text Rect.
Unfortunately, the size might be over(or under)-estimated comparing to the real size.
How to resolve this problem?
0 Kudos
Message 1 of 5
(3,379 Views)
Hi!
   Have you already checked the doc here? Or are you complaining about the approximation?

graziano
0 Kudos
Message 2 of 5
(3,373 Views)

Thank you for the information.

I got to know the magic number 14 for Width.

But there still exist an over-estimating in height size.

Would you please comment if there are any other magic numbers?

0 Kudos
Message 3 of 5
(3,370 Views)
I don't really know..... and since I don't have Smiley Sad Smiley Sad Smiley Sad LV 8 I can't test it...... sorry!!!

graziano
0 Kudos
Message 4 of 5
(3,367 Views)
I think the problem is with your string and the Match Pattern. Your input string sometimes has \r\n to indicate a new line, and sometimes \n. In your Match Pattern you're just searching for \n and passing the "before" string to the "Get Text Rect" VI. In the cases where you have a \r\n at the end, the "Get Text Rect" VI gets a string with \r at the end, which is displayed as a newline in a string, thus it will output a "bottom" of 26 instead of 13 (i.e., two lines), leading to extra space at the bottom since all you're doing is adding up the heights from each iteration.
0 Kudos
Message 5 of 5
(3,342 Views)