Menu

#326 TLayoutWindow ignores font setting

7
closed
GUI (77)
1
2025-11-01
2015-10-20
No

When specifiying the layout of the children of a TLayoutWindow, the user can use measurement units relative to the current window font (see TMeasurementUnits). The units are converted to pixels based on the font height, which is determined by TLayoutWindow::GetFontHeight by calling WM_GETFONT.

However, TLayoutWindow does not provide an implementation of WM_GETFONT and WM_SETFONT. So an attempt to set the associated window font by sending WM_SETFONT (e.g. by calling TWindow::SetWindowFont) has no effect, and WM_GETFONT (TWindow::GetWindowFont) will always return NULL, leading TLayoutWindow to use the outdated SYSTEM_FONT instead. For a deeper dive into WM_GETFONT and WM_SETFONT, see the blog post "When I send a WM_GETFONT message to a window, why don't I get a font?" at The Old New Thing.

Although WM_GETFONT and WM_SETFONT can be implemented by subclassing TLayoutWindow, it would be helpful if these messages were implemented in the base, as to provide complete support for font-relative units. Since the documentation alludes to such support, and does nothing to explain the need to implement WM_GETFONT and WM_SETFONT, I have classified this issue as a bug, rather than a feature request.

Related

Bugs: #630
Discussion: TWindow::Create fails for TTooltip after port to OWLNext 7
Discussion: TLayoutWindow ignores font setting
Wiki: Frequently_Asked_Questions

Discussion

  • Vidar Hasfjord

    Vidar Hasfjord - 2015-10-21
    • status: open --> pending

    This issue was fixed in [r3294] and merged into Owlet in [r3295].

     

    Related

    Commit: [r3294]
    Commit: [r3295]


    Last edit: Vidar Hasfjord 2015-10-21
  • Vidar Hasfjord

    Vidar Hasfjord - 2020-05-18
    • Status: pending --> closed
     
  • Vidar Hasfjord

    Vidar Hasfjord - 2025-11-01
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,5 +1,5 @@
     When specifiying the layout of the children of a TLayoutWindow, the user can use measurement units relative to the current window font (see [TMeasurementUnits](http://owlnext.sourceforge.net/help/html/d9/da3/group___layout.html#ga606af359cb4de53a05e18a18be8ed48a)). The units are converted to pixels based on the font height, which is determined by [TLayoutWindow::GetFontHeight](http://sourceforge.net/p/owlnext/code/3291/tree/trunk/source/owlcore/layoutwi.cpp#l1321) by calling [WM_GETFONT](http://msdn.microsoft.com/en-us/library/windows/desktop/ms632624.aspx).
    
    -However, TLayoutWindow does not provide an implementation of WM_GETFONT and WM_SETFONT. So an attempt to set the associated window font by sending WM_SETFONT (e.g. by calling TWindow::SetWindowFont) has no effect, and WM_GETFONT (TWindow::GetWindowFont) will always return NULL, leading TLayoutWindow to use the outdated SYSTEM_FONT instead. For a deeper dive into WM_GETFONT and WM_SETFONT, see the blog post "When I send a WM_GETFONT message to a window, why don't I get a font?" at [The Old New Thing](http://blogs.msdn.com/b/oldnewthing/archive/2014/07/24/10544760.aspx).
    +However, TLayoutWindow does not provide an implementation of WM_GETFONT and WM_SETFONT. So an attempt to set the associated window font by sending WM_SETFONT (e.g. by calling TWindow::SetWindowFont) has no effect, and WM_GETFONT (TWindow::GetWindowFont) will always return NULL, leading TLayoutWindow to use the outdated SYSTEM_FONT instead. For a deeper dive into WM_GETFONT and WM_SETFONT, see the blog post "When I send a WM_GETFONT message to a window, why don't I get a font?" at [The Old New Thing](https://devblogs.microsoft.com/oldnewthing/20140724-00/?p=413).
    
     Although WM_GETFONT and WM_SETFONT can be implemented by subclassing TLayoutWindow, it would be helpful if these messages were implemented in the base, as to provide complete support for font-relative units. Since the documentation alludes to such support, and does nothing to explain the need to implement WM_GETFONT and WM_SETFONT, I have classified this issue as a bug, rather than a feature request.
    
     

Log in to post a comment.

MongoDB Logo MongoDB