Code:
NSString *sNumber = [[NSString alloc] initWithFormat:@"%d", num]; // convert number into string
NSMutableDictionary *attrib = [[NSMutableDictionary alloc] init]; // create a dictionary
[attrib setObject:[NSColor colorWithDeviceRed:0 green:0.5 blue:0 alpha:1] forKey:NSForegroundColorAttributeName]; // change the color to dark green (works)
[attrib setObject:@40 forKey:NSFontSizeAttribute]; // tries to change the size of the font to 40 (doesn't work)
NSMutableAttributedString *masNumber = [[NSMutableAttributedString alloc] initWithString:sNumber attributes:attrib]; // create an attributed string with given string and attributes.
NSSize omvang = [masNumber size]; // calculate the size
NSLog(@"getal: %d, breedte: %f, hoogte: %f", num, omvang.width, omvang.height); // log the width, the height and the value (converted into string
NSPoint startTekstPunt = NSMakePoint(tekstPunt.x - omvang.width / 2, tekstPunt.y - omvang.height / 2); // calculate were to draw
[masNumber drawAtPoint:startTekstPunt]; // draw the string
The color of the string is dark green (no red and blue intensity but 50 % green intensity) but the size is ignored.
What did I do wrong?