# HG changeset patch # User David Reitter # Date 1245018555 0 # Node ID 3321231f9dc2f1bfa9fdaf32acf19fde852a98c9 # Parent 083552a70ed8d7a0ff535772e20a6e4c2d282c92 nsmenu.m (EmacsTooltip: setText): set height of tooltip. diff -r 083552a70ed8 -r 3321231f9dc2 src/ChangeLog --- a/src/ChangeLog Sun Jun 14 18:58:38 2009 +0000 +++ b/src/ChangeLog Sun Jun 14 22:29:15 2009 +0000 @@ -1,3 +1,7 @@ +2009-06-14 Sidney Markowitz + + * nsmenu.m (EmacsTooltip: setText): set height of tooltip. + 2009-06-14 Adrian Robert * nsfont.m (ns_attribute_value): Remove. diff -r 083552a70ed8 -r 3321231f9dc2 src/nsmenu.m --- 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]; }