diff --git a/KILabel/Source/KILabel.m b/KILabel/Source/KILabel.m index 37dbbff..6dd4b9e 100644 --- a/KILabel/Source/KILabel.m +++ b/KILabel/Source/KILabel.m @@ -353,12 +353,20 @@ - (NSDictionary *)attributesFromProperties paragraph.alignment = self.textAlignment; // Create the dictionary - NSDictionary *attributes = @{NSFontAttributeName : self.font, - NSForegroundColorAttributeName : color, - NSShadowAttributeName : shadow, - NSParagraphStyleAttributeName : paragraph, - }; - return attributes; + NSMutableDictionary *attributes = [NSMutableDictionary dictionary]; + if (self.font != nil) { + [attributes setObject:self.font forKey:NSFontAttributeName]; + } + if (color != nil) { + [attributes setObject:color forKey:NSForegroundColorAttributeName]; + } + if (shadow != nil) { + [attributes setObject:shadow forKey:NSShadowAttributeName]; + } + if (paragraph != nil) { + [attributes setObject:paragraph forKey:NSParagraphStyleAttributeName]; + } + return [attributes copy]; } /**