diff src/nsmenu.m @ 103424:3321231f9dc2

nsmenu.m (EmacsTooltip: setText): set height of tooltip.
author David Reitter <david.reitter@gmail.com>
date Sun, 14 Jun 2009 22:29:15 +0000
parents b5a34573cf82
children f6163beaa505
line wrap: on
line diff
--- a/src/nsmenu.m	Sun Jun 14 18:58:38 2009 +0000
+++ b/src/nsmenu.m	Sun Jun 14 22:29:15 2009 +0000
@@ -1439,7 +1439,14 @@
 {
   NSString *str = [NSString stringWithUTF8String: text];
   NSRect r = [textField frame];
-  r.size.width = [[[textField font] screenFont] widthOfString: str] + 8;
+  NSSize textSize = [str sizeWithAttributes: 
+     [NSDictionary dictionaryWithObject: [[textField font] screenFont]
+				 forKey: NSFontAttributeName]];
+  NSSize padSize = [[[textField font] screenFont] 
+		     boundingRectForFont].size;
+ 
+  r.size.width = textSize.width + padSize.width/2;
+  r.size.height = textSize.height + padSize.height/2;
   [textField setFrame: r];
   [textField setStringValue: str];
 }