LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Draw text as an image to fit a box?

Solved!
Go to solution

@AbongileViksVika wrote:

Could you downgrade your VI's to 2017? Still not up to date here 😉


As the Caterpillar said to Alice, "Who ... are ... you?"  Various people commented and offered code here ...

 

Bob Schor

0 Kudos
Message 21 of 23
(756 Views)

Right you are, Bob.

 

Well, there are 2 VI's of interest in the thread:

by @datatechNDT: "Binary search FontSize to PixelWidth.vi

by @paul_cardinale: "fit string to box.vi"

 

Thanks a lot!

0 Kudos
Message 22 of 23
(746 Views)

I am not proud.  I am making a Jeopardy game using a background pic for fun.  This thread was as close as I could find to doing exactly what was discussed - scale text to a 2D shape that fits within some boundary using the largest font possible.  I took the original "fit shaped string to box" and modified it by adding an initial call to a "shape text to box" that tries to break up the text into the right shape with a parameter called "W to H ratio" for proportionality.  Since I don't know exactly what is the best ratio for a given font and set of words, I then wrapped it in another loop that looks for the largest font - "Find best ratio for text box fit."  Voila.  As you may imagine, this may not be pretty, but it does what I want and I could hack it together in short order. Just throwing it out there for the curious.

0 Kudos
Message 23 of 23
(520 Views)