CTFontSymbolicTraits Enum

Definition

Describes the style of a font.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

[System.Flags]
public enum CTFontSymbolicTraits
type CTFontSymbolicTraits = 
Inheritance
CTFontSymbolicTraits
Attributes

Fields

Bold 2

This is a bold font. If querying CTFontTraits you can get more information about the weight from the Weight property.

ColorGlyphs 8192

This font contains glyphs with colors (for example, some Emoji fonts).

Composite 16384

The font is a composite font reference, and a cascade list is expected for the font.

Condensed 64

This is a condensed font. If querying CTFontTraits you can get more information about the width from the Width property.

Expanded 32

This is an expanded font.

Italic 1

This is an italic font. If querying CTFontTraits you can get more information about the slant from the Slant property.

Mask 4026531840

Mask used to extract trait values.

MonoSpace 1024

Use fixed fonts if available.

None 0

Used when no values are set.

UIOptimized 4096

The font is optimized for UI rendering.

Vertical 2048

The font has vertical information for rendering.

Remarks

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

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");
}

Applies to