January 25, 200620 yr I think I know the answer to this but .... Does anyone know of a way to determine how long a printed text field would be when using a variable pitch font? I have a situation where we are printing a company name on a pre-printed certificate, along with a bit of other slightly variable text. The problem is that the names vary enormously in length. Most fit quite well but some would run to two lines and there just isn't room. What I'd like to do is reduce the font size if, and only if, the name is too big. (Using a smaller font size in a shrinking field is not an option because it looks weird for the majority of companies who have small names. Nor is the option adopted by one user - just let the name get truncated!)
January 25, 200620 yr Do a pattern count an all the characters? (I'm just kidding, you know the answer.)
January 25, 200620 yr You might employ a CF like this one to determine how much space the text takes up, and adjust the size if necessary: http://www.clevelandconsulting.com/support/viewtopic.php?t=510
January 25, 200620 yr OMG, someone took this seriously... Well, at least let's be efficient about it. How about: 2 * Length ( Filter ( text ; "i" ) ) + 3 * Length ( Filter ( text ; "I./:;" ) ) + 4 * Length ( Filter ( text ; "0123456789jt" ) ) + etc....
January 25, 200620 yr One way I did this years ago was to create a layout with huge headers and footers so that one line of text in the body part was one page. Preview the layout, count the number of pages, use this to work out how many lines of test there are, then use this info to change to the appropriate layout.
January 31, 200620 yr Author Vaughan, that is really kludgey. I like it! Thanks. Sorry, Ender but thanks anyway. Where do you find the sizes of the various letters? Edited January 31, 200620 yr by Guest
February 26, 200619 yr Author Thought I'd throw in my eventual solution. Your idea was a bit far out, Vaughan. I ended up with names like 'Murrurundi Heights North R.S.L.' having just "L." on the second line - not quite the look we wanted. What I've done is, on the screen that shows customer details where you go to enter new or look and/or edit, set up replicas of the two fields where size matters and use V8's TextSize() to provide the user with Up and Down arrows to increase or decrease the pitch. Customer's happy so so am I.
Create an account or sign in to comment