Exemplo n.º 1
0
        private void btnSelInputRef_Click(object sender, EventArgs e)
        {
            if (openInputRef.ShowDialog() == DialogResult.OK)
            {
                _refFileName = openInputRef.SafeFileName;

                editInputRef.Text = openInputRef.FileName;
                try
                {
                    FontGen.GetRefInfo(openInputRef.FileName, out _width, out _height, out _charHeight, out _charCount);
                    lblCharCountRef.Text = _charCount.ToString();
                    editTotWidth.Value   = _width;
                    editTotHeight.Value  = _height;
                    editCharHeight.Value = _charHeight;
                    _fontSel             = new Font("宋体", _charHeight, GraphicsUnit.Pixel);
                    fontDialog.Font      = _fontSel;
                    lblFont.Text         = _fontSel.ToString();
                    btnRefreshPreview_Click(null, null);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Exemplo n.º 2
0
        private void btnRefreshPreview_Click(object sender, EventArgs e)
        {
            Bitmap        bmp   = null;
            List <UInt16> chars = new List <UInt16>()
            {
                '示',
                '示',
                '示',
                ' ',
                '例',
                '例',
                '例',
                ' ',
                '文',
                '文',
                '文',
                ' ',
                '字',
                '字',
                '字',
                ' '
            };

            if (FontGen.Generate(
                    chars, (int)editOffsetX.Value,
                    (int)editCharWidth.Value * 2 + 1, (int)editCharHeight.Value * 2 + 1,
                    (int)editCharWidth.Value, (int)editCharHeight.Value,
                    _fontSel, true, out bmp, null))
            {
                picturePreview.Image = bmp;
            }
        }
Exemplo n.º 3
0
        private void btnSelInput_Click(object sender, EventArgs e)
        {
            if (openInputFont.ShowDialog() == DialogResult.OK)
            {
                editInput.Text = openInputFont.FileName;

                try
                {
                    FontGen.GetCharset(openInputFont.FileName, out _charset);
                    lblCharCount.Text = _charset.Count.ToString();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Exemplo n.º 4
0
        private void btnRefreshPreview_Click(object sender, EventArgs e)
        {
            Bitmap      bmp   = null;
            List <char> chars = new List <char>();

            for (int i = 0; i < editExample.Text.Length; i++)
            {
                chars.Add(editExample.Text[i]);
            }
            if (FontGen.Generate(
                    chars, radRenderGdi.Checked, getTextRenderingHint(),
                    (int)editCharHeight.Value * 2 + 10, (int)editCharHeight.Value * 2 + 10,
                    (int)editCharHeight.Value, (int)editCharHeight.Value,
                    _fontSel, true, out bmp, null, null))
            {
                picturePreview.Image = bmp;
            }
        }
Exemplo n.º 5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (_charset == null || _charset.Count == 0)
            {
                MessageBox.Show("没有选择字符集");
                return;
            }

            if (saveFolderBrowser.ShowDialog() == DialogResult.OK)
            {
                Bitmap bmp = null;
                FontGen.Generate(_charset, (int)editOffsetX.Value,
                                 (int)editTotWidth.Value, (int)editTotHeight.Value,
                                 (int)editCharWidth.Value, (int)editCharHeight.Value,
                                 _fontSel, false, out bmp, saveFolderBrowser.SelectedPath);
                MessageBox.Show("已保存");
            }
        }
Exemplo n.º 6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (_charset == null || _charset.Count == 0)
            {
                MessageBox.Show("没有选择字符集");
                return;
            }

            if (saveFolderBrowser.ShowDialog() == DialogResult.OK)
            {
                Bitmap bmp = null;
                FontGen.Generate(_charset, radRenderGdi.Checked, getTextRenderingHint(),
                                 (int)editTotWidth.Value, (int)editTotHeight.Value,
                                 0, (int)editCharHeight.Value,
                                 _fontSel, false, out bmp,
                                 saveFolderBrowser.SelectedPath, _refFileName);
                MessageBox.Show("已保存");
            }
        }