lib/osx/sugarcube-attributedstring/nsattributedstring.rb in sugarcube-3.3.6 vs lib/osx/sugarcube-attributedstring/nsattributedstring.rb in sugarcube-3.3.7

- old
+ new

@@ -2,10 +2,14 @@ def bold(size=nil) nsattributedstring.bold(size) end + def italic(size=nil) + nsattributedstring.italic(size) + end + def monospace(size=nil) nsattributedstring.monospace(size) end def underline(underline_style=nil) @@ -30,18 +34,24 @@ size ||= NSFont.systemFontSize font = NSFont.boldSystemFontOfSize(size) self.font(font) end + def italic(size=nil) + size ||= NSFont.systemFontSize + font = NSFont.fontWithName('HelveticaNeue-Italic', size: size) + self.font(font) + end + def font(value) value = value.nsfont if value.respond_to?(:nsfont) with_attributes({ NSFontAttributeName => value }) end def monospace(size=nil) size ||= NSFont.systemFontSize font = NSFont.fontWithName('Courier New', size: size) - self.font({ NSFontAttributeName => font }) + self.font(font) end def underline underline_style(NSSingleUnderlineStyle) end