Loading ...
Sorry, an error occurred while loading the content.

Default Font Bolded

Expand Messages
  • yarp
    Hi, I have noticed in a number of situations that DefaultGuiFont (or whatever it is) is always Bolded when I plot some Text on Screen or Printer. For example I
    Message 1 of 10 , Mar 7, 2010
    • 0 Attachment
      Hi,
      I have noticed in a number of situations that DefaultGuiFont (or whatever it is) is always Bolded when I plot some Text on Screen or Printer.
      For example I had a Text that I update for a progress bar and first call to SetWindowText gives a bolded display while subsequent calls are not.
      Today I noticed the same effect on a Printer output (with DrawText) this time (first page Title was bolded and subsequents are not).

      So my question is:
      anybodys knows how I could force a Device Context default font to be non bold ?

      Thanks in advance,

      Yarp
    • Political
      I ve used SPI_GETNONCLIENTMETRICS with SystemParametersInfo() to get a default GUI font in the past. Something like this: NONCLIENTMETRICS ncm; ncm.cbSize =
      Message 2 of 10 , Mar 8, 2010
      • 0 Attachment
        I've used SPI_GETNONCLIENTMETRICS with SystemParametersInfo() to get a default GUI font in the past. Something like this:

        NONCLIENTMETRICS ncm;
        ncm.cbSize = sizeof( ncm );
        SystemParametersInfo( SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0 );
        ncm.lfCaptionFont.lfWeight = FW_NORMAL;
        HFONT hFont = CreateFontIndirect( &(ncm.lfCaptionFont) );


        This creates non-bold Tahoma in WinXP and Segoe UI in Win7.



        --- In wtl@yahoogroups.com, "yarp" <lac@...> wrote:
        >
        > Hi,
        > I have noticed in a number of situations that DefaultGuiFont (or whatever it is) is always Bolded when I plot some Text on Screen or Printer.
        > For example I had a Text that I update for a progress bar and first call to SetWindowText gives a bolded display while subsequent calls are not.
        > Today I noticed the same effect on a Printer output (with DrawText) this time (first page Title was bolded and subsequents are not).
        >
        > So my question is:
        > anybodys knows how I could force a Device Context default font to be non bold ?
        >
        > Thanks in advance,
        >
        > Yarp
        >
      • yarp
        Hi, thanks, this is very interesting. But I wanted to avoid to create a new font and reuse a default DC font instead. My question was rather: how do I force a
        Message 3 of 10 , Mar 8, 2010
        • 0 Attachment
          Hi,
          thanks, this is very interesting. But I wanted to avoid to create a new font and reuse a default DC font instead.

          My question was rather: how do I force a given DC font boldness to normal ?

          Yarp

          --- In wtl@yahoogroups.com, "Political" <politicalconfusion@...> wrote:
          >
          > I've used SPI_GETNONCLIENTMETRICS with SystemParametersInfo() to get a default GUI font in the past. Something like this:
          >
          > NONCLIENTMETRICS ncm;
          > ncm.cbSize = sizeof( ncm );
          > SystemParametersInfo( SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0 );
          > ncm.lfCaptionFont.lfWeight = FW_NORMAL;
          > HFONT hFont = CreateFontIndirect( &(ncm.lfCaptionFont) );
          >
          >
          > This creates non-bold Tahoma in WinXP and Segoe UI in Win7.
          >
          >
        • Johann Gerell
          ... If you do that, then you *are* creating a new font. /Johann ... From: wtl@yahoogroups.com [mailto:wtl@yahoogroups.com] On Behalf Of yarp Sent: den 9 mars
          Message 4 of 10 , Mar 8, 2010
          • 0 Attachment
            > thanks, this is very interesting. But I wanted to avoid
            > to create a new font and reuse a default DC font instead.
            >
            > My question was rather: how do I force a given DC font
            > boldness to normal ?


            If you do that, then you *are* creating a new font.


            /Johann


            -----Original Message-----
            From: wtl@yahoogroups.com [mailto:wtl@yahoogroups.com] On Behalf Of yarp
            Sent: den 9 mars 2010 08:19
            To: wtl@yahoogroups.com
            Subject: [wtl] Re: Default Font Bolded

            Hi,
            thanks, this is very interesting. But I wanted to avoid to create a new font
            and reuse a default DC font instead.

            My question was rather: how do I force a given DC font boldness to normal ?

            Yarp

            --- In wtl@yahoogroups.com, "Political" <politicalconfusion@...> wrote:
            >
            > I've used SPI_GETNONCLIENTMETRICS with SystemParametersInfo() to get a
            default GUI font in the past. Something like this:
            >
            > NONCLIENTMETRICS ncm;
            > ncm.cbSize = sizeof( ncm );
            > SystemParametersInfo( SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0 );
            > ncm.lfCaptionFont.lfWeight = FW_NORMAL;
            > HFONT hFont = CreateFontIndirect( &(ncm.lfCaptionFont) );
            >
            >
            > This creates non-bold Tahoma in WinXP and Segoe UI in Win7.
            >
            >





            ------------------------------------

            Yahoo! Groups Links
          • yarp
            Really ? So, I will probably end up creating a Font, but this returns back to my initial question: Why is the font bold on first call and then normal ? Does it
            Message 5 of 10 , Mar 9, 2010
            • 0 Attachment
              Really ? So, I will probably end up creating a Font, but this returns back to my initial question:

              Why is the font bold on first call and then normal ?

              Does it mean that something in the OnPaint procedure has altered the Font and that -as you pointed out- a new font has been created which is now in use ?

              I just would like to understand what happened.

              Yarp


              --- In wtl@yahoogroups.com, "Johann Gerell" <johann@...> wrote:
              >
              > > thanks, this is very interesting. But I wanted to avoid
              > > to create a new font and reuse a default DC font instead.
              > >
              > > My question was rather: how do I force a given DC font
              > > boldness to normal ?
              >
              >
              > If you do that, then you *are* creating a new font.
              >
              >
              > /Johann
              >
              >
              > -----Original Message-----
              > From: wtl@yahoogroups.com [mailto:wtl@yahoogroups.com] On Behalf Of yarp
              > Sent: den 9 mars 2010 08:19
              > To: wtl@yahoogroups.com
              > Subject: [wtl] Re: Default Font Bolded
              >
              > Hi,
              > thanks, this is very interesting. But I wanted to avoid to create a new font
              > and reuse a default DC font instead.
              >
              > My question was rather: how do I force a given DC font boldness to normal ?
              >
              > Yarp
              >
              > --- In wtl@yahoogroups.com, "Political" <politicalconfusion@> wrote:
              > >
              > > I've used SPI_GETNONCLIENTMETRICS with SystemParametersInfo() to get a
              > default GUI font in the past. Something like this:
              > >
              > > NONCLIENTMETRICS ncm;
              > > ncm.cbSize = sizeof( ncm );
              > > SystemParametersInfo( SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0 );
              > > ncm.lfCaptionFont.lfWeight = FW_NORMAL;
              > > HFONT hFont = CreateFontIndirect( &(ncm.lfCaptionFont) );
              > >
              > >
              > > This creates non-bold Tahoma in WinXP and Segoe UI in Win7.
              > >
              > >
              >
              >
              >
              >
              >
              > ------------------------------------
              >
              > Yahoo! Groups Links
              >
            • ntufarellich
              Take a look at these: http://blogs.msdn.com/oldnewthing/archive/2005/07/07/436435.aspx and http://msdn.microsoft.com/en-us/library/dd144925(VS.85).aspx The
              Message 6 of 10 , Mar 9, 2010
              • 0 Attachment
                Take a look at these:

                http://blogs.msdn.com/oldnewthing/archive/2005/07/07/436435.aspx

                and

                http://msdn.microsoft.com/en-us/library/dd144925(VS.85).aspx

                The documentation of GetStockObject function on MSDN (the second link) says:

                It is not recommended that you employ this method to obtain the current font used by dialogs and windows. Instead, use the SystemParametersInfo function with the SPI_GETNONCLIENTMETRICS parameter to retrieve the current font. SystemParametersInfo will take into account the current theme and provides font information for captions, menus, and message dialogs.






                --- In wtl@yahoogroups.com, "yarp" <lac@...> wrote:
                >
                > Really ? So, I will probably end up creating a Font, but this returns back to my initial question:
                >
                > Why is the font bold on first call and then normal ?
                >
                > Does it mean that something in the OnPaint procedure has altered the Font and that -as you pointed out- a new font has been created which is now in use ?
                >
                > I just would like to understand what happened.
                >
                > Yarp
                >
                >
                > --- In wtl@yahoogroups.com, "Johann Gerell" <johann@> wrote:
                > >
                > > > thanks, this is very interesting. But I wanted to avoid
                > > > to create a new font and reuse a default DC font instead.
                > > >
                > > > My question was rather: how do I force a given DC font
                > > > boldness to normal ?
                > >
                > >
                > > If you do that, then you *are* creating a new font.
                > >
                > >
                > > /Johann
                > >
                > >
                > > -----Original Message-----
                > > From: wtl@yahoogroups.com [mailto:wtl@yahoogroups.com] On Behalf Of yarp
                > > Sent: den 9 mars 2010 08:19
                > > To: wtl@yahoogroups.com
                > > Subject: [wtl] Re: Default Font Bolded
                > >
                > > Hi,
                > > thanks, this is very interesting. But I wanted to avoid to create a new font
                > > and reuse a default DC font instead.
                > >
                > > My question was rather: how do I force a given DC font boldness to normal ?
                > >
                > > Yarp
                > >
                > > --- In wtl@yahoogroups.com, "Political" <politicalconfusion@> wrote:
                > > >
                > > > I've used SPI_GETNONCLIENTMETRICS with SystemParametersInfo() to get a
                > > default GUI font in the past. Something like this:
                > > >
                > > > NONCLIENTMETRICS ncm;
                > > > ncm.cbSize = sizeof( ncm );
                > > > SystemParametersInfo( SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0 );
                > > > ncm.lfCaptionFont.lfWeight = FW_NORMAL;
                > > > HFONT hFont = CreateFontIndirect( &(ncm.lfCaptionFont) );
                > > >
                > > >
                > > > This creates non-bold Tahoma in WinXP and Segoe UI in Win7.
                > > >
                > > >
                > >
                > >
                > >
                > >
                > >
                > > ------------------------------------
                > >
                > > Yahoo! Groups Links
                > >
                >
              • yarp
                Seems like I ran into an interesting problem. The first lesson is not to use AtlGetDefaultGuiFont anymore. And the second one is to write a new wrapper. Thank
                Message 7 of 10 , Mar 10, 2010
                • 0 Attachment
                  Seems like I ran into an interesting problem.
                  The first lesson is not to use AtlGetDefaultGuiFont anymore.
                  And the second one is to write a new wrapper.

                  Thank you for the links that OldNewThing blog is a real blessing I should visit it more often.

                  Yarp

                  --- In wtl@yahoogroups.com, "ntufarellich" <ntufarelli@...> wrote:
                  >
                  > Take a look at these:
                  >
                  > http://blogs.msdn.com/oldnewthing/archive/2005/07/07/436435.aspx
                  >
                  > and
                  >
                  > http://msdn.microsoft.com/en-us/library/dd144925(VS.85).aspx
                  >
                  > The documentation of GetStockObject function on MSDN (the second link) says:
                  >
                  > It is not recommended that you employ this method to obtain the current font used by dialogs and windows. Instead, use the SystemParametersInfo function with the SPI_GETNONCLIENTMETRICS parameter to retrieve the current font. SystemParametersInfo will take into account the current theme and provides font information for captions, menus, and message dialogs.
                  >
                • Nenad Stefanovic
                  Hi Yarp, The default font for DC is SYSTEM_FONT, which is bold-only bitmap font (the one you can see in WinDiff). You *don t* want to use that font. So, you
                  Message 8 of 10 , Mar 10, 2010
                  • 0 Attachment
                    Hi Yarp,



                    The "default" font for DC is SYSTEM_FONT, which is bold-only bitmap font
                    (the one you can see in WinDiff). You *don't* want to use that font. So, you
                    have to create and select a font before drawing text.



                    For general discussion about fonts:

                    There is nothing wrong with AtlGetDefaultGuiFont() if you understand that it
                    is not a universal font solution. It gives you the font which is the same as
                    "MS Shell Dlg". The better solution for applications is to use desired font
                    directly.



                    Using fonts from NONCLIENTMETRICS is OK for their intended use, but not for
                    something else. For example, if you have Edit-based view window, and you use
                    Caption font, then your Edit view font will depend on the user setting for
                    the Caption font. The same for other fonts in NONCLIENTMETRICS.



                    OldNewThing blog has fantastic information, but is sometimes hard to
                    understand. Here is another excellent blog discussing these topics:



                    http://blogs.msdn.com/michkap/archive/2006/06/11/626100.aspx

                    http://blogs.msdn.com/michkap/archive/2006/03/18/554308.aspx



                    All this reminded me that we should review and make sure that font handling
                    in WTL is correct. We will do that.



                    Cheers,

                    Nenad





                    From: wtl@yahoogroups.com [mailto:wtl@yahoogroups.com] On Behalf Of yarp
                    Sent: Wednesday, March 10, 2010 12:41 AM
                    To: wtl@yahoogroups.com
                    Subject: [wtl] Re: Default Font Bolded





                    Seems like I ran into an interesting problem.
                    The first lesson is not to use AtlGetDefaultGuiFont anymore.
                    And the second one is to write a new wrapper.

                    Thank you for the links that OldNewThing blog is a real blessing I should
                    visit it more often.

                    Yarp

                    --- In wtl@yahoogroups.com <mailto:wtl%40yahoogroups.com> , "ntufarellich"
                    <ntufarelli@...> wrote:
                    >
                    > Take a look at these:
                    >
                    > http://blogs.msdn.com/oldnewthing/archive/2005/07/07/436435.aspx
                    >
                    > and
                    >
                    > http://msdn.microsoft.com/en-us/library/dd144925(VS.85).aspx
                    >
                    > The documentation of GetStockObject function on MSDN (the second link)
                    says:
                    >
                    > It is not recommended that you employ this method to obtain the current
                    font used by dialogs and windows. Instead, use the SystemParametersInfo
                    function with the SPI_GETNONCLIENTMETRICS parameter to retrieve the current
                    font. SystemParametersInfo will take into account the current theme and
                    provides font information for captions, menus, and message dialogs.
                    >





                    [Non-text portions of this message have been removed]
                  • yarp
                    Hi Nenad, ... Didn t got that. My remark on AtlDefaultGuiFont was based on what I have read on OldNewThing blog ( ...Windows itself stopped using it in favor
                    Message 9 of 10 , Mar 11, 2010
                    • 0 Attachment
                      Hi Nenad,
                      > You *don't* want to use that font. So, you
                      > have to create and select a font before drawing text.
                      Didn't got that.

                      My remark on AtlDefaultGuiFont was based on what I have read on OldNewThing blog ("...Windows itself stopped using it in favor of the various fonts returned"). I realize things are -not surprinsingly- more complex.

                      Thanks for the explanations and links.
                      Also thanks so much for your involvement in WTL. I can't tell how much I love working with this Library.

                      Yarp

                      --- In wtl@yahoogroups.com, "Nenad Stefanovic" <nenad2001@...> wrote:
                      >
                      > Hi Yarp,
                      >
                      > The "default" font for DC is SYSTEM_FONT, which is bold-only bitmap font
                      > (the one you can see in WinDiff). You *don't* want to use that font. So, you
                      > have to create and select a font before drawing text.
                      >
                      > For general discussion about fonts:
                      >
                      > There is nothing wrong with AtlGetDefaultGuiFont() if you understand that it
                      > is not a universal font solution. It gives you the font which is the same as
                      > "MS Shell Dlg". The better solution for applications is to use desired font
                      > directly.
                      >
                      > Using fonts from NONCLIENTMETRICS is OK for their intended use, but not for
                      > something else. For example, if you have Edit-based view window, and you use
                      > Caption font, then your Edit view font will depend on the user setting for
                      > the Caption font. The same for other fonts in NONCLIENTMETRICS.
                      >
                      >
                      >
                      > OldNewThing blog has fantastic information, but is sometimes hard to
                      > understand. Here is another excellent blog discussing these topics:
                      >
                      > http://blogs.msdn.com/michkap/archive/2006/06/11/626100.aspx
                      > http://blogs.msdn.com/michkap/archive/2006/03/18/554308.aspx
                      >
                      > All this reminded me that we should review and make sure that font handling
                      > in WTL is correct. We will do that.
                      >
                      > Cheers,
                      >
                      > Nenad
                      >
                      >
                    • Nenad Stefanovic
                      Thank you for your support! Cheers, Nenad From: wtl@yahoogroups.com [mailto:wtl@yahoogroups.com] On Behalf Of yarp Sent: Thursday, March 11, 2010 12:19 AM To:
                      Message 10 of 10 , Mar 11, 2010
                      • 0 Attachment
                        Thank you for your support!



                        Cheers,

                        Nenad





                        From: wtl@yahoogroups.com [mailto:wtl@yahoogroups.com] On Behalf Of yarp
                        Sent: Thursday, March 11, 2010 12:19 AM
                        To: wtl@yahoogroups.com
                        Subject: [wtl] Re: Default Font Bolded





                        Hi Nenad,
                        > You *don't* want to use that font. So, you
                        > have to create and select a font before drawing text.
                        Didn't got that.

                        My remark on AtlDefaultGuiFont was based on what I have read on OldNewThing
                        blog ("...Windows itself stopped using it in favor of the various fonts
                        returned"). I realize things are -not surprinsingly- more complex.

                        Thanks for the explanations and links.
                        Also thanks so much for your involvement in WTL. I can't tell how much I
                        love working with this Library.

                        Yarp

                        --- In wtl@yahoogroups.com <mailto:wtl%40yahoogroups.com> , "Nenad
                        Stefanovic" <nenad2001@...> wrote:
                        >
                        > Hi Yarp,
                        >
                        > The "default" font for DC is SYSTEM_FONT, which is bold-only bitmap font
                        > (the one you can see in WinDiff). You *don't* want to use that font. So,
                        you
                        > have to create and select a font before drawing text.
                        >
                        > For general discussion about fonts:
                        >
                        > There is nothing wrong with AtlGetDefaultGuiFont() if you understand that
                        it
                        > is not a universal font solution. It gives you the font which is the same
                        as
                        > "MS Shell Dlg". The better solution for applications is to use desired
                        font
                        > directly.
                        >
                        > Using fonts from NONCLIENTMETRICS is OK for their intended use, but not
                        for
                        > something else. For example, if you have Edit-based view window, and you
                        use
                        > Caption font, then your Edit view font will depend on the user setting for
                        > the Caption font. The same for other fonts in NONCLIENTMETRICS.
                        >
                        >
                        >
                        > OldNewThing blog has fantastic information, but is sometimes hard to
                        > understand. Here is another excellent blog discussing these topics:
                        >
                        > http://blogs.msdn.com/michkap/archive/2006/06/11/626100.aspx
                        > http://blogs.msdn.com/michkap/archive/2006/03/18/554308.aspx
                        >
                        > All this reminded me that we should review and make sure that font
                        handling
                        > in WTL is correct. We will do that.
                        >
                        > Cheers,
                        >
                        > Nenad
                        >
                        >





                        [Non-text portions of this message have been removed]
                      Your message has been successfully submitted and would be delivered to recipients shortly.