Re: small gtk+ and gtk-eng. fixes (ru locale)




"Sergey I. Panov" <sipan@mit.edu> writes:

> I had to make a few changes in gtk+ and gtk-engines in order to get gtk+ and
> standart themes to use proper fonts with ru (Russian) locale.   
> Now gtk uses the same fonts as before in the standart setup, but it picks proper
> fonts when one is using  ru locale. I did not check but, I beleive, my changes also
> make it easy to switch between locales that use iso8859-1,2,8,9
> 
> In gtk-engines/metal/Theme/gtk/gtkrc I replaced 
> 
>       font = "-b&h-lucida-bold-r-normal-sans-12-*-*-*-p-*-iso8859-1"
> 
> line by 
> 
>       fontset = "-b&h-lucida-bold-r-normal-sans-12-*-*-*-p-*-iso8859-1,\
>                  -cronyx-helvetica-bold-r-normal-*-12-*-*-*-p-*-koi8-r"
> 
> and in other themes (gtk-engines/*/Theme/gtk/gtkrc) I replaced line
> 
> 
> by
> 
>       fontset = "-adobe-helvetica-medium-r-normal--10-*-*-*-*-*-iso8859-*,\
>                  -cronyx-helvetica-medium-r-normal--11-*-*-*-*-*-koi8-r"
> 
> (Those Cyrillic fonts are closest match to the corresponding iso8859-* fonts.)
> 
> 
> It was not that simple with the Default theme --- I tried to put the following lines in
> its gtkrc file(GTK_INSTALL_ROOT/share/themes/Default/gtk/gtkrc) or in ~/.gtkrc
> 
> style "default"
> {
>   fontset = "-*-helvetica-medium-r-normal--12-*-*-*-*-*-*-*"
> }
> 
> but it did not change anything.  (rem. IS IT A BUG?)  
> 
> But I fixed Default them by editing gtk+/gtk/gtkstyle.c . I changed line 400 from  
> 
>        gdk_fontset_load ("-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*");
> 
> to
> 
>       gdk_fontset_load ("-*-helvetica-medium-r-normal--12-*-*-*-*-*-*-*");
> 
> 
> Everything works nicely now! 
> 
> 
> 
> **********************************************
> *                                            *
> *   May I COMMIT those changes to CVS ????   *
> *                                            *
> **********************************************

Please don't. Switching to fontsets from fonts triggers
storing the contents of Text widgets as wide characters,
and, also, it is impossible to override a fontset with
a fontset.

Simply create a file in your home directory call ~/.gtkrc.ru

that looks like:

====
style "russian-fonts" {
# This may all have to be one big line. Not sure if we support multiline
# strings
       fontset = "-adobe-helvetica-medium-r-normal--10-*-*-*-*-*-iso8859-*,\
                  -cronyx-helvetica-medium-r-normal--11-*-*-*-*-*-koi8-r"
}

class "GtkWidget" style "russian-fonts"
====

And things will work pretty nicely. (You'll lose the 
Lucida in the metal theme unless you modify this
file when switching to that theme)

We actually should ship a set of gtkrc.(LOCALE) files
in the default GTK+ distribution. It is mostly a 
matter of coming up with the files and doing a little bit of 
automake work to get them installed in $(prefix)/etc/gtk/.
If you want to do this, go ahead, but please submit your
changes as a patch.

                                        Owen



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]