/// <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="SpriteFontFace"/> that corresponds to the specified style.</returns> public SpriteFontFace GetFace(SpriteFontStyle style) { switch (style) { case SpriteFontStyle.Regular: return faceRegular ?? faceBold ?? faceItalic ?? faceBoldItalic; case SpriteFontStyle.Bold: return faceBold ?? faceBoldItalic ?? faceRegular ?? faceItalic; case SpriteFontStyle.Italic: return faceItalic ?? faceBoldItalic ?? faceRegular ?? faceBold; case SpriteFontStyle.BoldItalic: return faceBoldItalic ?? faceItalic ?? faceBold ?? faceRegular; } throw new NotSupportedException(); }
/// <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="SpriteFontFace"/> that corresponds to the specified style.</returns> public SpriteFontFace GetFace(SpriteFontStyle style) { switch (style) { case SpriteFontStyle.Regular: return(faceRegular ?? faceBold ?? faceItalic ?? faceBoldItalic); case SpriteFontStyle.Bold: return(faceBold ?? faceBoldItalic ?? faceRegular ?? faceItalic); case SpriteFontStyle.Italic: return(faceItalic ?? faceBoldItalic ?? faceRegular ?? faceBold); case SpriteFontStyle.BoldItalic: return(faceBoldItalic ?? faceItalic ?? faceBold ?? faceRegular); } 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(SpriteFont font, Int32?width, Int32?height, TextFlags flags, TextLayoutOptions options, SpriteFontStyle 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(SpriteFont font, Int32?width, Int32?height, TextFlags flags, SpriteFontStyle 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(SpriteFont font, Int32?width, Int32?height, TextFlags flags, TextLayoutOptions options, SpriteFontStyle 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; }
/// <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(SpriteFont font, Int32? width, Int32? height, TextFlags flags, TextLayoutOptions options, SpriteFontStyle 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(SpriteFont font, Int32? width, Int32? height, TextFlags flags, SpriteFontStyle 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(SpriteFont font, Int32? width, Int32? height, TextFlags flags, TextLayoutOptions options, SpriteFontStyle 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; }