Default font under Win 8 and 10

Default font under Win 8 and 10

Postby James Bott » Sun Aug 14, 2016 3:38 pm

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
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Default font under Win 8 and 10

Postby nageswaragunupudi » Sun Aug 14, 2016 4:53 pm

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
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Default font under Win 8 and 10

Postby Antonio Linares » Sun Aug 14, 2016 5:08 pm

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:
Code: Select all  Expand view
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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42093
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Default font under Win 8 and 10

Postby Enrico Maria Giordano » Sun Aug 14, 2016 5:21 pm

Unfortunately the system font is not using for resource dialogs, if I'm not wrong.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Default font under Win 8 and 10

Postby nageswaragunupudi » Sun Aug 14, 2016 5:29 pm

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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Default font under Win 8 and 10

Postby James Bott » Wed Aug 17, 2016 10:17 pm

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
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Default font under Win 8 and 10

Postby cnavarro » Wed Aug 17, 2016 10:22 pm

Function GetSysFont(), has been modified

viewtopic.php?f=16&t=32792#p193101
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
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Default font under Win 8 and 10

Postby nageswaragunupudi » Wed Aug 17, 2016 11:28 pm

Mr James

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
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Default font under Win 8 and 10

Postby James Bott » Wed Aug 17, 2016 11:32 pm

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
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Default font under Win 8 and 10

Postby James Bott » Wed Aug 17, 2016 11:34 pm

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
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Default font under Win 8 and 10

Postby Enrico Maria Giordano » Thu Aug 18, 2016 8:30 am

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
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Default font under Win 8 and 10

Postby Enrico Maria Giordano » Thu Aug 18, 2016 8:31 am

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
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 73 guests