Set Font Height based on Logical Pixels/Inch of the printer

Knowledge exchange related to the VPE Report Engine and PDF Library

Moderator: IDEAL Software Support

Set Font Height based on Logical Pixels/Inch of the printer

Postby arjuna » Thu Dec 09, 2004 10:42 am

I have a requirement for printing font height based on the Logical Pixels per inch of the selected Printer "LOGPIXELSY'.

We want to print the text with the a font having the following settings:
COURIER NEW BOLD
CHARSET = ANSI_CHARSET
WEIGHT = FW_BOLD
PITCHANDFAMILY = FIXED_PITCH
HEIGHT = - 10 * GetDeviceCaps(hDc, LOGPIXELSY) / 96

With the above settings we could create the font. How can we interact this created font with VPE??

Thanks in advance..

Mallikarjuna
arjuna
 
Posts: 3
Joined: Thu Dec 09, 2004 10:28 am

Postby IDEAL Software Support » Thu Dec 09, 2004 1:48 pm

This is simply done by selecting a 10pt font in VPE. To select a font which exactly matches your needs do the following:

VPE.SetFont("Courier New", 10)
VPE.TextBold = true

That's it.

One note: your formula is wrong.

> HEIGHT = - 10 * GetDeviceCaps(hDc, LOGPIXELSY) / 96

must read: HEIGHT = - 10 * GetDeviceCaps(hDc, LOGPIXELSY) / 72

and this is exactly, what VPE computes.

Regards
Thorsten Radde
IDEAL Software GmbH
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm

Postby arjuna » Thu Dec 09, 2004 2:00 pm

Hi

Thanks for the reply..

But we are looking for a different issue..

We are looking for printer specific pixels. These logical pixels varies from printer to printer. Our requirement is to calculate a generic height based on the printers pixels (here the font width is fixed)

Based on the printers logical pixels we want to use VPE.. Is this possible??

If so, how can this be done..

Mallikarjuna
arjuna
 
Posts: 3
Joined: Thu Dec 09, 2004 10:28 am

Postby IDEAL Software Support » Thu Dec 09, 2004 2:57 pm

VPE does this for you. If you select with VPE a 10pt font, it will be 10pt regardless of the output device, i.e. VPE calculates automatically the generic height based on the printers resolution.

And as explained before, VPE uses the following formula for calculating the generic height:

HEIGHT = - 10 * GetDeviceCaps(hDc, LOGPIXELSY) / 72

Regards
Thorsten Radde
IDEAL Software GmbH
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm

Postby arjuna » Thu Dec 09, 2004 4:09 pm

hai..

As i said we are looking for a different issue...

Let me explain it with a simple example....
Suppose if we set font size to 10Pt, the Width and Height is calculated based on the Logical Pixels per inch of the Printer....So, as i already mentioned Logical Pixels per inch varies printer to printer....

Now i want to Customize my font based on the Logical Pixels per inch of the Printer. For that i created(or exactly say Customize) a font using Win API function CreateFont(...); Now my Problem is i want to Use this font with VPE....Here point to note is CreateFont() will not Create a Font Physically (like all windows font are available like icons), instead creates a logical(virtual) font, which is later used by selecting it to the appropriate Device context. Now i want to know how can i select this font into VPE....??

Is there any modules(routines) available now with the VPE...if yes please let me know them...

I think now you understand my Probs...


Any Help will be appriciated....

Thanks in Advance...
Mallikarjuna.
arjuna
 
Posts: 3
Joined: Thu Dec 09, 2004 10:28 am

Postby IDEAL Software Support » Thu Dec 09, 2004 4:43 pm

You can not provide a GDI font-handle to VPE, if this is your question.

But as I tried to explain, VPE can create an exactly identical font, since you know now the formula VPE is using for computing the font height in logical pixels depending on the resolution of the output device.

Regards
Thorsten Radde
IDEAL Software GmbH
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm


Return to VPE Open Forum

Who is online

Users browsing this forum: No registered users and 15 guests

cron