Mac Guides | Samples

MonoMac.CoreText.CTFontSymbolicTraits Enumeration

Describes the style of a font.

Syntax

[MonoMac.ObjCRuntime.Since(3, 2)]
[System.Flags]
public enum CTFontSymbolicTraits

Remarks

You can use this to query trait information about a font.

c# Example

void ShowInfo (CTFont font)
{
    var traits = font.GetTraits ();
    if (traits.Bold)
	Console.WriteLine ("Bold font, weight={0}", traits.Weight);
    if (traits.Italic)
	Console.WriteLine ("Italic font, slant={0}", traits.Slant);
    if (traits.Condensed || traits.Expanded)
	Console.WriteLine ("Condensed/Expanded font, width={0}", traits.Width);
    if (traits.ColorGlyphs)
	Console.WriteLine ("Font has colored glyphs");
    if (traits.MonoSpace)
	Console.WriteLine ("Font is monospaced");
    if (traits.Vertical)
	Console.WriteLine ("Font contains vertical metrics");
}

Members

Member NameDescription
Bold This is a bold font. If querying CTFontTraits you can get more information about the weight from the CTFontTraits.Weight property.
ColorGlyphsThis font contains glyphs with colors (for example, some Emoji fonts).
CompositeThe font is a composite font reference, and a cascade list is expected for the font.
CondensedThis is a condensed font. If querying CTFontTraits you can get more information about the width from the CTFontTraits.Width property.
ExpandedThis is an expanded font.
ItalicThis is an italic font. If querying CTFontTraits you can get more information about the slant from the CTFontTraits.Slant property.
MaskMask used to extract trait values.
MonoSpaceUse fixed fonts if available.
NoneUsed when no values are set.
UIOptimizedThe font is optimized for UI rendering.
VerticalThe font has vertical information for rendering.

Requirements

Namespace: MonoMac.CoreText
Assembly: XamMac (in XamMac.dll)
Assembly Versions: 0.0.0.0

The members of MonoMac.CoreText.CTFontSymbolicTraits are listed below.

See Also: Enum

Public Fields

BoldCTFontSymbolicTraits. This is a bold font. If querying CTFontTraits you can get more information about the weight from the CTFontTraits.Weight property.
ColorGlyphsCTFontSymbolicTraits. This font contains glyphs with colors (for example, some Emoji fonts).
CompositeCTFontSymbolicTraits. The font is a composite font reference, and a cascade list is expected for the font.
CondensedCTFontSymbolicTraits. This is a condensed font. If querying CTFontTraits you can get more information about the width from the CTFontTraits.Width property.
ExpandedCTFontSymbolicTraits. This is an expanded font.
ItalicCTFontSymbolicTraits. This is an italic font. If querying CTFontTraits you can get more information about the slant from the CTFontTraits.Slant property.
MaskCTFontSymbolicTraits. Mask used to extract trait values.
MonoSpaceCTFontSymbolicTraits. Use fixed fonts if available.
NoneCTFontSymbolicTraits. Used when no values are set.
UIOptimizedCTFontSymbolicTraits. The font is optimized for UI rendering.
VerticalCTFontSymbolicTraits. The font has vertical information for rendering.