This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if var font = textView?.typingAttributes[NSFontAttributeName] as? NSFont { | |
font = NSFontManager.sharedFontManager().convertFont(font, toHaveTrait: .BoldFontMask) | |
// or ... | |
font = NSFontManager.sharedFontManager().convertFont(font, toNotHaveTrait: .BoldFontMask) | |
applyNewAttributes([NSFontAttributeName: font]) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IBAction func fontFaceChanged(sender: NSPopUpButton) { | |
let newIDX = sender.indexOfSelectedItem | |
if let currentFont = textView?.typingAttributes[NSFontAttributeName] as? NSFont { | |
let newFaceName = fontFaceNames[newIDX] | |
if let newFont = NSFontManager.sharedFontManager().convertFont(currentFont, toFace: newFaceName) { | |
applyNewAttributes([NSFontAttributeName: newFont]) | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dynamic let fontFamilyNames = NSFontManager.sharedFontManager().availableFontFamilies | |
fontFamilyName!.bind("content", toObject: self, withKeyPath: "fontFamilyNames", options: nil) | |
@IBAction func fontFamilyChanged(sender: NSPopUpButton) { | |
let newIDX = sender.indexOfSelectedItem | |
if var font = textView?.typingAttributes[NSFontAttributeName] as? NSFont { | |
font = NSFontManager.sharedFontManager().convertFont(font, toFamily: fontFamilyNames[newIDX]) | |
applyNewAttributes([NSFontAttributeName: font]) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func textViewDidChangeTypingAttributes(notification: NSNotification) { | |
if let font = textView?.typingAttributes[NSFontAttributeName] as? NSFont { | |
if let faces = NSFontManager.sharedFontManager().availableMembersOfFontFamily(font.familyName) { | |
// faces is an array of arrays like this: | |
// [[Helvetica, Regular, 5, 0], [Helvetica-Light, Light, 3, 0], [Helvetica-Oblique, Oblique, 5, 1], [Helvetica-LightOblique, Light Oblique, 3, 1], [Helvetica-Bold, Bold, 9, 2], [Helvetica-BoldOblique, Bold Oblique, 9, 3]] | |
fontFacesLabels = faces.map({face in (face[1] as! String)}) | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Document: NSDocument { | |
@IBAction func fontSizeChanged(sender: NSControl) { | |
var newSize = CGFloat(sender.floatValue) | |
if var font = textView?.typingAttributes[NSFontAttributeName] as? NSFont { | |
font = NSFontManager.sharedFontManager().convertFont(font, toSize: newSize) | |
applyNewAttributes([NSFontAttributeName: font]) | |
} | |
} | |
func applyNewAttributes(attributes: [String: AnyObject]) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Document: NSDocument { | |
@IBOutlet var fontSizeField: NSTextField? | |
dynamic var currentFontSize: CGFloat = 0 | |
override func windowControllerDidLoadNib(aController: NSWindowController) { | |
super.windowControllerDidLoadNib(aController) | |
fontSizeField.bind("value", | |
toObject: self, | |
withKeyPath: "currentFontSize", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'RMagick' | |
class PhotoProcessor | |
def self.process(entry_id) | |
entry = Entry.find entry_id | |
raise "The photo for this entry has already been processed" if entry.image_processed? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UITableViewCell *)tableView:(UITableView *)tableView | |
cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
static NSString *identifier = @"MoveViewCell"; | |
CBMoveView *cell = [tableView dequeueReusableCellWithIdentifier:identifier]; | |
if (!cell) | |
cell = [[CBMoveView alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier]; | |
cell.move = (CBMove *)[self.moves objectAtIndex:indexPath.row]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# FontForge command | |
fontforge -script 2ttf.pe ProprietaryFontCondensedBold.otf | |
# 2ttf.pe | |
# FontForge Script | |
# http://fontforge.org/scripting.html | |
# | |
# * Opens the font file | |
# * Sets the family/fullname/postscript name be the same as the filename (without ext) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
methods = | |
init: (options) -> | |
$(this).each -> | |
$self = $(@) | |
data = $self.data 'hotttness' | |
settings = |
NewerOlder