LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Font size to pixel size


@ATE-EGNE wrote:

Ok, Here's my solution so far, but the pid isn't settling any suggestions team?

 

 


What does a question about the PID have to do with a question about setting font sizes?

0 Kudos
Message 11 of 16
(1,141 Views)
@RavensFan wrote:

@ATE-EGNE wrote:

Ok, Here's my solution so far, but the pid isn't settling any suggestions team?

 

 


What does a question about the PID have to do with a question about setting font sizes?


Oh, Sorry for the logical leap, I want to set the font size so that my text fully appears in an nxm pixel string indicator

0 Kudos
Message 12 of 16
(1,130 Views)

Assuimng the screen size will not change very often and when it does the user will tolerate some computing to adjust....

 

Just run each of the strings through the "Get Text Rect" and then sort the array of clusters first for height and then width. Choose the largest of both as you test text. Then step-up or down the font size until you find the max font size that will allow the worst cases to fit.

 

If you are not aware, LV will sort an array of clusters based on the first element in the cluster (see cluster order) and use the next filed for tie-breakers. If you re-bundle the values you get from the "Get Text Rect" in a cluster with the order changed you can use the same sorting approach to find the max of both height and width.  

 

Ben 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 13 of 16
(1,122 Views)

So I got a PID control working based on the scale height (it seems that the factor you send the PID needs to be per character)

Sizepid.png

 

However, it's taking significantly longer than a brute force approach:

 

Sizefor.png

 

I'll go with option 2 unless you guys have any suggestions on how I can optimize either process further.

Message 14 of 16
(1,117 Views)

Kudos from me for the most creative use a PID I have ever(?) seen.

 

I would lean toward option 2.

 

Besides, since you are not explicitly passing the dt, the PID would have to be retuned for different speed machinea?

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 15 of 16
(1,110 Views)

I still don't understand how you use PID in a case like this.

 

I'd agree with you that you should use option 2, and am glad to hear you got it working for you.

0 Kudos
Message 16 of 16
(1,104 Views)