[wxPython] standard font faces

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[wxPython] standard font faces

alexander smishlajev-3
hello all!

can i override font faces used for standard families like wxDEFAULT and
wxMODERN in my application?  in Xwindows, .Xdefaults may help (haven't
tried it though), but what about MS windows?

actually, the problem is in code page.  by default, wx uses "western"
encoding, and i need something different, like baltic or cyrillic.  i
can make a font substitute, say, "Arial Cyr" for Arial cyrillic, but
then i have to either explicitely set font on each window, or use
derived classes for all windows.  are there any better ways?

best wishes,
alex.


_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] standard font faces

Robin Dunn
>
> can i override font faces used for standard families like wxDEFAULT and
> wxMODERN in my application?  in Xwindows, .Xdefaults may help (haven't
> tried it though), but what about MS windows?

The last parameter of the wxFont constructor is a faceName value, but it is
slightly platform dependent.  On windows it would be the name of the font.
On X I think it is the full Adobe font name (with all the "-*-" style
values.)  You can try calling GetFaceName on a font to see what is really
being used there.

>
> actually, the problem is in code page.  by default, wx uses "western"
> encoding, and i need something different, like baltic or cyrillic.  i
> can make a font substitute, say, "Arial Cyr" for Arial cyrillic, but
> then i have to either explicitely set font on each window, or use
> derived classes for all windows.  are there any better ways?

There is some work going on right now in wxWindows to enable selection of
font encoding and also to enumerate all available fonts and encodings.  It's
still brand new and in flux, but it looks like what you are looking for.  It
will be in a future release of wxPython.

--
Robin Dunn
Software Craftsman
[hidden email]
http://AllDunn.com/robin/
http://AllDunn.com/wxPython/  Check it out!



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] standard font faces

alexander smishlajev-3
Robin Dunn wrote:
>
> > can i override font faces used for standard families like wxDEFAULT and
> > wxMODERN in my application?  in Xwindows, .Xdefaults may help (haven't
> > tried it though), but what about MS windows?
>
> The last parameter of the wxFont constructor is a faceName value

sorry, the question question was ambiguous (my english needs to be
improved a lot).  the idea was to substitute (at application startup)
all those fontfaces of standard families in order to eliminate the need
to set font for every particular window.  so that _all_ newly created
windows use application-specific fonts instead of wxWindows defaults.

> There is some work going on right now in wxWindows to enable selection of
> font encoding and also to enumerate all available fonts and encodings.  It's
> still brand new and in flux, but it looks like what you are looking for.  It
> will be in a future release of wxPython.

good news.  may those results appear within two or three months?

best wishes,
alex.



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] standard font faces

Robin Dunn
> Robin Dunn wrote:
> >
> > > can i override font faces used for standard families like wxDEFAULT
and

> > > wxMODERN in my application?  in Xwindows, .Xdefaults may help (haven't
> > > tried it though), but what about MS windows?
> >
> > The last parameter of the wxFont constructor is a faceName value
>
> sorry, the question question was ambiguous (my english needs to be
> improved a lot).  the idea was to substitute (at application startup)
> all those fontfaces of standard families in order to eliminate the need
> to set font for every particular window.  so that _all_ newly created
> windows use application-specific fonts instead of wxWindows defaults.
>

I see.  No it looks like the actual faces that are used are hard coded.
Here is a snippet of the C++ code that decides this for X:

    switch (family)
    {
        case wxDECORATIVE: xfamily = _T("lucida"); break;
        case wxROMAN:      xfamily = _T("times");  break;
        case wxMODERN:     xfamily = _T("courier"); break;
        case wxSWISS:      xfamily = _T("helvetica"); break;
        case wxTELETYPE:   xfamily = _T("lucidatypewriter"); break;
        case wxSCRIPT:     xfamily = _T("utopia"); break;
        default:           xfamily = _T("*");
    }

Once all the attributes are substituted into the adobe font spec then the
"nearest matching font" is selected and used.

The good news however is that it looks like when the encoding work is done
that you will be able to set the default encoding for the app.



> > There is some work going on right now in wxWindows to enable selection
of
> > font encoding and also to enumerate all available fonts and encodings.
It's
> > still brand new and in flux, but it looks like what you are looking for.
It
> > will be in a future release of wxPython.
>
> good news.  may those results appear within two or three months?
>

Yes.

--
Robin Dunn
Software Craftsman
[hidden email]
http://AllDunn.com/robin/
http://AllDunn.com/wxPython/  Check it out!



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] standard font faces

Harri Pasanen
Robin Dunn wrote:

>
> Here is a snippet of the C++ code that decides this for X:
>
>     switch (family)
>     {
>         case wxDECORATIVE: xfamily = _T("lucida"); break;
>         case wxROMAN:      xfamily = _T("times");  break;
>         case wxMODERN:     xfamily = _T("courier"); break;
>         case wxSWISS:      xfamily = _T("helvetica"); break;
>         case wxTELETYPE:   xfamily = _T("lucidatypewriter"); break;
>         case wxSCRIPT:     xfamily = _T("utopia"); break;
>         default:           xfamily = _T("*");
>     }
>

Haven't looked at wxWindows source code for ages, but would the _T by
any change be a gettext() macro?  If so then it would already be
customizable from outside C++.

Just guessing,

Harri

_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] standard font faces

Robin Dunn
>
> Haven't looked at wxWindows source code for ages, but would the _T by
> any change be a gettext() macro?  

Nope.  It's for Unicode.

--
Robin Dunn
Software Craftsman
[hidden email]
http://AllDunn.com/robin/
http://AllDunn.com/wxPython/  Check it out!



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users