locked
Strange GetStockObject problem (fonts) RRS feed

  • Question

  • I have two identical computers, one with Windows 7 32 bit ultimate, the other with Windows 7 32 bit Professional.

    Both have the default aero theme selected and enabled with aero effects. Both have screen DPI set to 100% (96 DPI), etc, etc.

    I also have an application that "works" on both systems. This application determines the font to be used in its dialogs by calling GetStockObject(ANSI_VAR_FONT)

    So, here's the problem:

    The first computer returns the same font as any other XP computer that we use. Presumably Microsoft Sans Serif, size 9 (final capital letter "U" height is 9px).

    The other computer returns a larger font, presumably Arial, size 9 (final capital "U" height is 11px). This makes the mentioned application look annoyingly odd.

     

    I checked all the UI settings in windows, exported the theme from one computer to the outher, searched the registry, compared font file sizes,

    but for the life of me, I can't figure out why the second computer returns a different font.

     

    Can anyone please help me with this?

     

    Thanks,

    Jure

    Tuesday, September 21, 2010 11:01 AM

Answers

  • Well, those registry settings are equal on both machines.

    Quite frankly, I'd just reinstall the "faulty" computer, but the problem is that some of our customers' computers are exhibiting the same problem and I'd like to know an easier / less intrusive solution (if reinstallation solves the problem at all).

     

    I did some further testing and discovered that the GetStockObject() function does in fact return THE SAME font on both computers (MS Sans Serif, size 9), just that the second one doesn't render the font equal.

    Naturally the font file is exactly the same on both computers.

    This hints to some corruption, but where?

    • Marked as answer by Miya Yao Thursday, September 30, 2010 9:29 AM
    Friday, September 24, 2010 6:24 AM

All replies

  • Hi Jure,

     

    Thanks for the post!

     

    Did you check the registry?  

     

    Comparing the following value, are the two computers have the same value?

     

    1. [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\GRE_Initialize]

     

    2. [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes]

         MS Shell Dlg 2

         MS Shell Dlg

     

    If they’re different, it means the the GetStockObject doesn’t work, you need to check the application.

     

    Please feel free to give me any update.

     

    Regards,

    Miya Yao

     


    This posting is provided "AS IS" with no warranties, and confers no rights. | Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Thursday, September 23, 2010 8:54 AM
  • Well, those registry settings are equal on both machines.

    Quite frankly, I'd just reinstall the "faulty" computer, but the problem is that some of our customers' computers are exhibiting the same problem and I'd like to know an easier / less intrusive solution (if reinstallation solves the problem at all).

     

    I did some further testing and discovered that the GetStockObject() function does in fact return THE SAME font on both computers (MS Sans Serif, size 9), just that the second one doesn't render the font equal.

    Naturally the font file is exactly the same on both computers.

    This hints to some corruption, but where?

    • Marked as answer by Miya Yao Thursday, September 30, 2010 9:29 AM
    Friday, September 24, 2010 6:24 AM
  • Hi,

     

    Glad to hear the font file is the same on both computers.

     

    As for the corruption you mentioned, did you open the Event Viewer? If there’s any change, it could have some records for helping you find the causes.

     

    Regards,

    Miya Yao


    This posting is provided "AS IS" with no warranties, and confers no rights. | Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Tuesday, September 28, 2010 9:25 AM