changeset 25434:8c4c1abcac50

Calculate and draw osd accurately.
author ulion
date Wed, 19 Dec 2007 09:34:28 +0000
parents 55e3b1a32c65
children 5779358c3f86
files libmenu/menu.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmenu/menu.c	Wed Dec 19 08:42:18 2007 +0000
+++ b/libmenu/menu.c	Wed Dec 19 09:34:28 2007 +0000
@@ -628,7 +628,7 @@
       font = vo_font->font[c];
       if(font >= 0) {
  	int cs = (vo_font->pic_a[font]->h - vo_font->height) / 2;
-	if ((sx + vo_font->width[c] < xmax)  &&  (sy + vo_font->height < ymax) )
+	if ((sx + vo_font->width[c] <= xmax) && (sy + vo_font->height <= ymax) )
 	  draw_alpha(vo_font->width[c], vo_font->height,
 		     vo_font->pic_b[font]->bmp+vo_font->start[c] +
 		     cs * vo_font->pic_a[font]->w,
@@ -666,13 +666,18 @@
   while (*txt) {
     int c=utf8_get_char((const char**)&txt);
     if(c == '\n' || (warp && i + vo_font->width[c] >= max_width)) {
+      i -= vo_font->charspace;
+      if (i > w) w = i;
       if(*txt)
 	l++;
       i = 0;
       if(c == '\n') continue;
     }
     i += vo_font->width[c]+vo_font->charspace;
-    if(i > w) w = i;
+  }
+  if (i > 0) {
+    i -= vo_font->charspace;
+    if (i > w) w = i;
   }
   
   *_w = w;