Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions KILabel/Source/KILabel.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

/**
Expand Down