Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Line" /> class.
        /// </summary>
        /// <param name="lineNo">The line no.</param>
        /// <param name="text">The text.</param>
        /// <param name="font">The font.</param>
        /// <param name="justification">The justification.</param>
        public Line(int lineNo, string text, Fonts font = Fonts.SmallVariable, Justifications justification = Justifications.Left)
        {
            Font          = font;
            LineNo        = lineNo;
            Text          = text;
            Justification = justification;

            switch (font)
            {
            case Fonts.SmallVariable:
            case Fonts.SmallVariableBold:
            case Fonts.SmallFixed:
            case Fonts.SmallGraphic:
                Height = 8;
                break;

            case Fonts.MediumVariable:
            case Fonts.MediumFixed:
            case Fonts.MediumGraphic:
                Height = 16;
                break;

            case Fonts.LargeVariable:
                Height = 24;
                break;

            case Fonts.ExtraLargeVariable:
                Height = 32;
                break;
            }
        }
Esempio n. 2
0
        private static byte[] Align(Justifications justification)
        {
            byte align;

            switch (justification)
            {
            case Justifications.Right:
                align = '2'.ToByte();
                break;

            case Justifications.Center:
                align = '1'.ToByte();
                break;

            default:
                align = '0'.ToByte();
                break;
            }

            return(new byte[]
            {
                27,
                'a'.ToByte(),
                align
            });
        }
Esempio n. 3
0
 public TextGraphic(string txt, SpriteFont font, Color color, Justifications justification)
 {
     Font  = font;
     just  = justification;
     Color = color;
     Text  = txt;
 }