Font Sizes

This is a discussion on Font Sizes within the Windows Programming forums, part of the Platform Specific Boards category; I have discovered a unwanted feature in my app. I use a bitmap from resource on a dialog box, also ...

  1. #1
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856

    Font Sizes

    I have discovered a unwanted feature in my app.

    I use a bitmap from resource on a dialog box, also made in resource editor of MSVC 6.

    If the users PC has LARGE fonts (not the default SMALL fonts) it changes the bitmaps dimensions (and other dialog resource dimensions).

    The problem is I have placed frame controls below areas of the bitmap to process mouse clicks ie 'hot spots'. If the bmp's dimensions change then these mouse clicks are no longer correctly processed.

    I can rewrite the dialog to draw its own bmp and so avoid the problem.

    Any other ideas?

    Especially how to detect these large fonts (while I implement the change)?

    (By large fonts I mean under the display settings, advanced. You get a chioce of three, small large or custom)
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    >>> Especially how to detect these large fonts (while I implement the change)?

    Try passing the DC of the desktop to GetDeviceCaps() with LOGPIXELSX as the second parameter. If the system is set to small, this value should be 96.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    I believe the size of the frame/buttons/other controls are proportional to the font used, so if you draw the bitmap relative to those it will most likely get changed too (especially if you stretch it).
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    >>Try passing the DC of the desktop to GetDeviceCaps() with LOGPIXELSX as the second parameter. If the system is set to small, this value should be 96.

    Thanks, I had not thought of that.

    I have not tested it yet but is better than looking at a registry value I found.


    I'm still not sure why the BMP in a frame control changes in size differently than the frame controls without imbedded BMP's.
    At this point I would rather have a solution than a reason though.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  5. #5
    Code Monkey Davros's Avatar
    Join Date
    Jun 2002
    Posts
    812
    Many applications seem to suffer from scaling problems when using large fonts, not just yours.

    I use VCL & have a scaled property associated with all my windows. If scaled is true, I have sizing problems with large fonts, if it false I don't.

    VCL is simply wrapping the win api. Therefore, there should be some api call or property you could set to turn of scaling on your windows.

    I'm not sure what the advantages of scaling are, but it seems to cause more problems than it's worth IMHO.
    OS: Windows XP
    Compilers: MinGW (Code::Blocks), BCB 5

    BigAngryDog.com

  6. #6
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,670
    You could use the following function to render the size in a portable way, too:

    Code:
    int FontSize( int points ) {
      HDC common = GetDC(NULL);
      int height =  ((points * GetDeviceCaps( common, LOGPIXELY ))/72);
      ReleaseDC(NULL, common);
      return height;
     }



    ITSA
    Socket Library!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DirectX | Drawing text
    By gavra in forum Game Programming
    Replies: 4
    Last Post: 06-08-2009, 12:23 AM
  2. problem with my font manager
    By hannibar in forum C Programming
    Replies: 1
    Last Post: 03-07-2006, 07:03 AM
  3. destroywindow() problem
    By algi in forum Windows Programming
    Replies: 6
    Last Post: 03-27-2005, 10:40 PM
  4. button in function
    By algi in forum Windows Programming
    Replies: 1
    Last Post: 03-21-2005, 10:12 PM
  5. char copy
    By variable in forum C Programming
    Replies: 8
    Last Post: 02-06-2005, 09:18 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21