comparison gtk/dw.c @ 383:f040c24bcf26

Slight change to determining font height under GTK 1.2. The solution may not work correctly for all fonts (only tested with fixed font).
author mhessling@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 01 May 2003 09:04:56 +0000
parents 2e5f3cb38d19
children 5326544ab2ec
comparison
equal deleted inserted replaced
382:838781d4f1dc 383:f040c24bcf26
5429 * a string without a character with a descent or without an ascent will have 5429 * a string without a character with a descent or without an ascent will have
5430 * incorrect ascent/descent values 5430 * incorrect ascent/descent values
5431 */ 5431 */
5432 gdk_text_extents(font, text, strlen(text), NULL, NULL, &width, &junk_ascent, &junk_descent); 5432 gdk_text_extents(font, text, strlen(text), NULL, NULL, &width, &junk_ascent, &junk_descent);
5433 /* force ascent/descent to be maximum values */ 5433 /* force ascent/descent to be maximum values */
5434 gdk_text_extents(font, "Xg", 2, NULL, NULL, &junk_width, &ascent, &descent); 5434 gdk_text_extents(font, "(g", 2, NULL, NULL, &junk_width, &ascent, &descent);
5435 if(!_transparent[index]) 5435 if(!_transparent[index])
5436 { 5436 {
5437 GdkGC *gc2 = NULL; 5437 GdkGC *gc2 = NULL;
5438 5438
5439 gc2 = gdk_gc_new(handle ? handle->window : pixmap->pixmap); 5439 gc2 = gdk_gc_new(handle ? handle->window : pixmap->pixmap);
5440 if(gc2) 5440 if(gc2)
5441 { 5441 {
5442 gdk_gc_set_foreground(gc2, &_background[index]); 5442 gdk_gc_set_foreground(gc2, &_background[index]);
5443 gdk_gc_set_background(gc2, &_background[index]); 5443 gdk_gc_set_background(gc2, &_background[index]);
5444 } 5444 }
5445 gdk_draw_rectangle(handle ? handle->window : pixmap->pixmap, gc2, TRUE, x, y, width, ascent + descent + 2); 5445 gdk_draw_rectangle(handle ? handle->window : pixmap->pixmap, gc2, TRUE, x, y, width, ascent + descent + 1);
5446 gdk_gc_unref(gc2); 5446 gdk_gc_unref(gc2);
5447 } 5447 }
5448 gdk_draw_text(handle ? handle->window : pixmap->pixmap, font, gc, x, y + ascent + 2, text, strlen(text)); 5448 gdk_draw_text(handle ? handle->window : pixmap->pixmap, font, gc, x, y + ascent + 1, text, strlen(text));
5449 gdk_font_unref(font); 5449 gdk_font_unref(font);
5450 } 5450 }
5451 #endif 5451 #endif
5452 gdk_gc_unref(gc); 5452 gdk_gc_unref(gc);
5453 } 5453 }