Click here to Skip to main content
14,269,869 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have a GDI application used to get device fonts from a printer driver. In the printer driver, DrvQueryFont function returns the pointer to the device font data structure (PIFIMETRICS). This function will be called by GDI rendering engine to give the device fonts that are supported by current printer. The problem is that, it works correctly on 32-bit environment, but doesn't work on 64-bit environment. Please help.

What I have tried:

+ When application starts: the DrvQueryFont() function is called by GDI to get the IFIMETRICS structure for a given font. we have learned about IFIMETRICS structure on MSDN (Microsoft Developer Network).
+ In the remarks for the IFIMETRICS structure is written: "The IFIMETRICS structure's Align member causes it to be larger for x64 machines than for x32 machines, which has ramifications for binary font format files formatted according to this structure. Starting with Windows Server 2003 SP1, an additional, fixed-size structure has been added to Prntfont.h: PRINTIFI32. The PRINTIFI32 structure is identical to the IFIMETRICS structure, except that it does not contain an Align member."
+ We guess that The IFIMETRICS structure's Align member is the cause of this problem.
+ We tried to change the IFIMETRICS structure to the PRINTIFI32 structure to fix this defect, but this problem still occurs
Updated 11-Feb-18 14:57pm

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Obviously the font isnt correctly supported on x64. Havent to got any specific errors? What happens when you use another (working) font?

I hope that your app for x64 is also native x64 bit and free of bugs (like strings as char* or false buffer sizes) else you can have trouble in accessing system data.

Look with the system tool to double check whether the font is supported.

Look for some update of the driver for x64.
Dang Dinh Nghiem 1-Feb-18 21:13pm
I have more information as following.
1. Our own printer driver which is developed by using WDK (Windows Driver Kits 7.1.0), is known as monolithic driver.
2. In addition, I wrote sample application calls EnumFontFamiliesEx() in order to confirm whether the sample application can obtain our own driver's device fonts information both on Windows 32-bit and 64-bit?
+ On Windows 32-bits, sample application can obtain the information of our own printer driver driver's device fonts successfully by using EnumFontFamiliesEx() (as expected)
+ On Windows 64-bits, sample application cannot obtain the information of our own printer driver driver's device fonts successfully by using EnumFontFamiliesEx(). (against expected).
3. Our Monolithic printer dirver uses DrvQueryFont(),DrvQueryFontTree() function which is called by GDI to get IFIMETRICS structure for a given font. However, we found the difference between Windows 64-bits and 32-bits when reproducing problem.
- On Windows 32-bits, DrvQueryFont() is called 140 times and DrvQueryFontTree() is called 140 times
- On Windows 64-bits, DrvQueryFont() is called just 1 time, but DrvQueryFontTree() is not called.
Dang Dinh Nghiem 13-Feb-18 2:15am
Until now, We have not solved this problem. Please help me...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100