Thread: Font debugging code

Font debugging code

From
Andreas Pflug
Date:
Hi friends,

I added some font debugging code to frmMain, all you folks that suffer
from bad looking/calculated dialogs, please check the debugging info
that's written to the log file and post the values if there's something
going wrong.
Usually, the metrics for dialog recalculation should be the average
width of the character 'g', and the height of all debugging output
shouldn't differ at all.

Regards,
Andreas



Re: Font debugging code

From
"Dave Page"
Date:

> -----Original Message-----
> From: Andreas Pflug [mailto:pgadmin@pse-consulting.de]
> Sent: 16 October 2003 13:05
> To: pgadmin-hackers
> Subject: [pgadmin-hackers] Font debugging code
>
> Hi friends,
>
> I added some font debugging code to frmMain, all you folks
> that suffer from bad looking/calculated dialogs, please check
> the debugging info that's written to the log file and post
> the values if there's something going wrong.
> Usually, the metrics for dialog recalculation should be the
> average width of the character 'g', and the height of all
> debugging output shouldn't differ at all.

With icon font = 8pt Tahoma:

2003-10-16 14:14:25 INFO   : Using fontmetrics 7/16, 8 Point
2003-10-16 14:14:25 INFO   : Native Description
'0;-11;0;0;0;400;0;0;0;1;0;0;0;0;Tahoma'
2003-10-16 14:14:25 INFO   : Draw size of 'M': w=8, h=13, descent 2,
external lead 0.
2003-10-16 14:14:25 INFO   : Draw size of 'g': w=6, h=13, descent 2,
external lead 0.
2003-10-16 14:14:25 INFO   : Draw size of 'Mg': w=14, h=13, descent 2,
external lead 0.

With icon font = 18pt Tahoma:

2003-10-16 14:18:01 INFO   : Using fontmetrics 7/16, 18 Point
2003-10-16 14:18:01 INFO   : Native Description
'0;-24;0;0;0;400;0;0;0;1;0;0;0;0;Tahoma'
2003-10-16 14:18:01 INFO   : Draw size of 'M': w=19, h=29, descent 5,
external lead 0.
2003-10-16 14:18:01 INFO   : Draw size of 'g': w=13, h=29, descent 5,
external lead 0.
2003-10-16 14:18:01 INFO   : Draw size of 'Mg': w=32, h=29, descent 5,
external lead 0.

Regards, Dave.


Re: Font debugging code

From
Andreas Pflug
Date:
Dave Page wrote:

>
>
>With icon font = 18pt Tahoma:
>
>2003-10-16 14:18:01 INFO   : Using fontmetrics 7/16, 18 Point
>2003-10-16 14:18:01 INFO   : Native Description
>'0;-24;0;0;0;400;0;0;0;1;0;0;0;0;Tahoma'
>2003-10-16 14:18:01 INFO   : Draw size of 'M': w=19, h=29, descent 5,
>external lead 0.
>2003-10-16 14:18:01 INFO   : Draw size of 'g': w=13, h=29, descent 5,
>external lead 0.
>2003-10-16 14:18:01 INFO   : Draw size of 'Mg': w=32, h=29, descent 5,
>external lead 0.
>
>Regards, Dave.
>
>

Huh, that's bloody wrong.
Did you by any chance define wxDIALOG_UNIT_COMPATIBILITY  to 1? This
means backwards compatibility, meaning silly wrong calculation. Is the
'I'd like random values' option.
When you step from frmMain into GetCharWidth(), the code in
wx/src/msw/window.cpp Line 5574 needs to be executed, or the wrong font
is evaluated. Actually, commenting out this part of code doesn't make
any sense at all...

Regards,
Andreas



Re: Font debugging code

From
"Hiroshi Saito"
Date:
Hi Andreas.

It is W2K.
2003-10-16 23:10:02 INFO   : Using fontmetrics 8/18, 9 Point
2003-10-16 23:10:02 INFO   : Native Description '0;-12;0;0;0;400;0;0;0;128;0;0;0;0;MS UI Gothic'
2003-10-16 23:10:02 INFO   : Draw size of 'M': w=9, h=12, descent 2, external lead 0.
2003-10-16 23:10:02 INFO   : Draw size of 'g': w=6, h=12, descent 2, external lead 0.
2003-10-16 23:10:02 INFO   : Draw size of 'Mg': w=15, h=12, descent 2, external lead 0.

regards,
Hiroshi Saito

----- Original Message -----
From: "Andreas Pflug" <pgadmin@pse-consulting.de>


> Hi friends,
>
> I added some font debugging code to frmMain, all you folks that suffer
> from bad looking/calculated dialogs, please check the debugging info
> that's written to the log file and post the values if there's something
> going wrong.
> Usually, the metrics for dialog recalculation should be the average
> width of the character 'g', and the height of all debugging output
> shouldn't differ at all.


Re: Font debugging code

From
"Dave Page"
Date:

> -----Original Message-----
> From: Andreas Pflug [mailto:pgadmin@pse-consulting.de]
> Sent: 16 October 2003 14:49
> To: Dave Page
> Cc: pgadmin-hackers
> Subject: Re: [pgadmin-hackers] Font debugging code
>
>
> Huh, that's bloody wrong.
> Did you by any chance define wxDIALOG_UNIT_COMPATIBILITY  to
> 1?

I didn't set it to 1, it was already 1 as that's the default. I will try
0 when I get a few minutes.

Perhaps we should document the important settings in setup.h?

Regards, Dave.

Re: Font debugging code

From
"Hiroshi Saito"
Date:
Hi Andreas.

It is FreeBSD.
2003-10-16 23:57:25 INFO   : Using fontmetrics 12/13, 10 Point
2003-10-16 23:57:25 INFO   : Native Description 'Sans 10'
2003-10-16 23:57:25 INFO   : Draw size of 'M': w=12, h=13, descent 0, external lead 0.
2003-10-16 23:57:25 INFO   : Draw size of 'g': w=12, h=13, descent 0, external lead 0.
2003-10-16 23:57:25 INFO   : Draw size of 'Mg': w=24, h=13, descent 0, external

However,
It is wrong in something.:-(
This occurs only in today's cvs.

bsd5% LANG=ja_JP.UTF8 src/pgadmin3
(process:80785): Gdk-WARNING **: locale not supported by C library
(process:80785): Gtk-WARNING **: Locale not supported by C library.
        Using the fallback 'C' locale.
...
connecting to ...crash!
...
gdb where..

#0  0x00000000 in ?? ()
#1  0x2904d241 in _swrite () from /usr/lib/libc.so.5
#2  0x2904c8b3 in __sflush () from /usr/lib/libc.so.5
#3  0x2904c818 in __fflush () from /usr/lib/libc.so.5
#4  0x29034e7b in __swbuf () from /usr/lib/libc.so.5
#5  0x28fea91c in __fputwc () from /usr/lib/libc.so.5
#6  0x28fe9430 in __vfwprintf () from /usr/lib/libc.so.5
#7  0x28fe5ce8 in vswprintf () from /usr/lib/libc.so.5
#8  0x0837dfd7 in wxVsnprintf(wchar_t*, unsigned, wchar_t const*, char*) ()
#9  0x0828c379 in wxVLogSql(wchar_t const*, char*) (szFormat=0x8507180,
    argptr=0xbfbfe224 "\214A\b8\025") at utils/sysLogger.cpp:31
#10 0x0828c3ba in wxLogSql(wchar_t const*, ...) (szFormat=0x8507180)
    at utils/sysLogger.cpp:41
#11 0x0818af29 in pgConn::ExecuteSet(wxString const&) (this=0x87f1f40,
    sql=@0xbfbfe2d0) at db/pgConn.cpp:283
#12 0x0818a1ce in pgConn (this=0x87f1f40, server=@0xbfbfe380,
    database=@0x8b97d30, username=@0x8b97d34, password=@0x8b97d38, port=5432,
    sslmode=4) at db/pgConn.cpp:140
#13 0x081c8c5f in pgServer::Connect(wxFrame*, bool) (this=0x8b97d00,
    form=0x891f800, lockFields=false) at schema/pgServer.cpp:123
#14 0x081eafff in frmMain::OnAddServer(wxCommandEvent&) (this=0x891f800,
    ev=@0xbfbfe700) at ui/events.cpp:508
#15 0x0832fac6 in wxAppConsole::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*
)(wxEvent&), wxEvent&) const ()
#16 0x08393404 in wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) ()
#17 0x083929ba in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) ()
#18 0x08393540 in wxEvtHandler::ProcessEvent(wxEvent&) ()
#19 0x0844680f in wxWindowBase::TryParent(wxEvent&) ()
#20 0x083934f9 in wxEvtHandler::ProcessEvent(wxEvent&) ()
#21 0x0843b4a1 in wxToolBarBase::OnLeftClick(int, bool) ()
#22 0x08403ae9 in gtk_toolbar_callback(_GtkWidget*, wxToolBarTool*) ()
#23 0x28c959e7 in g_cclosure_marshal_VOID__VOID ()
   from /usr/local/lib/libgobject-2.0.so.200
#24 0x28c82c01 in g_closure_invoke () from /usr/local/lib/libgobject-2.0.so.200
#25 0x28c9530d in signal_emit_unlocked_R ()
   from /usr/local/lib/libgobject-2.0.so.200
#26 0x28c94684 in g_signal_emit_valist ()
   from /usr/local/lib/libgobject-2.0.so.200
#27 0x28c94904 in g_signal_emit () from /usr/local/lib/libgobject-2.0.so.200
#28 0x28805a42 in gtk_button_clicked ()
   from /usr/X11R6/lib/libgtk-x11-2.0.so.200
#29 0x288069c9 in gtk_button_get_relief ()
   from /usr/X11R6/lib/libgtk-x11-2.0.so.200
#30 0x28c959e7 in g_cclosure_marshal_VOID__VOID ()
   from /usr/local/lib/libgobject-2.0.so.200
#32 0x28c82c01 in g_closure_invoke () from /usr/local/lib/libgobject-2.0.so.200
#33 0x28c95035 in signal_emit_unlocked_R ()
   from /usr/local/lib/libgobject-2.0.so.200
#34 0x28c94684 in g_signal_emit_valist ()
   from /usr/local/lib/libgobject-2.0.so.200
#35 0x28c94904 in g_signal_emit () from /usr/local/lib/libgobject-2.0.so.200
#36 0x28805982 in gtk_button_released ()
   from /usr/X11R6/lib/libgtk-x11-2.0.so.200
#37 0x28806848 in gtk_button_get_relief ()
   from /usr/X11R6/lib/libgtk-x11-2.0.so.200
#38 0x2888f83e in gtk_propagate_event ()
   from /usr/X11R6/lib/libgtk-x11-2.0.so.200
#39 0x28c82ef7 in g_type_class_meta_marshal ()
   from /usr/local/lib/libgobject-2.0.so.200
#40 0x28c82c01 in g_closure_invoke () from /usr/local/lib/libgobject-2.0.so.200
#41 0x28c95497 in signal_emit_unlocked_R ()
   from /usr/local/lib/libgobject-2.0.so.200
#42 0x28c94709 in g_signal_emit_valist ()
   from /usr/local/lib/libgobject-2.0.so.200
#43 0x28c94904 in g_signal_emit () from /usr/local/lib/libgobject-2.0.so.200
#44 0x28973ed6 in gtk_widget_send_expose ()
   from /usr/X11R6/lib/libgtk-x11-2.0.so.200
#45 0x28973baf in gtk_widget_event () from /usr/X11R6/lib/libgtk-x11-2.0.so.200
#46 0x2888f6c5 in gtk_propagate_event ()
   from /usr/X11R6/lib/libgtk-x11-2.0.so.200
#47 0x2888e2bd in gtk_main_do_event ()
   from /usr/X11R6/lib/libgtk-x11-2.0.so.200
#48 0x28a47f52 in gdk_add_client_message_filter ()
   from /usr/X11R6/lib/libgdk-x11-2.0.so.200
#49 0x28cfc11c in g_main_dispatch () from /usr/local/lib/libglib-2.0.so.200
#50 0x28cfcf2a in g_main_context_dispatch ()
   from /usr/local/lib/libglib-2.0.so.200
#51 0x28cfd2dd in g_main_context_iterate ()
   from /usr/local/lib/libglib-2.0.so.200
#52 0x28cfda81 in g_main_loop_run () from /usr/local/lib/libglib-2.0.so.200
#53 0x2888daa7 in gtk_main () from /usr/X11R6/lib/libgtk-x11-2.0.so.200
#54 0x084df397 in wxEventLoop::Run() ()
#55 0x08407d11 in wxAppBase::MainLoop() ()
#56 0x08407e17 in wxAppBase::OnRun() ()
#57 0x0835b823 in wxEntry(int&, wchar_t**) ()
#58 0x08186dff in main (argc=1, argv=0xbfbff750) at pgAdmin3.cpp:73
#59 0x08186c85 in _start ()


Re: Font debugging code

From
Andreas Pflug
Date:
Dave Page wrote:

>
>
>
>
>>-----Original Message-----
>>From: Andreas Pflug [mailto:pgadmin@pse-consulting.de]
>>Sent: 16 October 2003 14:49
>>To: Dave Page
>>Cc: pgadmin-hackers
>>Subject: Re: [pgadmin-hackers] Font debugging code
>>
>>
>>Huh, that's bloody wrong.
>>Did you by any chance define wxDIALOG_UNIT_COMPATIBILITY  to
>>1?
>>
>>
>
>I didn't set it to 1, it was already 1 as that's the default. I will try
>0 when I get a few minutes.
>
>Perhaps we should document the important settings in setup.h?
>
>
We should...

Attached a patch to include/wx/msw/setup0.h, which sets all needed
macros to a sensible default. This should be in our wx snapshot.

Regards,
Andreas

Index: setup0.h
===================================================================
RCS file: /pack/cvsroots/wxwindows/wxWindows/include/wx/msw/setup0.h,v
retrieving revision 1.162
diff -r1.162 setup0.h
61c61
< #define wxDIALOG_UNIT_COMPATIBILITY   1
---
> #define wxDIALOG_UNIT_COMPATIBILITY   0
151c151
<     #define wxUSE_UNICODE 0
---
>     #define wxUSE_UNICODE 1
195c195
< #define wxUSE_EXCEPTIONS    1
---
> #define wxUSE_EXCEPTIONS    0

Re: Font debugging code

From
Andreas Pflug
Date:
Hiroshi Saito wrote:

>Hi Andreas.
>
>It is FreeBSD.
>2003-10-16 23:57:25 INFO   : Using fontmetrics 12/13, 10 Point
>2003-10-16 23:57:25 INFO   : Native Description 'Sans 10'
>2003-10-16 23:57:25 INFO   : Draw size of 'M': w=12, h=13, descent 0, external lead 0.
>2003-10-16 23:57:25 INFO   : Draw size of 'g': w=12, h=13, descent 0, external lead 0.
>2003-10-16 23:57:25 INFO   : Draw size of 'Mg': w=24, h=13, descent 0, external
>
>
Very strange, with of g is the same as M, while sans shouldn't be fixed
font...
However, calculated font metrics match the calculated sizes, so display
should be ok.

>However,
>It is wrong in something.:-(
>This occurs only in today's cvs.
>
>bsd5% LANG=ja_JP.UTF8 src/pgadmin3
>(process:80785): Gdk-WARNING **: locale not supported by C library
>(process:80785): Gtk-WARNING **: Locale not supported by C library.
>        Using the fallback 'C' locale.
>...
>connecting to ...crash!
>
>

Did we have any locale changes in the last days I don't know of?
This is a crash while trying to log an sql statement. Maybe you can
catch it in the debugger, to inspect why it crashes?

Regards,
Andreas



Re: Font debugging code

From
"Hiroshi Saito"
Date:
Hi Andreas.
It thinks that it will be seen variously from now.

Conditions are explained.

1) pgAdmin3-1.0.1 Release + wxWindows-20031010+patch
This works well.
2) pgAdmin3-1.1.0 Developer + wxWindows-20031010+patch
This can't do input of Japanese  in IME.!!
It can't be used.
It seemed to call more problem, and a problem became very difficult.

regards,
Hiroshi Saito

----- Original Message -----
From: "Andreas Pflug" <pgadmin@pse-consulting.de>
To: "Hiroshi Saito" <saito@inetrt.skcapi.co.jp>
Cc: <pgadmin-hackers@postgresql.org>
Sent: Friday, October 17, 2003 2:03 AM
Subject: Re: [pgadmin-hackers] Font debugging code


> Hiroshi Saito wrote:
>
> >Hi Andreas.
> >
> >It is FreeBSD.
> >2003-10-16 23:57:25 INFO   : Using fontmetrics 12/13, 10 Point
> >2003-10-16 23:57:25 INFO   : Native Description 'Sans 10'
> >2003-10-16 23:57:25 INFO   : Draw size of 'M': w=12, h=13, descent 0, external lead 0.
> >2003-10-16 23:57:25 INFO   : Draw size of 'g': w=12, h=13, descent 0, external lead 0.
> >2003-10-16 23:57:25 INFO   : Draw size of 'Mg': w=24, h=13, descent 0, external
> >
> >
> Very strange, with of g is the same as M, while sans shouldn't be fixed
> font...
> However, calculated font metrics match the calculated sizes, so display
> should be ok.
>
> >However,
> >It is wrong in something.:-(
> >This occurs only in today's cvs.
> >
> >bsd5% LANG=ja_JP.UTF8 src/pgadmin3
> >(process:80785): Gdk-WARNING **: locale not supported by C library
> >(process:80785): Gtk-WARNING **: Locale not supported by C library.
> >        Using the fallback 'C' locale.
> >...
> >connecting to ...crash!
> >
> >
>
> Did we have any locale changes in the last days I don't know of?
> This is a crash while trying to log an sql statement. Maybe you can
> catch it in the debugger, to inspect why it crashes?
>
> Regards,
> Andreas
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
>       joining column's datatypes do not match

Re: Font debugging code

From
"Hiroshi Saito"
Date:
Oops,
Continuation.

LC_CTYPE became necessary, too?
As for input of Japanese,  is all right in this.

#!/bin/sh
LC_CTYPE=ja_JP.UTF-8
export LC_CTYPE
LANG=ja_JP.UTF-8
export LANG
pgadmin3

Hi Dave.
Can you have docs/ime_setting.html make an addition.

regards,
Hiroshi Saito

----- Original Message -----
From: "Hiroshi Saito" <saito@inetrt.skcapi.co.jp>


> Hi Andreas.
> It thinks that it will be seen variously from now.
>
> Conditions are explained.
>
> 1) pgAdmin3-1.0.1 Release + wxWindows-20031010+patch
> This works well.
> 2) pgAdmin3-1.1.0 Developer + wxWindows-20031010+patch
> This can't do input of Japanese  in IME.!!
> It can't be used.
> It seemed to call more problem, and a problem became very difficult.
>
> regards,
> Hiroshi Saito


Re: Font debugging code

From
"Dave Page"
Date:

> -----Original Message-----
> From: Hiroshi Saito [mailto:saito@inetrt.skcapi.co.jp]
> Sent: 16 October 2003 19:23
> To: Andreas Pflug
> Cc: Dave Page; pgadmin-hackers@postgresql.org
> Subject: Re: [pgadmin-hackers] Font debugging code
>
> Oops,
> Continuation.
>
> LC_CTYPE became necessary, too?
> As for input of Japanese,  is all right in this.
>
> #!/bin/sh
> LC_CTYPE=ja_JP.UTF-8
> export LC_CTYPE
> LANG=ja_JP.UTF-8
> export LANG
> pgadmin3
>
> Hi Dave.
> Can you have docs/ime_setting.html make an addition.

To which part? Can I have patch or updated file please?

Cheers, Dave.

Re: Font debugging code

From
"Dave Page"
Date:

> -----Original Message-----
> From: Andreas Pflug [mailto:pgadmin@pse-consulting.de]
> Sent: 16 October 2003 17:58
> To: Dave Page
> Cc: pgadmin-hackers
> Subject: Re: [pgadmin-hackers] Font debugging code
>
> Attached a patch to include/wx/msw/setup0.h, which sets all
> needed macros to a sensible default. This should be in our wx
> snapshot.

OK, thanks. I've updated the snapshots of snake and the ftp mirrors, and
left the patch file on snake.

Regards, Dave.

Re: Font debugging code

From
"Dave Page"
Date:

> -----Original Message-----
> From: Andreas Pflug [mailto:pgadmin@pse-consulting.de]
> Sent: 16 October 2003 17:58
> To: Dave Page
> Cc: pgadmin-hackers
> Subject: Re: [pgadmin-hackers] Font debugging code
>
> Attached a patch to include/wx/msw/setup0.h, which sets all
> needed macros to a sensible default. This should be in our wx
> snapshot.

Oh, and I forgot to mention, that fixes the problem :-)

Cheers, Dave.

Re: Font debugging code

From
"Hiroshi Saito"
Date:
Hi Dave.

From: "Dave Page" <dpage@vale-housing.co.uk>
(snip)
> > Hi Dave.
> > Can you have docs/ime_setting.html make an addition.
>
> To which part? Can I have patch or updated file please?

Oh,sorry.
It is this.

Please Apply it.
Thank you.

regards,
Hiroshi Saito

Attachment

Re: Font debugging code

From
"Dave Page"
Date:
Thanks, patch applied.

> -----Original Message-----
> From: Hiroshi Saito [mailto:saito@inetrt.skcapi.co.jp]
> Sent: 17 October 2003 05:53
> To: Dave Page
> Cc: pgadmin-hackers@postgresql.org
> Subject: Re: [pgadmin-hackers] Font debugging code
>
> Hi Dave.
>
> From: "Dave Page" <dpage@vale-housing.co.uk>
> (snip)
> > > Hi Dave.
> > > Can you have docs/ime_setting.html make an addition.
> >
> > To which part? Can I have patch or updated file please?
>
> Oh,sorry.
> It is this.
>
> Please Apply it.
> Thank you.
>
> regards,
> Hiroshi Saito
>

Re: Font debugging code

From
Andreas Pflug
Date:
Hi Hiroshi,

your locale problem seems to be fixed, let's get back to that nasty font
stuff.

Your debug log showed that a 'M' is calculated to have the same width as
'g', using the font 'Sans 10'. This looks irregular, could you debug
what's going on when calling GetTextExtent (frmMain.cpp line 110)? Maybe
this is a Pango issue? What's happening if you're using a different font?

Regards,
Andreas



Re: Font debugging code

From
"Hiroshi Saito"
Date:
Hi Andreas.

From: "Andreas Pflug" <pgadmin@pse-consulting.de>


> Hi Hiroshi,
>
> your locale problem seems to be fixed, let's get back to that nasty font
> stuff.

Oh, It is very good.!
Thank you very much.!!

>
> Your debug log showed that a 'M' is calculated to have the same width as
> 'g', using the font 'Sans 10'. This looks irregular, could you debug
> what's going on when calling GetTextExtent (frmMain.cpp line 110)? Maybe
> this is a Pango issue? What's happening if you're using a different font?

Wait for this a little more.

regards,
Hiroshi Saito

Re: Font debugging code

From
"Hiroshi Saito"
Date:
Hi Andreas.

This was a very reliable point.
Then, Dialog is perfectly reformed.
It is thought very good condition.:-)

regards,
Hiroshi Saito

From: "Andreas Pflug" <pgadmin@pse-consulting.de>


(snip)
> Attached a patch to include/wx/msw/setup0.h, which sets all needed
> macros to a sensible default. This should be in our wx snapshot.