예제 #1
0
파일: GdiFont.cs 프로젝트: nholik/Fo.Net
        /// <summary>
        ///     Creates a font based on the supplied typeface name and size.
        /// </summary>
        /// <param name="faceName">The typeface name of a font.</param>
        /// <param name="height">
        ///     The height, in logical units, of the font's character 
        ///     cell or character.
        /// </param>
        /// <returns></returns>
        public static GdiFont CreateFont(string faceName, int height, bool bold, bool italic) {
            LogFont lf = new LogFont();
            lf.lfCharSet = 1; // Default charset
            lf.lfFaceName = faceName;
            lf.lfHeight = height;
            lf.lfWeight = (bold) ? 700 : 0;
            lf.lfItalic = Convert.ToByte(italic);

            return new GdiFont(LibWrapper.CreateFontIndirect(lf), faceName, height);
        }