Hi all,
Is there a way to measure the length of a string that is going to print in a proportional font in NWP?
I am printing a string onto a check in the memo section. If the string will fit there, I want to print it in a [MEDIUM] sized Arial font, just like the rest of the check. If it won't fit there, I will shrink the font of just that one string. This was easy in non-proportional fonts because you could just compare string lengths. But it's trickier in proportional fonts.
Since you can line up decimals and do other justification of proportional fonts, I thought there may some way to measure a string as well.
-- Susan
Measuring the length of proportional font text
Moderators: Susan Smith, admin, Gabriel
-
- Posts: 717
- Joined: Sun Aug 10, 2008 4:24 am
- Location: Southern California
Each character, upper and lower case has it's own width and I believe that this is imbedded in the font itsself.. However, from a practical point of view, without going into the operating system to look these up and calculate you may want to do the following within BR:
Select the font you are interested in
Do a for next loop to print each character 20 times on a piece of paper
Overlay the paper with a grid (you could use the FNPRINT_GRID in FNSNAP or simply draw three or four veritcal lines over the lines of text
Assign a value of 1 2 or 3 to each letter depending on the width of the printed line (1 for i ans 3 for W)
Enter these numbers into a table
Before you print the line do a for next (or loop while) loop to sum the values of the letters. If the sum exceeds some number that you determine then shrink the font, or as John Bowman has suggested earlier, make the description into two lines breaking it at a space.
George
Select the font you are interested in
Do a for next loop to print each character 20 times on a piece of paper
Overlay the paper with a grid (you could use the FNPRINT_GRID in FNSNAP or simply draw three or four veritcal lines over the lines of text
Assign a value of 1 2 or 3 to each letter depending on the width of the printed line (1 for i ans 3 for W)
Enter these numbers into a table
Before you print the line do a for next (or loop while) loop to sum the values of the letters. If the sum exceeds some number that you determine then shrink the font, or as John Bowman has suggested earlier, make the description into two lines breaking it at a space.
George
-
- Posts: 717
- Joined: Sun Aug 10, 2008 4:24 am
- Location: Southern California