Bug in font management? [Solved]

Bug in font management? [Solved]

Postby Enrico Maria Giordano » Wed Jul 09, 2014 5:32 pm

In the sample below, uncommenting the first PROMPT clause the font is reverted to the default one:

Code: Select all  Expand view  RUN
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg, oFnt

    DEFINE FONT oFnt NAME "Arial" SIZE 0, -9

    DEFINE DIALOG oDlg

    ACTIVATE DIALOG oDlg;
             ON INIT TOOLBAR( oDlg, oFnt );
             CENTER

    RELEASE FONT oFnt

    RETURN NIL


STATIC FUNCTION TOOLBAR( oDlg, oFnt )

    DEFINE BUTTONBAR OF oDlg SIZE 40, 40 2007

    DEFINE BUTTON OF oDlg:oBar;
//           PROMPT "Test"

    DEFINE BUTTON OF oDlg:oBar;
           PROMPT "Test";
           FONT oFnt

    RETURN NIL


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

Re: Bug in font management?

Postby Antonio Linares » Thu Jul 10, 2014 2:22 am

Enrico,

I think it is not a font bug but a TbtnBmp bug. As there is a prompt in the first button, a default font is created, and then on the next button the new used font is not taken into account.

I need to finish the new Class TBtnBmp Method Paint (I am reorganizing it) and it will be much easier to solve it.
regards, saludos

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

Re: Bug in font management?

Postby Antonio Linares » Thu Jul 10, 2014 4:19 am

Enrico,

Please look for hOldFont in Class TBtnBmp where it is assigned and change it this way:

hOldFont = SelectObject( ::hDC, ::oFont:hFont )

That solves it :-)
regards, saludos

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

Re: Bug in font management?

Postby Enrico Maria Giordano » Thu Jul 10, 2014 7:50 am

Antonio,

thank you. I will wait for the full btnbmp bugfix.

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

Re: Bug in font management?

Postby Enrico Maria Giordano » Thu Jul 10, 2014 9:00 am

Antonio,

Antonio Linares wrote:Enrico,

Please look for hOldFont in Class TBtnBmp where it is assigned and change it this way:

hOldFont = SelectObject( ::hDC, ::oFont:hFont )

That solves it :-)


I found two occurrences:

Code: Select all  Expand view  RUN
hOldFont = SelectObject( ::hDC, If( ::lBarBtn, If( ::oWnd:oFont != nil, ::oWnd:oFont:hFont, ::oFont:hFont ), ::oFont:hFont ) )


and

Code: Select all  Expand view  RUN
hOldFont = SelectObject( ::hDC, ::oFont:hFont ) // If( ::lBarBtn, ::oWnd:oWnd:oFont:hFont, ::oFont:hFont ) )


Do I have to change the first as it will look like the second?

Please confirm.

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

Re: Bug in font management?

Postby Enrico Maria Giordano » Thu Jul 10, 2014 9:03 am

I forgot to mention that I'm using the old btnbmp.

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

Re: Bug in font management?

Postby Antonio Linares » Thu Jul 10, 2014 1:27 pm

Enrico,

I have emailed you the most recent version of the Class TBtnBmp, with the new Method Paint(), properly structured :-)

Have you received it ?
regards, saludos

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



Return to Bugs report & fixes / Informe de errores y arreglos

Who is online

Users browsing this forum: No registered users and 4 guests