Hello everyone.

I want to know the length of the string @"GNUstep" on the screen with sizeWithAttributes and the following code doesn't work :

NSFont *menuFont=[NSFont menuFontOfSize:0];
NSMutableDictionary *attributes ;
attributes = [NSMutableDictionary new];
[attributes setObject :menuFont
                       forKey:NSFontAttributeName];
NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString: @"GNUstep" ];
[string setAttributes:attributes range:NSMakeRange(0,[string length])];
NSSize stringSize;
stringSize=[[NSString string] sizeWithAttributes:attributes];
 /*Debug*/
 printf("stringSize.width : %f \n", stringSize.width);
 /*Debug end*/


stringSize.width returns 1 for now. Why ?

Could somone please help me ?

Cheers, Bertrand Dekoninck


_______________________________________________
Discuss-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to