01-03-2019 10:28 AM
This is the final VI that I`ve created. It takes a string as an input and desired width in pixels and the output is the 2d drawing of the string and the font size.
01-03-2019 11:30 AM
Nice, I smell a coding challenge coming on...
Write a VI that draws a 2D picture with a size that approaches a given XY size, but does not go over, which contains the text (multi-line) that is provided. Faster processing time the better. The code you provided is already tons faster than what I came up. I'll have to look into making it work in the vertical size as well.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
01-03-2019 04:06 PM
Already did, but probably not in the right place (and I'm not sure how I got there, either). https://forums.ni.com/t5/Example-Program-Drafts/Auto-size-to-Text-Horizontal-for-Strings-and-Paths/t....
Bob Schor
01-03-2019 04:18 PM
Sorry Bob but that isn't really what I'm talking about, it is more like the reverse. I don't want to make a control fit to text, I want to make the text fit a control, or rather the text to fit a size. I did modify datatech's code to fit for vertical but had a few issues and got side tracked.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
01-04-2019 04:46 AM
@Hooovahh wrote:
Sorry Bob but that isn't really what I'm talking about, it is more like the reverse. I don't want to make a control fit to text, I want to make the text fit a control, or rather the text to fit a size. I did modify datatech's code to fit for vertical but had a few issues and got side tracked.
https://en.wikipedia.org/wiki/Automatic_label_placement
https://www.sciencedirect.com/science/article/pii/S0925772196000077
interesting!
01-04-2019 08:44 PM
We use this.
01-05-2019 02:58 PM
@paul_cardinale wrote:
We use this.
Interesting code. I read the Documentation to figure out what this does, looked at the code, made some guesses and tried various numbers, but still can't say I have any real clue ...
Bob Schor
01-07-2019 06:23 AM - edited 01-07-2019 06:43 AM
"asdfdsfa" can be rendered in a rectangle with width 100 px height 20 px
with the Font-Size 20 (e.g. Arial)
the actual rectangle for this setting has a width 62 and height 19
observation: the Font Size and the rectangular's height in px are mostly identical, if not, those two numbers vary in a range +1 or -1
change the width to 50 px - now it is not possible to render "asdfdsfa" with Font Size 20 in a rectangle with width 50 px height 20 px
Paul's vi calculates a Font-Size = 16 to render the text "asdfdsfa" in a rectangle with width 50 px height 20 px.
The actual rectangle has width 49 height 16
01-07-2019 07:58 AM
Sorry about that. I shouldn't have just sent out an old VI without looking at it closely.
'Font Size' in is the preferred (maximum) font size.
'Text.Size' is the size of the box you want the text to fit in.
'Font Size' out is the size that will fit in the box.
'Text Out' is either 'Text In' or "..." depending on whether the text can be made to fit in the box.
05-06-2019 10:57 AM
Just dropping in here.
I am trying to write Text into a series of images (Vision module - IMAQ Overlay Text VI) and am running into a similiar problem as the images of one image series got a fixed width, which i do not want to change, but the next series might have another fixed width.
Could you downgrade your VI's to 2017? Still not up to date here 😉