-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBCFontUtilities.h
54 lines (40 loc) · 1.78 KB
/
BCFontUtilities.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//
// BCFontUtilities.h
// Xynk
//
// Created by Tom Houpt on 13/8/10.
//
//
#import <Cocoa/Cocoa.h>
// formatting bit flags
typedef NS_OPTIONS(NSUInteger,BCFontFormatOptions) {
kBCPlainFlag = 0,
kBCBoldFlag = 1 << 0,
kBCItalicFlag = 1 << 1,
kBCUnderlinedFlag = 1 << 2
};
// NOTE: make congruent with NSTextAlignment
typedef NS_ENUM(NSInteger, BCFontHorzAlignmentOptions) { LEFT_JUSTIFIED = 0,
CENTER_JUSTIFIED,
RIGHT_JUSTIFIED
};
typedef NS_ENUM(NSInteger, BCFontVertAlignmentOptions) {
TOP_ALIGNED = 0,
MIDDLE_ALIGNED,
BOTTOM_ALIGNED
};
void SetFontStyleControlSelection(NSSegmentedControl *fontStyleControl, NSUInteger styleFlags);
NSUInteger GetFontStyleFlagsFromControlSelection(NSSegmentedControl *fontStyleControl);
void SetJustificationControlSelection(NSSegmentedControl *justificationControl, NSInteger justification);
NSInteger GetJustificationFromControlSelection(NSSegmentedControl *justificationControl);
void SetAlignmentControlSelection(NSSegmentedControl *alignmentControl, NSInteger justification);
NSInteger GetAlignmentFromControlSelection(NSSegmentedControl *alignmentControl);
void BuildTypeFacePopUpButton(NSPopUpButton *typeFaceButton,NSString *currentTypeFace);
void BuildTypeFacePopUpButtonWithSystemFont(NSPopUpButton *typeFaceButton,NSString *currentTypeFace);
NSTextAlignment BCtoNSTextAlignment(BCFontHorzAlignmentOptions just);
/** wrapper for NSFont fontWithName:size:
@param fontName the name of the font. If fontName is nil or @"System Font Regular", then the current sytem font is returned using [NSFont systemFontOfSize:]
@param fontSize the size of the font in points
@return an NSFont with the given name and font size, or system font if fontName nil
*/
NSFont *FontWithNameAndSize(NSString *fontName, CGFloat fontSize);