From: fliep Date: Sat, 2 May 2009 19:34:20 +0000 (+0000) Subject: Fixed issue #4. X-Git-Tag: v0.9~425 X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=94d7ec6174c7240bd4c5994d9ee241b0dac922e5;p=projects%2Fchimara%2Fchimara.git Fixed issue #4. --- diff --git a/src/main.c b/src/main.c index e08e3fb..3e04929 100644 --- a/src/main.c +++ b/src/main.c @@ -72,8 +72,8 @@ create_window(void) gtk_builder_connect_signals(builder, NULL); glk = chimara_glk_new(); - chimara_glk_set_default_font_string(CHIMARA_GLK(glk), "Utopia 12"); - chimara_glk_set_monospace_font_string(CHIMARA_GLK(glk), "Courier 10"); + chimara_glk_set_default_font_string(CHIMARA_GLK(glk), "Sans 11"); + chimara_glk_set_monospace_font_string(CHIMARA_GLK(glk), "Monospace 10"); g_signal_connect(glk, "started", G_CALLBACK(on_started), NULL); g_signal_connect(glk, "stopped", G_CALLBACK(on_stopped), NULL); @@ -117,7 +117,7 @@ main(int argc, char *argv[]) g_object_unref( G_OBJECT(builder) ); - if( !chimara_glk_run(CHIMARA_GLK(glk), ".libs/first.so", &error) ) { + if( !chimara_glk_run(CHIMARA_GLK(glk), ".libs/gridtest.so", &error) ) { error_dialog(GTK_WINDOW(window), error, "Error starting Glk library: "); return 1; } diff --git a/src/window.c b/src/window.c index 0cc7efa..d27e04d 100644 --- a/src/window.c +++ b/src/window.c @@ -140,15 +140,6 @@ glk_window_get_root() return (winid_t)glk_data->root_window->data; } -/* Determine the size of a "0" character in pixels */ -static void -text_window_get_char_size(GtkWidget *textview, int *width, int *height) -{ - PangoLayout *zero = gtk_widget_create_pango_layout(textview, "0"); - pango_layout_get_pixel_size(zero, width, height); - g_object_unref(zero); -} - /** * glk_window_open: * @split: The window to split to create the new window. Must be 0 if there @@ -389,7 +380,12 @@ glk_window_open(winid_t split, glui32 method, glui32 size, glui32 wintype, win->widget = textview; win->frame = scrolledwindow; - text_window_get_char_size( textview, &(win->unit_width), &(win->unit_height) ); + + /* Determine the size of a "0" character in pixels */ + PangoLayout *zero = gtk_widget_create_pango_layout(textview, "0"); + pango_layout_set_font_description(zero, glk_data->monospace_font_desc); + pango_layout_get_pixel_size(zero, &(win->unit_width), &(win->unit_height)); + g_object_unref(zero); /* Set the other parameters (width and height are set later) */ win->window_stream = window_stream_new(win); @@ -421,7 +417,12 @@ glk_window_open(winid_t split, glui32 method, glui32 size, glui32 wintype, win->widget = textview; win->frame = scrolledwindow; - text_window_get_char_size( textview, &(win->unit_width), &(win->unit_height) ); + + /* Determine the size of a "0" character in pixels */ + PangoLayout *zero = gtk_widget_create_pango_layout(textview, "0"); + pango_layout_set_font_description(zero, glk_data->default_font_desc); + pango_layout_get_pixel_size(zero, &(win->unit_width), &(win->unit_height)); + g_object_unref(zero); /* Set the other parameters */ win->window_stream = window_stream_new(win);