DTCoreTextFontDescriptor Class Reference
| Inherits from | NSObject |
| Conforms to | NSCoding NSCopying |
| Declared in | DTCoreTextFontDescriptor.h |
Overview
This class describes the attributes of a font. It is used to represent fonts throughout the parsing and when needed is able to generated matching CTFont instances.
Tasks
Creating Font Descriptors
-
+ fontDescriptorWithFontAttributes: -
+ fontDescriptorForCTFont: -
– initWithFontAttributes: -
– initWithCTFontDescriptor: -
– initWithCTFont:
Creating Fonts from Font Descriptors
Specifying Font Attributes
-
– setFontAttributes: -
– fontAttributes -
fontFamilyproperty -
fontNameproperty -
pointSizeproperty -
boldTraitproperty -
italicTraitproperty -
expandedTraitproperty -
condensedTraitproperty -
monospaceTraitproperty -
verticalTraitproperty -
UIoptimizedTraitproperty -
symbolicTraitsproperty -
stylisticClassproperty -
smallCapsFeatureproperty -
– supportsNativeSmallCaps -
– cssStyleRepresentation
Global Font Overriding
Properties
UIoptimizedTrait
Whether the described font is optimized for use in User Interfaces
@property (nonatomic) BOOL UIoptimizedTraitDeclared In
DTCoreTextFontDescriptor.hboldTrait
Whether the described font has the bold trait
@property (nonatomic) BOOL boldTraitDeclared In
DTCoreTextFontDescriptor.hcondensedTrait
Whether the described font has the condensed trait
@property (nonatomic) BOOL condensedTraitDeclared In
DTCoreTextFontDescriptor.hexpandedTrait
Whether the described font has the expanded trait
@property (nonatomic) BOOL expandedTraitDeclared In
DTCoreTextFontDescriptor.hfontFamily
The font family name of the described font
@property (nonatomic, copy) NSString *fontFamilyDeclared In
DTCoreTextFontDescriptor.hfontName
The font name of the described font
@property (nonatomic, copy) NSString *fontNameDeclared In
DTCoreTextFontDescriptor.hitalicTrait
Whether the described font has the italic trait
@property (nonatomic) BOOL italicTraitDeclared In
DTCoreTextFontDescriptor.hmonospaceTrait
Whether the described font has the monospace trait
@property (nonatomic) BOOL monospaceTraitDeclared In
DTCoreTextFontDescriptor.hpointSize
The point size of the described font
@property (nonatomic) CGFloat pointSizeDeclared In
DTCoreTextFontDescriptor.hsmallCapsFeature
YES if the small caps style is enabled, NO if not
@property (nonatomic) BOOL smallCapsFeatureDeclared In
DTCoreTextFontDescriptor.hstylisticClass
The stylistic class of the receiver
@property (nonatomic) CTFontStylisticClass stylisticClassDeclared In
DTCoreTextFontDescriptor.hClass Methods
asyncPreloadFontLookupTable
A call to the method is ideally placed into your app delegate. This loads all available system fonts into a look up table to allow DTCoreText to quickly find a specific combination of font-family and italic and bold attributes. Please refer to the Programming Guide for information when you should be using this.
+ (void)asyncPreloadFontLookupTableDiscussion
Calling this does not replace entries already existing in the lookup table, for example loaded from the DTCoreTextFontOverrides.plist included in the app bundle.
Declared In
DTCoreTextFontDescriptor.hfallbackFontFamily
Returns the font family to use if the font family in a font descriptor is invalid. The default is Times New Roman.
+ (NSString *)fallbackFontFamilyReturn Value
The font family
Declared In
DTCoreTextFontDescriptor.hfontDescriptorForCTFont:
Convenience method for creates a font descriptor from a Core Text font
+ (DTCoreTextFontDescriptor *)fontDescriptorForCTFont:(CTFontRef)ctFontParameters
- ctFont
The Core Text font
Return Value
An initialized font descriptor
Declared In
DTCoreTextFontDescriptor.hfontDescriptorWithFontAttributes:
Convenience method to create a font descriptor from a font attributes dictionary
+ (DTCoreTextFontDescriptor *)fontDescriptorWithFontAttributes:(NSDictionary *)attributesParameters
- attributes
The dictionary of font attributes
Return Value
An initialized font descriptor
Declared In
DTCoreTextFontDescriptor.hoverrideFontNameforFontFamily:bold:italic:
Retrieves the gobal font name override for a given font family with bold and italic traits.
+ (NSString *)overrideFontNameforFontFamily:(NSString *)fontFamily bold:(BOOL)bold italic:(BOOL)italicParameters
- fontFamily
The font family to retrieve the override for
- bold
The bold trait
- italic
The italic trait
Return Value
The font name to use for this combination of parameters
Declared In
DTCoreTextFontDescriptor.hsetFallbackFontFamily:
Sets the font family to use if the font family in a font descriptor is invalid.
+ (void)setFallbackFontFamily:(NSString *)fontFamilyParameters
- fontFamily
The font family
Discussion
The fallback font family cannot be nil and must be a valid font family. The default is Times New Roman.
Declared In
DTCoreTextFontDescriptor.hsetOverrideFontName:forFontFamily:bold:italic:
Sets the global font name override to use when encountering a font family with given bold and italic attributes.
+ (void)setOverrideFontName:(NSString *)fontName forFontFamily:(NSString *)fontFamily bold:(BOOL)bold italic:(BOOL)italicParameters
- fontName
The font name to use
- fontFamily
The font family to use this for
- bold
The bold trait
- italic
The italic trait
Declared In
DTCoreTextFontDescriptor.hsetSmallCapsFontName:forFontFamily:bold:italic:
Sets the global font name override to use when encountering small caps text in a font family with given bold and italic attributes.
+ (void)setSmallCapsFontName:(NSString *)fontName forFontFamily:(NSString *)fontFamily bold:(BOOL)bold italic:(BOOL)italicParameters
- fontName
The font name to use
- fontFamily
The font family to use this for
- bold
The bold trait
- italic
The italic trait
Declared In
DTCoreTextFontDescriptor.hsmallCapsFontNameforFontFamily:bold:italic:
Retrieves the gobal font name override to use for small caps text for a given font family with bold and italic traits.
+ (NSString *)smallCapsFontNameforFontFamily:(NSString *)fontFamily bold:(BOOL)bold italic:(BOOL)italicParameters
- fontFamily
The font family to retrieve the override for
- bold
The bold trait
- italic
The italic trait
Return Value
The font name to use for this combination of parameters
Declared In
DTCoreTextFontDescriptor.hInstance Methods
cssStyleRepresentation
The CSS style sheet representation of the receiver
- (NSString *)cssStyleRepresentationReturn Value
A CSS style string
Declared In
DTCoreTextFontDescriptor.hfontAttributes
Retrieves a dictionary of font attributes
- (NSDictionary *)fontAttributesDeclared In
DTCoreTextFontDescriptor.hinitWithCTFont:
Creates a font descriptor from a Core Text font
- (id)initWithCTFont:(CTFontRef)ctFontParameters
- ctFont
The Core Text font
Return Value
An initialized font descriptor
Declared In
DTCoreTextFontDescriptor.hinitWithCTFontDescriptor:
Creates a font descriptor from a Core Text font descriptor
- (id)initWithCTFontDescriptor:(CTFontDescriptorRef)ctFontDescriptorParameters
- ctFontDescriptor
The Core Text font descriptor
Return Value
An initialized font descriptor
Declared In
DTCoreTextFontDescriptor.hinitWithFontAttributes:
Creates a font descriptor from a font attributes dictionary
- (id)initWithFontAttributes:(NSDictionary *)attributesParameters
- attributes
The dictionary of font attributes
Return Value
An initialized font descriptor
Declared In
DTCoreTextFontDescriptor.hnewMatchingFont
Creates a CTFont matching the receiver’s attribute
- (CTFontRef)newMatchingFontReturn Value
a +1 owning reference of a Core Text font
Declared In
DTCoreTextFontDescriptor.h