Beispiel #1
0
        public Form1()
        {
            InitializeComponent();
            SystemState.Text = "Ready";
            CharCodeLabel.Text = CharacterSelection.ToString("X4");
            CharCodeLabel.Enabled = false;
            CurrentFont = new FontFileIO();         // Class is instantiated... and ready for use...
            // Test our class...
            FontRenderer = new Renderer();          // Instantiation of class...

            testdata[0] = 1;
            testdata[1] = 0;
            testdata[2] = 0;
            testdata[3] = 0;
            testdata[4] = 0;
            testdata[5] = 0;
            testdata[6] = 0;
            testdata[7] = 0;

            testdata[8] = 0;
            testdata[9] = 1;
            testdata[10] = 0;
            testdata[11] = 0;
            testdata[12] = 0;
            testdata[13] = 0;
            testdata[14] = 0;
            testdata[15] = 0;

            testdata[16] = 0;
            testdata[17] = 0;
            testdata[18] = 1;
            testdata[19] = 0;
            testdata[20] = 0;
            testdata[21] = 0;
            testdata[22] = 0;
            testdata[23] = 0;

            testdata[24] = 0;
            testdata[25] = 0;
            testdata[26] = 0;
            testdata[27] = 1;
            testdata[28] = 0;
            testdata[29] = 0;
            testdata[30] = 0;
            testdata[31] = 0;

            FontRenderer.SetXSize(8);
            FontRenderer.SetYSize(8);
            Bitmap PreviewCanvas = new Bitmap(128, 128);
            Bitmap CharCanvas = new Bitmap((FontRenderer.GetXSize() * 16) + FontRenderer.GetXSize() + 1, (FontRenderer.GetYSize() * 16) + FontRenderer.GetYSize() + 1); // Here we need to compute the size of the bitmap required to hold all our info...
            FontRenderer.RenderCharacter(ref CharCanvas, ref testdata, 0, 0);
            FontRenderer.RenderPreview(ref PreviewCanvas, ref testdata, PreviewMagValue);
            CharacterEdit.Image = null;
            CharacterEdit.Image = CharCanvas;
            CharPreview.Image = null;
            CharPreview.Image = PreviewCanvas;
        }
Beispiel #2
0
        //----------------------------------------------------------
        // Form's event handlers
        //----------------------------------------------------------
        // Accept button's event handler
        //----------------------------------------------------------
        private void AcceptButton_Click(object sender, EventArgs e)
        {
            SaveFileDialog SaveFontFileDialog = new SaveFileDialog();       // Instantiate the .net class
            SaveFontFileDialog.Filter = "Font files (*.fon)|*.fon";
            SaveFontFileDialog.FilterIndex = 1;
            SaveFontFileDialog.RestoreDirectory = true;
            if (SaveFontFileDialog.ShowDialog() == DialogResult.OK)         // The dialog automatically handles the case of overwriting existing files, and issues warnings...
            {
                   // Information is in the form... create the file... (empty file with bare minimum of information)
                FontFileIO FileIO = new FontFileIO();
                FileIO.CreateFontFile(SaveFontFileDialog.FileName, FileIdent.Text);

            }

            this.Close();
        }