private void CreateFonts() { _font = new FontHandle(RuntimeUtil.CreateFont(_fontName, _fontSize), _useClearType); FontStyle fs = _font.Font.Style; _boldfont = new FontHandle(new Font(_font.Font, fs | FontStyle.Bold), _useClearType); _underlinefont = new FontHandle(new Font(_font.Font, fs | FontStyle.Underline), _useClearType); _boldunderlinefont = new FontHandle(new Font(_font.Font, fs | FontStyle.Underline | FontStyle.Bold), _useClearType); _cjkFont = new FontHandle(new Font(_cjkFontName, _fontSize), _useClearType); fs = _cjkFont.Font.Style; _cjkBoldfont = new FontHandle(new Font(_cjkFont.Font, fs | FontStyle.Bold), _useClearType); _cjkUnderlinefont = new FontHandle(new Font(_cjkFont.Font, fs | FontStyle.Underline), _useClearType); _cjkBoldUnderlinefont = new FontHandle(new Font(_cjkFont.Font, fs | FontStyle.Underline | FontStyle.Bold), _useClearType); _usingIdenticalFont = (_font.Font.Name == _cjkFont.Font.Name); //通常版 Graphics g = Graphics.FromHwnd(Win32.GetDesktopWindow()); 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); g.Dispose(); }
private void DisposeFontHandle(ref FontHandle f) { if (f != null) { f.Dispose(); f = null; } }
private void CreateFonts() { _font = new FontHandle(RuntimeUtil.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)); _cjkFont = new FontHandle(new Font(_cjkFontName, _fontSize)); fs = _cjkFont.Font.Style; _cjkBoldfont = new FontHandle(new Font(_cjkFont.Font, fs | FontStyle.Bold)); _cjkUnderlinefont = new FontHandle(new Font(_cjkFont.Font, fs | FontStyle.Underline)); _cjkBoldUnderlinefont = new FontHandle(new Font(_cjkFont.Font, fs | FontStyle.Underline | FontStyle.Bold)); _usingIdenticalFont = (_font.Font.Name == _cjkFont.Font.Name); //通常版 Graphics g = Graphics.FromHwnd(Win32.GetDesktopWindow()); 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); #if KM20121125_UseExtTextOut_impl3 { float pw = _pitch.Width; float fx = 0f; for (int i = 0; i < PITCH_DX_LEN; i++, fx += pw) { pitch_deltaXArray[i] = (int)(fx + pw) - (int)fx; } } #endif _chargap = (charsize1.width - _pitch.Width) / 2; g.ReleaseHdc(hdc); g.Dispose(); }
/// <summary> /// <ja>コピーして作成します。</ja> /// <en>Initializes with another instance.</en> /// </summary> public RenderProfile(RenderProfile src) { _fontName = src._fontName; _cjkFontName = src._cjkFontName; _fontSize = src._fontSize; _lineSpacing = src._lineSpacing; _useClearType = src._useClearType; _enableBoldStyle = src._enableBoldStyle; _forceBoldStyle = src._forceBoldStyle; _cjkFont = _font = null; _forecolor = src._forecolor; _bgcolor = src._bgcolor; #if !MACRODOC _esColorSet = (EscapesequenceColorSet)src._esColorSet.Clone(); #endif _bgbrush = _brush = null; _backgroundImageFileName = src._backgroundImageFileName; _imageLoadIsAttempted = false; _imageStyle = src.ImageStyle; }