Ejemplo n.º 1
0
 /// <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();
 }
Ejemplo n.º 2
0
        /// <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();
        }
Ejemplo n.º 3
0
 /// <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)
 {
 }
Ejemplo n.º 4
0
 /// <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)
 {
 }
Ejemplo n.º 5
0
 /// <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;
 }
Ejemplo n.º 6
0
 /// <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)
 {
 }
Ejemplo n.º 7
0
 /// <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)
 {
 }
Ejemplo n.º 8
0
 /// <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;
 }