Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculating length of printed string.
Message
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00318779
Message ID:
00318798
Views:
21
>Edmond,
>
>FONTMETRIC() is for the screen display only. I think most people solve these kinds of problems by forcing fixed width fonts like Courier New.
>
>>Let's say the font is Arial Normal 8 and FONTMETRIC(6), the average width, is 5 pixels. Leaving out TXTMETRIC() to make the example simple, let's say all of the characters in the string are "average".
>>
>>How many "average" characters do I need to cover a printed inch? Would this depend on the printer's dpi resolution and, if so, how do you determine the selected printer's resolution? I'm confused because a FONTMETRIC(6) return of 5 pixels doesn't go into my laser printer's 300 dpi and come out with a real number of characters per inch.

David,

I was hoping that there was some way to convert screen pixels to printer pixels.

I see FONTMETRIC(19) is "Horizontal aspect for font device". I don't know what this means and can't find any reference to it. However, FONTMETRIC(19,'Arial', 8, 0) returns 96. In real world testing I can print 24 asterisks in one inch on my HP Laser Jet. TXTMETRIC() for 24 asterisks in Arial 8 is 19.2. Multiply this times the average width of 5 and you get 96.

Now, on my Epson LQ-870 dot matric printer I can print 25 asterisks in one inch. I switched my Window's default printer to the Epson and ran the TXTMETRIC again and, this time, I got 20 instead of 19.2. which seems like it might account for the extra asterisk. FONTMETRIC(19), however, still returns 96 so I'm not sure what this all means. I'm going to keep looking for an explaination of what exactly FONTMETRIC(19) is returning and what it means.

If you hear of anything, let me know.

Thanks again.

Ed
Previous
Reply
Map
View

Click here to load this message in the networking platform