Mercurial > dwindows
comparison gtk/dw.c @ 379:2e5f3cb38d19
Fix calculations of font heights under GTK 1.2. Unsure full ascent and descent
are determined even if the string to be rendered doesn't have an ascent/descent.
author | mhessling@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 29 Apr 2003 10:52:47 +0000 |
parents | 84f79737b7d9 |
children | f040c24bcf26 |
comparison
equal
deleted
inserted
replaced
378:12b3980a41a2 | 379:2e5f3cb38d19 |
---|---|
5420 font = gdk_font_load(fontname); | 5420 font = gdk_font_load(fontname); |
5421 if(!font) | 5421 if(!font) |
5422 font = gdk_font_load("fixed"); | 5422 font = gdk_font_load("fixed"); |
5423 if(font) | 5423 if(font) |
5424 { | 5424 { |
5425 gint ascent, descent, width; | 5425 gint ascent, descent, width, junk_ascent, junk_descent, junk_width; |
5426 int index = _find_thread_index(dw_thread_id()); | 5426 int index = _find_thread_index(dw_thread_id()); |
5427 | 5427 |
5428 gdk_text_extents(font, text, strlen(text), NULL, NULL, &width, &ascent, &descent); | 5428 /* gdk_text_extents() calculates ascent and descent based on the string, so |
5429 * a string without a character with a descent or without an ascent will have | |
5430 * incorrect ascent/descent values | |
5431 */ | |
5432 gdk_text_extents(font, text, strlen(text), NULL, NULL, &width, &junk_ascent, &junk_descent); | |
5433 /* force ascent/descent to be maximum values */ | |
5434 gdk_text_extents(font, "Xg", 2, NULL, NULL, &junk_width, &ascent, &descent); | |
5429 if(!_transparent[index]) | 5435 if(!_transparent[index]) |
5430 { | 5436 { |
5431 GdkGC *gc2 = NULL; | 5437 GdkGC *gc2 = NULL; |
5432 | 5438 |
5433 gc2 = gdk_gc_new(handle ? handle->window : pixmap->pixmap); | 5439 gc2 = gdk_gc_new(handle ? handle->window : pixmap->pixmap); |