On Sat, 31 Dec 2005 02:00:40 +0100 Kim Woelders <[EMAIL PROTECTED]> babbled:
> Jason Tackaberry wrote: > > On Fri, 2005-12-30 at 17:31 +0100, Kim Woelders wrote: > > > >>I think you are right that something is wrong somewhere around here. > >>However, this patch breaks stuff for certain fonts (w becomes too small, > >>IIRC). > > > > > > Ok. I have to plead a bit of ignorance when it comes to font metrics. > > But if your problem is with the width, and my original problem is with > > the height, then the naive assumption is that if we take the horizontal > > advance and the height as returned by imlib_font_query_size(), we should > > be ok. > > > > I've coded this up and it looks ok on all of my tests. Some review and > > testing is clearly needed. The patch is attached. > > > > Regards, > > Jason. > > > > > > ------------------------------------------------------------------------ > > > > --- imlib2-1.2.1.009.orig/src/lib/font_draw.c 2005-12-30 > > 10:49:31.000000000 -0500 +++ imlib2-1.2.1.009/src/lib/font_draw.c > > 2005-12-30 11:42:11.000000000 -0500 @@ -78,7 +78,8 @@ > > DATA32 *data, col; > > int nx, ny; > > > > - imlib_font_query_advance(fn, text, &w, &h); > > + imlib_font_query_advance(fn, text, &w, NULL); > > + imlib_font_query_size(fn, text, NULL, &h); > > > > data = malloc(w * h * sizeof(DATA32)); > > if (!data) > > I have committed attached patch. It does the same thing as your patch #2 > but avoids recalculating the width. > It is possibly also equivalent to rasters original fix if "inset" were > subtracted in stead of added. > > I think there are some more or less related bugs in the imlib2 font > metrics department. > > imlib_get_font_descent (imlib_font_descent_get) returns a positive > value, whereas imlib_get_maximum_font_descent > (imlib_font_max_descent_get) returns a negative value. > I doubt this is intentional. > > imlib_get_text_size (imlib_font_query_size) - > What is it supposed to do? > If it should return the ink size of the given text string I think the > height is wrong (currently font max ascent +(-?) font max descent). > If it should return some overall bounding box size I think the width is > wrong (currently ~= ink width?). > > imlib_text_draw_with_return_metrics probably doesn't return the intended > values in width_return and height_return. > > Unfortunately, changing any of this may cause breakage in existing apps. mmm. bugger. this must have screwed up at some point. it was always meant to return only positives for ascent AND descent (unless the font is totally weird) is as pixels above ro below the baseline of the font. -- ------------- Codito, ergo sum - "I code, therefore I am" -------------- The Rasterman (Carsten Haitzler) [EMAIL PROTECTED] 裸好多 Tokyo, Japan (東京 日本) ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel