summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2006-04-20 02:10:02 +0000
committersabetts <sabetts>2006-04-20 02:10:02 +0000
commitb7bb91712d275065bb4b2440fd0867d9299da94c (patch)
tree20fffc9fd31e077b23a44fedd3480c70c84b332a /src/main.c
parent91a86a505d76d9a4a0b89ddaaefa631a660c4835 (diff)
downloadratpoison-b7bb91712d275065bb4b2440fd0867d9299da94c.zip
* src/split.c (show_frame_message): use XmbDrawString and XmbTextEscapement
* src/screen.c (init_screen): don't include the font in the gc * src/ratpoison.h: include Xlocale.h * src/manage.c (get_wmname): support i18n characters * src/main.c (init_defaults): call load_query_font_set and set_extents_of_fontset (main): call setlocale (clean_up): call XFreeFontSet (set_extents_of_fontset): new function (load_query_font_set): likewise * src/input.c (update_input_window): use XmbTextEscapement and XmbDrawString * src/globals.h (FONT_HEIGHT): use rp_font_ascent and rp_font_descent (MAX_FONT_WIDTH): use rp_font_width new globals rp_font_ascent, rp_font_descent, rp_font_width * src/globals.c: new globals rp_font_ascent, rp_font_descent, rp_font_width * src/data.h (struct rp_defaults): font is a XFontSet * src/bar.c (max_line_length): call XmbTextEscapement (draw_string): call XmbDrawString (get_mark_box): call XmbTextEscapement * src/actions.c (read_frame): call XmbTextEscapement (cmd_license): likewise (read_frame): call XmbDrawString (cmd_license): likewise (cmd_help): likewise (update_gc): don't include the font (set_font): call load_query_font_set
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index c3732e3..d04693b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -485,13 +485,14 @@ init_defaults ()
defaults.padding_top = 0;
defaults.padding_bottom = 0;
- defaults.font = XLoadQueryFont (dpy, DEFAULT_FONT);
+ defaults.font = load_query_font_set (dpy, DEFAULT_FONT);
if (defaults.font == NULL)
{
fprintf (stderr, "ratpoison: Cannot load font %s.\n", DEFAULT_FONT);
exit (EXIT_FAILURE);
}
defaults.font_string = xstrdup (DEFAULT_FONT);
+ set_extents_of_fontset (defaults.font);
defaults.fgcolor_string = xstrdup ("black");
defaults.bgcolor_string = xstrdup ("white");
@@ -525,6 +526,7 @@ main (int argc, char *argv[])
char *alt_rcfile = NULL;
myargv = argv;
+ setlocale(LC_CTYPE, "");
/* Parse the arguments */
while (1)
@@ -753,9 +755,36 @@ clean_up ()
free_xinerama();
- XFreeFont (dpy, defaults.font);
+ XFreeFontSet (dpy, defaults.font);
free (defaults.window_fmt);
XSetInputFocus (dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
XCloseDisplay (dpy);
}
+
+void
+set_extents_of_fontset (XFontSet font)
+{
+ XFontSetExtents *extent;
+ extent = XExtentsOfFontSet(font);
+ rp_font_ascent = extent->max_logical_extent.height * 9 / 10;
+ rp_font_descent = extent->max_logical_extent.height / 5;
+ rp_font_width = extent->max_logical_extent.width;
+}
+
+XFontSet load_query_font_set (Display *disp, const char *fontset_name)
+{
+ XFontSet fontset;
+ int missing_charset_count;
+ char **missing_charset_list;
+ char *def_string;
+
+ fontset = XCreateFontSet(disp, fontset_name,
+ &missing_charset_list, &missing_charset_count,
+ &def_string);
+ if (missing_charset_count) {
+ PRINT_DEBUG (("Missing charsets in FontSet(%s) creation.\n", fontset_name));
+ XFreeStringList(missing_charset_list);
+ }
+ return fontset;
+}