/// <summary> /// Gets the font face that corresponds to the specified style. /// </summary> /// <remarks>If the requested font face does not exist, the closest matching font face will be returned instead.</remarks> /// <param name="style">The style for which to retrieve a font face.</param> /// <returns>The <see cref="UltravioletFontFace"/> that corresponds to the specified style.</returns> public UltravioletFontFace GetFace(UltravioletFontStyle style) { switch (style) { case UltravioletFontStyle.Regular: return(Regular ?? Bold ?? Italic ?? BoldItalic); case UltravioletFontStyle.Bold: return(Bold ?? BoldItalic ?? Regular ?? Italic); case UltravioletFontStyle.Italic: return(Italic ?? BoldItalic ?? Regular ?? Bold); case UltravioletFontStyle.BoldItalic: return(BoldItalic ?? Italic ?? Bold ?? Regular); } throw new NotSupportedException(); }
/// <summary> /// Initializes a new instance of the <see cref="TextLayoutSettings"/> structure. /// </summary> /// <param name="font">The default font.</param> /// <param name="width">The width of the layout area.</param> /// <param name="height">The height of the layout area.</param> /// <param name="flags">A set of flags that specify how to render and align the text.</param> /// <param name="options">A set of options which can be used to modify the behavior of the layout engine.</param> /// <param name="fontStyle">The initial font style.</param> public TextLayoutSettings(UltravioletFont font, Int32?width, Int32?height, TextFlags flags, TextLayoutOptions options, UltravioletFontStyle fontStyle) : this(font, width, height, flags, options, fontStyle, null) { }
/// <summary> /// Initializes a new instance of the <see cref="TextLayoutSettings"/> structure. /// </summary> /// <param name="font">The default font.</param> /// <param name="width">The width of the layout area.</param> /// <param name="height">The height of the layout area.</param> /// <param name="flags">A set of flags that specify how to render and align the text.</param> /// <param name="fontStyle">The initial font style.</param> /// <param name="initialLayoutStyle">The name of the initial layout style, or <see langword="null"/> to use no initial layout style.</param> public TextLayoutSettings(UltravioletFont font, Int32?width, Int32?height, TextFlags flags, UltravioletFontStyle fontStyle, String initialLayoutStyle) : this(font, width, height, flags, TextLayoutOptions.None, fontStyle, initialLayoutStyle) { }
/// <summary> /// Initializes a new instance of the <see cref="TextLayoutSettings"/> structure. /// </summary> /// <param name="font">The default font.</param> /// <param name="width">The width of the layout area.</param> /// <param name="height">The height of the layout area.</param> /// <param name="flags">A set of flags that specify how to render and align the text.</param> /// <param name="options">A set of options which can be used to modify the behavior of the layout engine.</param> /// <param name="fontStyle">The initial font style.</param> /// <param name="initialLayoutStyle">The name of the initial layout style, or <see langword="null"/> to use no initial layout style.</param> public TextLayoutSettings(UltravioletFont font, Int32?width, Int32?height, TextFlags flags, TextLayoutOptions options, UltravioletFontStyle fontStyle, String initialLayoutStyle) { this.font = font; this.width = width; this.height = height; this.flags = (flags == 0) ? TextFlags.Standard : flags; this.style = fontStyle; this.options = options; this.initialLayoutStyle = initialLayoutStyle; }
/// <inheritdoc/> public new TFontFace GetFace(UltravioletFontStyle style) => (TFontFace)base.GetFace(style);
/// <summary> /// Initializes a new instance of the <see cref="TextLayoutSettings"/> structure. /// </summary> /// <param name="font">The default font.</param> /// <param name="width">The width of the layout area.</param> /// <param name="height">The height of the layout area.</param> /// <param name="flags">A set of flags that specify how to render and align the text.</param> /// <param name="options">A set of options which can be used to modify the behavior of the layout engine.</param> /// <param name="fontStyle">The initial font style.</param> public TextLayoutSettings(UltravioletFont font, Int32?width, Int32?height, TextFlags flags, TextLayoutOptions options, UltravioletFontStyle fontStyle) : this(font, width, height, flags, options, TextDirection.LeftToRight, TextScript.Unknown, fontStyle, null) { }
/// <summary> /// Initializes a new instance of the <see cref="TextLayoutSettings"/> structure. /// </summary> /// <param name="font">The default font.</param> /// <param name="width">The width of the layout area.</param> /// <param name="height">The height of the layout area.</param> /// <param name="flags">A set of flags that specify how to render and align the text.</param> /// <param name="fontStyle">The initial font style.</param> /// <param name="initialLayoutStyle">The name of the initial layout style, or <see langword="null"/> to use no initial layout style.</param> public TextLayoutSettings(UltravioletFont font, Int32?width, Int32?height, TextFlags flags, UltravioletFontStyle fontStyle, String initialLayoutStyle) : this(font, width, height, flags, TextLayoutOptions.None, TextDirection.LeftToRight, TextScript.Unknown, fontStyle, initialLayoutStyle) { }
/// <summary> /// Initializes a new instance of the <see cref="TextLayoutSettings"/> structure. /// </summary> /// <param name="font">The default font.</param> /// <param name="width">The width of the layout area.</param> /// <param name="height">The height of the layout area.</param> /// <param name="flags">A set of flags that specify how to render and align the text.</param> /// <param name="options">A set of options which can be used to modify the behavior of the layout engine.</param> /// <param name="direction">A value indicating the direction in which the text should be laid out.</param> /// <param name="script">A value specifying which script is used to draw the text.</param> /// <param name="fontStyle">The initial font style.</param> /// <param name="initialLayoutStyle">The name of the initial layout style, or <see langword="null"/> to use no initial layout style.</param> /// <param name="language">The ISO 639 name of the text language.</param> public TextLayoutSettings(UltravioletFont font, Int32?width, Int32?height, TextFlags flags, TextLayoutOptions options, TextDirection direction, TextScript script, UltravioletFontStyle fontStyle, String initialLayoutStyle, String language = "en") { if (direction == TextDirection.TopToBottom || direction == TextDirection.BottomToTop) { throw new NotSupportedException(UltravioletStrings.UnsupportedTextDirection); } this.Font = font; this.Width = width; this.Height = height; this.Flags = (flags == 0) ? TextFlags.Standard : flags; this.Style = fontStyle; this.Direction = direction; this.Script = script; this.Options = options; this.InitialLayoutStyle = initialLayoutStyle; this.Language = language; }