value | name |
---|---|
100 | extralight/ultralight |
200 | light/thin |
300 | book/demi/light |
400 | regular/normal |
500 | medium |
600 | semibold/demibold |
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
//Core Graphics method | |
CGDataProviderRef provider = CGDataProviderCreateWithURL((__bridge CFURLRef)fontURL); | |
CGFontRef graphicsFont = CGFontCreateWithDataProvider(provider); | |
CTFontRef coreTextFont = CTFontCreateWithGraphicsFont(graphicsFont, fontSize, /*matrix*/ NULL, /*attributes*/ NULL); | |
if (coreTextFont) { | |
NSFont *font = (__bridge NSFont *)coreTextFont; | |
[fonts addObject:font]; | |
CFRelease(coreTextFont); | |
} | |
CGFontRelease(graphicsFont); |
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
const void *keys[] = {kColorSyncProfile, kColorSyncRenderingIntent, kColorSyncTransformTag}; | |
const void *srcVals[] = {[srcProfile ref], kColorSyncRenderingIntentUseProfileHeader, kColorSyncTransformDeviceToPCS}; | |
const void *dstVals[] = {[destProfile ref], kColorSyncRenderingIntentUseProfileHeader, kColorSyncTransformPCSToDevice}; | |
CFDictionaryRef srcDict = CFDictionaryCreate ( | |
NULL, | |
(const void **)keys, | |
(const void **)srcVals, | |
3, |
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
*.strings utf16 diff=localizablestrings |
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
#!/bin/bash | |
# This script automatically sets the version and short version string of | |
# an Xcode project from the Git repository containing the project. | |
# | |
# To use this script in Xcode, add the script's path to a "Run Script" build | |
# phase for your application target. | |
set -o errexit | |
set -o nounset |
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
extension Array { | |
func first() -> Element? { | |
if isEmpty { | |
return nil | |
} | |
return self[0] | |
} | |
func last() -> Element? { |
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
//PRHFrameGrabber grabs frame images from the movie. | |
//It wraps a couple of AVAssetImageGenerators, one of which is allowed to round to a more convenient time (e.g., a keyframe). | |
//Thus, the temporally lax generator will return an image first, while we wait for the temporally strict generator, which may take a significant fraction of a second. | |
//PRHFrameGrabber is also an NSPasteboardWriter. It's what the movie view feeds to the dragging session when the user tries to drag a frame; the frame grabber fulfills its NSPasteboardWriter duties by returning the grabbed frame. | |
@interface PRHFrameGrabber () | |
@property(readwrite, copy) NSImage *image; | |
@end | |
@implementation PRHFrameGrabber |
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
/** | |
* The following preprocessor macros can be used to adopt the new nullability annotations and generics | |
* features available in Xcode 7, while maintaining backwards compatibility with earlier versions of | |
* Xcode that do not support these features. | |
*/ | |
#if __has_feature(nullability) | |
# define __ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN | |
# define __ASSUME_NONNULL_END NS_ASSUME_NONNULL_END | |
# define __NULLABLE nullable |
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
import Cocoa | |
// https://github.com/DouglasHeriot/AutoGrowingNSTextField | |
// for AutoLayout | |
class AutoGrowingTextField: NSTextField { | |
var minHeight: CGFloat? = 100 |
OlderNewer