Oldfogey Posted January 25, 2006 Posted January 25, 2006 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!)
comment Posted January 25, 2006 Posted January 25, 2006 Do a pattern count an all the characters? (I'm just kidding, you know the answer.)
Ender Posted January 25, 2006 Posted January 25, 2006 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
comment Posted January 25, 2006 Posted January 25, 2006 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....
Vaughan Posted January 25, 2006 Posted January 25, 2006 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.
Oldfogey Posted January 31, 2006 Author Posted January 31, 2006 (edited) 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, 2006 by Guest
Oldfogey Posted February 26, 2006 Author Posted February 26, 2006 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.
Recommended Posts
This topic is 6837 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now