Default font under Win 8 and 10
- James Bott
- Posts: 4840
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Default font under Win 8 and 10
Microsoft's guidelines for apps running under Windows 8 and 10 state that they should be using the font Segoe UI.
I am wondering how we can do this with FW without conditionally assigning a new font to every window and dialog.
I am interested to know how font inheritance works. If, for instance, we assign a new font to an app's main window, then do all other windows and dialogs inherit this font? Or, do we have to assign a new font to every window and dialog?
Would it help if the Window class had the font assigned as CLASSDATA? Wouldn't then all other windows inherit the newly assigned font? Dialogs? How would this affect existing apps?
One other concern is that if the font is dynamically changed depending on the Windows version, is this going to affect the formatting design?
Other thoughts on this welcome.
James
I am wondering how we can do this with FW without conditionally assigning a new font to every window and dialog.
I am interested to know how font inheritance works. If, for instance, we assign a new font to an app's main window, then do all other windows and dialogs inherit this font? Or, do we have to assign a new font to every window and dialog?
Would it help if the Window class had the font assigned as CLASSDATA? Wouldn't then all other windows inherit the newly assigned font? Dialogs? How would this affect existing apps?
One other concern is that if the font is dynamically changed depending on the Windows version, is this going to affect the formatting design?
Other thoughts on this welcome.
James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: Default font under Win 8 and 10
This is the present implementation.
A window/dialog/control having a parent ( clause OF oWnd or OF oDlg specifies the parent) inherits font of that parent unless another font is assigned to it.
A window or dialog (from source) not having a parent, by default is assigned with GetSysFont() size -12.
Function GetSysFont() is in getsysin.prg
A window/dialog/control having a parent ( clause OF oWnd or OF oDlg specifies the parent) inherits font of that parent unless another font is assigned to it.
A window or dialog (from source) not having a parent, by default is assigned with GetSysFont() size -12.
Function GetSysFont() is in getsysin.prg
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Antonio Linares
- Site Admin
- Posts: 42510
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 73 times
- Contact:
Re: Default font under Win 8 and 10
James,
FWH uses function GetSysFont() to retrieve the font name to use.
Currently we are returning "Ms Sans Serif", so in order to follow Microsoft guidelines we are going to modify it
this way:
FWH reuses fonts in order to reduce the GDI consume. Class TFont has the DATAs nCount, lDestroy
to know in how many different places the font is being used. lDestroy becomes true to know when
the font has to be destroyed finally.
You can check the used font doing this:
MsgInfo( oWnd:oFont:cFaceName )
the same works for dialogs and controls too
FWH uses function GetSysFont() to retrieve the font name to use.
Currently we are returning "Ms Sans Serif", so in order to follow Microsoft guidelines we are going to modify it
this way:
Code: Select all | Expand
function GetSysFont()
do case
case ! IsWinNt() .and. ! IsWin95() // Win 3.1
return "System"
endcase
return If( IsWindows10() .or. IsWin8(), "Segoe UI", "Ms Sans Serif" )
FWH reuses fonts in order to reduce the GDI consume. Class TFont has the DATAs nCount, lDestroy
to know in how many different places the font is being used. lDestroy becomes true to know when
the font has to be destroyed finally.
You can check the used font doing this:
MsgInfo( oWnd:oFont:cFaceName )
the same works for dialogs and controls too
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
Re: Default font under Win 8 and 10
Unfortunately the system font is not using for resource dialogs, if I'm not wrong.
EMG
EMG
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: Default font under Win 8 and 10
When a dialog is created from resource and no font is assigned, the GetFont() method tries to created a font object based on the font-metrics of the font contained in the resource. Theoretically the created font object should be identical to the font defined in the resource. But there is a bug and it is different. I could not find how to solve it.
This bug is same / similar to the bug in choosefont(). The font finally created differs in the specs we choose in the font dialog.
Only experts like Mr Antonio and Mr EMG can fix it.
This bug is same / similar to the bug in choosefont(). The font finally created differs in the specs we choose in the font dialog.
Only experts like Mr Antonio and Mr EMG can fix it.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- James Bott
- Posts: 4840
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: Default font under Win 8 and 10
Sorry for my late reply.
Thanks everyone for their input.
Antonio, that would be great if you can make those changes so we don't have to define and assign fonts all the time.
I am concerned about the dialog font issue. It limits our ability to conform to Win8-10 specs. It sounds like the only solution right now would be to not use dialogs from resources? That would be a big pain.
Nages or Enrico, are you saying that this is problem with Windows or with FWH or xHarbour or Harbour?
James
Thanks everyone for their input.
Antonio, that would be great if you can make those changes so we don't have to define and assign fonts all the time.
I am concerned about the dialog font issue. It limits our ability to conform to Win8-10 specs. It sounds like the only solution right now would be to not use dialogs from resources? That would be a big pain.
Nages or Enrico, are you saying that this is problem with Windows or with FWH or xHarbour or Harbour?
James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Re: Default font under Win 8 and 10
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: Default font under Win 8 and 10
Mr James
There is absolutely no problem with dialogs from resources as long as you assign a font to the dialog.
There is absolutely no problem with dialogs from resources as long as you assign a font to the dialog.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- James Bott
- Posts: 4840
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: Default font under Win 8 and 10
Nages,
Ok, but wouldn't it be better to use the getSysFont() to assign it automatically in FWH's dialog class? This would still allow us to override the default by defining a new font.
Otherwise, we have to define the font for every dialog.
James
There is absolutely no problem with dialogs from resources as long as you assign a font to the dialog.
Ok, but wouldn't it be better to use the getSysFont() to assign it automatically in FWH's dialog class? This would still allow us to override the default by defining a new font.
Otherwise, we have to define the font for every dialog.
James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
- James Bott
- Posts: 4840
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: Default font under Win 8 and 10
Nages,
Of course, we would need to test this out to see if the Segoe font might not work with existing dialogs without messing up the layout. That may be an issue.
James
Of course, we would need to test this out to see if the Segoe font might not work with existing dialogs without messing up the layout. That may be an issue.
James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
Re: Default font under Win 8 and 10
James Bott wrote:Nages,There is absolutely no problem with dialogs from resources as long as you assign a font to the dialog.
Ok, but wouldn't it be better to use the getSysFont() to assign it automatically in FWH's dialog class? This would still allow us to override the default by defining a new font.
Otherwise, we have to define the font for every dialog.
James
Yes, absolutely impractical. I vote for auto assign font too, if it's a viable solution.
EMG
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
Re: Default font under Win 8 and 10
James Bott wrote:Nages,
Of course, we would need to test this out to see if the Segoe font might not work with existing dialogs without messing up the layout. That may be an issue.
James
Of course.
EMG