Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calculating length of printed string.
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Divers
Thread ID:
00318779
Message ID:
00318806
Vues:
40
Richard,

I believe that you and David are right. I though that I was on to something with FONTMETRIC(19) but in my test with the Epson printer I just now realized that I was doing a TXTMETRIC with 25 asterisks and not 24 which explains the 20 vs 19.2 return.

Thanks, It looks like I will force the font change in the lbx file before printing. It will have to be a text font and not a True Type font since some of my users use high speed text only printers with Generic Text Printer drivers. Oh well, back to the drawing board.

Ed

>Using a fixed font like Courier New is definately the way to go!
>Otherwise you can't be sure how various unknown printers will handle the proportional font...one side effect would be that all those asterisks (if there's multiple lines of them) would not line up in the same columns and the visual effect could be undesirable to your client.
>
>This is a similar problem to one I encountered with Word Wrap...Different printers print the same report differently. And the printed report doesn't match the displayed report. This is because, as you noticed, there's not much consistency between printers and the display image...
>
>In fact, you can have two lines of the exact same metric, and one will word wrap and the other won't...or neither will word wrap on the screen, but one or both may on the printer...and different printers will produce different output...
>
>but this only seems to matter when it counts. :)
>
>good luck and push for a fixed font....then it's easy (easier).
>
>Rick


>----------------
>>I have to be able to pad a string with asterisks so that, when it prints to a label, it will completely cover the length of the label.
>>
>>My question is, given an unknown printer, how do you convert the information from functions like FONTMETRIC() and TXTMETRIC() to calculate the length of a printed string?
>>
>>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.
>>
>>Any help would be appreciated.
>>
>>Ed
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform