Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How many pixels print per inch?
Message
 
À
24/02/2004 20:27:51
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Divers
Thread ID:
00880558
Message ID:
00880754
Vues:
26
>Hello.
>
>I am trying to figure out how many characters of a given font will print in a given page and printer. The EnumForms function of WinApi provides the width in thousandths of a millimiter for a given form and printer. The FONTMETRIC(6,,,) function of VFP gives the width of a character in pixels. In order to connect them I need the number of pixels that will be printed per unit of width. How can I get that?
>
>TIA,
>
>Alex

Why not go with a fixed pitch font?

I devised a conversion factor for a Word Automation, so that VFP could properly postion text (and other objects) on a word document. I do not know if it will help, but my ratio was:
PELsToInches=71.94</i>
I also got this help from Doug H. when applying HotTracking in OCX:
<pre>PROCEDURE GetDisplayMetrics
LOCAL liHwnd,liHDC,liPixelsPerInchX,liPixelsPerInchY
* Constants
* log_pixels_x from wingdi 88
* log_pixels_Y             90
* twips_per_inch         1440
* Declare APIs
declare integer GetActiveWindow in WIN32API
declare integer GetDC in WIN32API integer iHDC
declare integer GetDeviceCaps in WIN32API integer iHDC,integer iIndex
* Device context
liHwnd=GetActiveWindow()
liHDC=GetDC(liHwnd)
* Pixels per Inch
liPixelsPerInchX=GetDeviceCaps(liHDC,88)
liPixelsPerInchY=GetDeviceCaps(liHDC,90)
* Twips per pixel and store
unLTVX=1440/liPixelsPerInchX
unLTVY=1440/liPixelsPerInchY
*_vfp.AutoYield=.t.
CLEAR DLLS
ENDPROC &&RIODisplayMetrics
Imagination is more important than knowledge
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform