Exemple #1
0
        private void OnASCIIFontChange(object sender, EventArgs args)
        {
            if (_ignoreEvent || _asciiFontList.SelectedIndex == -1)
            {
                return;
            }
            string fontname = (string)_asciiFontList.Items[_asciiFontList.SelectedIndex];

            _asciiFont         = GUtil.CreateFont(fontname, GetFontSize());
            _lASCIISample.Font = _asciiFont;
        }
Exemple #2
0
        private void OnJapaneseFontChange(object sender, EventArgs args)
        {
            if (_ignoreEvent || _japaneseFontList.SelectedIndex == -1)
            {
                return;
            }
            string fontname = (string)_japaneseFontList.Items[_japaneseFontList.SelectedIndex];

            _japaneseFont         = GUtil.CreateFont(fontname, GetFontSize());
            _lJapaneseSample.Font = _japaneseFont;
        }
 private void InitUI()
 {
     AdjustFontDescription(_profile.FontName, _profile.JapaneseFontName, _profile.FontSize);
     _fontSample.Font      = GUtil.CreateFont(_profile.FontName, _profile.FontSize);
     _fontSample.BackColor = _profile.BackColor;
     _fontSample.ForeColor = _profile.ForeColor;
     _fontSample.ClearType = _profile.UseClearType;
     _fontSample.Invalidate(true);
     _backgroundImageBox.Text     = _profile.BackgroundImageFileName;
     _bgColorBox.SelectedColor    = _profile.BackColor;
     _textColorBox.SelectedColor  = _profile.ForeColor;
     _imageStyleBox.SelectedIndex = (int)_profile.ImageStyle;
 }
        private void OnFontSelect(object sender, EventArgs args)
        {
            GFontDialog gd = new GFontDialog();
            Font        nf = GUtil.CreateFont(_profile.FontName, _profile.FontSize);
            Font        jf = GUtil.CreateFont(_profile.JapaneseFontName, _profile.FontSize);

            gd.SetFont(_profile.UseClearType, nf, jf);
            if (GCUtil.ShowModalDialog(this, gd) == DialogResult.OK)
            {
                Font f = gd.ASCIIFont;
                _profile.FontName         = f.Name;
                _profile.JapaneseFontName = gd.JapaneseFont.Name;
                _profile.FontSize         = f.Size;
                _profile.UseClearType     = gd.UseClearType;
                _fontSample.Font          = f;
                AdjustFontDescription(f.Name, gd.JapaneseFont.Name, f.Size);
            }
        }
Exemple #5
0
        private void CreateFonts()
        {
            _font = new FontHandle(GUtil.CreateFont(_fontName, _fontSize));
            FontStyle fs = _font.Font.Style;

            _boldfont          = new FontHandle(new Font(_font.Font, fs | FontStyle.Bold));
            _underlinefont     = new FontHandle(new Font(_font.Font, fs | FontStyle.Underline));
            _boldunderlinefont = new FontHandle(new Font(_font.Font, fs | FontStyle.Underline | FontStyle.Bold));

            _japaneseFont              = new FontHandle(new Font(_japaneseFontName, _fontSize));
            fs                         = _japaneseFont.Font.Style;
            _japaneseBoldfont          = new FontHandle(new Font(_japaneseFont.Font, fs | FontStyle.Bold));
            _japaneseUnderlinefont     = new FontHandle(new Font(_japaneseFont.Font, fs | FontStyle.Underline));
            _japaneseBoldunderlinefont = new FontHandle(new Font(_japaneseFont.Font, fs | FontStyle.Underline | FontStyle.Bold));

            _usingIdenticalFont = (_font.Font.Name == _japaneseFont.Font.Name);

            //通常版
            Graphics g = Graphics.FromHwnd(Win32.GetDesktopWindow());

#if false
            SizeF charsize1 = g.MeasureString("A", _font.Font);
            SizeF charsize2 = g.MeasureString("AA", _font.Font);

            _pitch   = new SizeF(charsize2.Width - charsize1.Width, charsize1.Height);
            _chargap = (charsize1.Width - _pitch.Width) / 2;
#else
            IntPtr hdc = g.GetHdc();
            Win32.SelectObject(hdc, _font.HFONT);
            Win32.SIZE charsize1, charsize2;
            Win32.GetTextExtentPoint32(hdc, "A", 1, out charsize1);
            Win32.GetTextExtentPoint32(hdc, "AAA", 3, out charsize2);

            _pitch   = new SizeF((charsize2.width - charsize1.width) / 2, charsize1.height);
            _chargap = (charsize1.width - _pitch.Width) / 2;
            g.ReleaseHdc(hdc);
#endif
            g.Dispose();
        }