コード例 #1
0
        public void SetSymbol(FontSymbol symbol, Font font)
        {
            Bitmap bitmap = new Bitmap(16, 16);

            using (Graphics graphic = Graphics.FromImage(bitmap))
            {
                RectangleF firstChar  = new RectangleF(-2, 0, 16, 16);
                RectangleF secondChar = new RectangleF(6, 0, 16, 16);

                graphic.Clear(Color.Black);
                graphic.SmoothingMode     = SmoothingMode.None;
                graphic.InterpolationMode = InterpolationMode.NearestNeighbor;
                graphic.PixelOffsetMode   = PixelOffsetMode.None;

                if (symbol.Splitted)
                {
                    graphic.DrawString(symbol.Character1.ToString(), font, Brushes.White, firstChar);
                    graphic.DrawString(symbol.Character2.ToString(), font, Brushes.White, secondChar);
                }
                else
                {
                    //TODO make non splitted characters bigger or in center? if bigger need two fonts/sizes
                    graphic.DrawString(symbol.Character1.ToString(), font, Brushes.White, firstChar);
                }
            }
            SetBitmap(bitmap);
        }
コード例 #2
0
 public FontCharacter(FontSymbol symbol, Font font)
 {
     Symbol = symbol.Symbol;
     SetSymbol(symbol, font);
 }