Fix imlib2/ttf text vertical positioning with certain fonts.

SVN revision: 38359
This commit is contained in:
Kim Woelders 2008-12-30 16:32:30 +00:00
parent 4f71661dfe
commit d97d1a1d27
2 changed files with 5 additions and 4 deletions

View File

@ -46,9 +46,9 @@ EFont_draw_string(Display * dpy, Drawable win, GC gc, int x, int y,
Colormap cm) Colormap cm)
{ {
Imlib_Image im; Imlib_Image im;
int w, h, ascent, descent; int w, h, ascent, descent, max_asc;
Efont_extents(f, text, &ascent, &descent, &w, NULL, NULL, NULL, NULL); Efont_extents(f, text, &ascent, &descent, &w, &max_asc, NULL, NULL, NULL);
h = ascent + descent; h = ascent + descent;
imlib_context_set_drawable(win); imlib_context_set_drawable(win);
@ -57,8 +57,9 @@ EFont_draw_string(Display * dpy, Drawable win, GC gc, int x, int y,
imlib_context_set_font(f->face); imlib_context_set_font(f->face);
ImlibSetFgColorFromGC(dpy, gc, cm); ImlibSetFgColorFromGC(dpy, gc, cm);
imlib_text_draw(0, 0, text); imlib_text_draw(0, ascent - max_asc, text);
imlib_render_image_on_drawable(x, y - ascent); imlib_render_image_on_drawable(x, y - ascent);
imlib_free_image(); imlib_free_image();
} }

View File

@ -99,7 +99,7 @@ EFont_draw_string(EImage * im, EFont * f, int x, int y,
imlib_context_set_image(im); imlib_context_set_image(im);
imlib_context_set_color(r, g, b, 255); imlib_context_set_color(r, g, b, 255);
imlib_context_set_font(f); imlib_context_set_font(f);
imlib_text_draw(x, y - imlib_get_font_ascent(), text); imlib_text_draw(x, y - imlib_get_maximum_font_ascent(), text);
} }
typedef struct { typedef struct {