]> git.pld-linux.org Git - packages/pidgin.git/blob - gaim-font-by-locale.patch
- fix iconv in gg plugin
[packages/pidgin.git] / gaim-font-by-locale.patch
1 diff -urN gaim-0.45.org/src/gtkimhtml.c gaim-0.45/src/gtkimhtml.c
2 --- gaim-0.45.org/src/gtkimhtml.c       Sun Oct 14 19:46:14 2001
3 +++ gaim-0.45/src/gtkimhtml.c   Tue Oct 16 21:34:56 2001
4 @@ -19,6 +19,9 @@
5   *
6   */
7  
8 +#ifdef HAVE_CONFIG_H
9 +#include <config.h>
10 +#endif
11  #include "gtkimhtml.h"
12  #include <X11/Xlib.h>
13  #include <gdk/gdkx.h>
14 @@ -27,6 +30,10 @@
15  #include <ctype.h>
16  #include <stdio.h>
17  #include <math.h>
18 +#ifdef HAVE_LANGINFO_CODESET
19 +#include <langinfo.h>
20 +#include <locale.h>
21 +#endif
22  
23  #include "pixmaps/angel.xpm"
24  #include "pixmaps/bigsmile.xpm"
25 @@ -79,6 +86,21 @@
26         gchar **image;
27  };
28  
29 +static gchar* getcharset()
30 +{
31 +  static gchar charset[64];
32 +#ifdef HAVE_LANGINFO_CODESET
33 +  gchar *ch = nl_langinfo(CODESET);
34 +  if (strncasecmp(ch, "iso-", 4) == 0)
35 +    g_snprintf(charset, sizeof(charset), "iso%s", ch + 4);
36 +  else
37 +    g_snprintf(charset, sizeof(charset), ch);
38 +#else
39 +  g_snprintf(charset, sizeof(charset), "iso8859-*");
40 +#endif
41 +  return charset;
42 +}
43 +
44  static GtkSmileyTree*
45  gtk_smiley_tree_new ()
46  {
47 @@ -1781,53 +1803,60 @@
48                 return gdk_fontset_load ("-*-*-*-*-*-*-*-*-*-*-*-*-*-*,*");
49         }
50  
51 -       g_snprintf (buf, sizeof (buf), "-*-%s-%s-%c-*-*-*-%d-*-*-*-*-iso8859-*",
52 +       g_snprintf (buf, sizeof (buf), "-*-%s-%s-%c-*-*-*-%d-*-*-*-*-%s",
53                     choice,
54                     bold ? "bold" : "medium",
55                     italics ? 'i' : 'r',
56 -                   size);
57 +                   size,
58 +                   getcharset());
59         font = gdk_font_load (buf);
60  
61         if (!font && italics) {
62 -               g_snprintf (buf, sizeof (buf), "-*-%s-%s-o-*-*-*-%d-*-*-*-*-iso8859-*",
63 +               g_snprintf (buf, sizeof (buf), "-*-%s-%s-o-*-*-*-%d-*-*-*-*-%s",
64                             choice,
65                             bold ? "bold" : "medium",
66 -                           size);
67 +                           size,
68 +                           getcharset());
69                 font = gdk_font_load (buf);
70         }
71  
72         if (!font) {
73 -               g_snprintf (buf, sizeof (buf), "-*-%s-%s-%c-*-*-*-*-*-*-*-*-iso8859-*",
74 +               g_snprintf (buf, sizeof (buf), "-*-%s-%s-%c-*-*-*-*-*-*-*-*-%s",
75                             choice,
76                             bold ? "bold" : "medium",
77 -                           italics ? 'i' : 'r');
78 +                           italics ? 'i' : 'r',
79 +                           getcharset());
80                 font = gdk_font_load (buf);
81         }
82  
83         if (!font && italics) {
84 -               g_snprintf (buf, sizeof (buf), "-*-%s-%s-o-*-*-*-*-*-*-*-*-iso8859-*",
85 +               g_snprintf (buf, sizeof (buf), "-*-%s-%s-o-*-*-*-*-*-*-*-*-%s",
86                             choice,
87 -                           bold ? "bold" : "medium");
88 +                           bold ? "bold" : "medium",
89 +                           getcharset());
90                 font = gdk_font_load (buf);
91         }
92  
93         if (!font) {
94 -               g_snprintf (buf, sizeof (buf), "-*-%s-*-%c-*-*-*-*-*-*-*-*-iso8859-*",
95 +               g_snprintf (buf, sizeof (buf), "-*-%s-*-%c-*-*-*-*-*-*-*-*-%s",
96                             choice,
97 -                           italics ? 'i' : 'r');
98 +                           italics ? 'i' : 'r',
99 +                           getcharset());
100                 font = gdk_font_load (buf);
101         }
102  
103         if (!font) {
104 -               g_snprintf (buf, sizeof (buf), "-*-%s-*-%c-*-*-*-*-*-*-*-*-iso8859-*",
105 +               g_snprintf (buf, sizeof (buf), "-*-%s-*-%c-*-*-*-*-*-*-*-*-%s",
106                             choice,
107 -                           italics ? 'o' : '*');
108 +                           italics ? 'o' : '*',
109 +                           getcharset());
110                 font = gdk_font_load (buf);
111         }
112  
113         if (!font && italics) {
114 -               g_snprintf (buf, sizeof (buf), "-*-%s-*-*-*-*-*-*-*-*-*-*-iso8859-*",
115 -                           choice);
116 +               g_snprintf (buf, sizeof (buf), "-*-%s-*-*-*-*-*-*-*-*-*-*-%s",
117 +                           choice,
118 +                           getcharset());
119                 font = gdk_font_load (buf);
120         }
121  
122 @@ -2032,6 +2061,11 @@
123         g_return_if_fail (imhtml != NULL);
124         g_return_if_fail (GTK_IS_IMHTML (imhtml));
125  
126 +#ifdef HAVE_LANGINFO_CODESET
127 +       if (!font)
128 +         font = gtk_imhtml_font_load (imhtml, "Helvetica", FALSE, FALSE, 0);
129 +#endif
130 +
131         if (font) {
132                 if (imhtml->default_font)
133                         gdk_font_unref (imhtml->default_font);
This page took 0.063987 seconds and 3 git commands to generate.