Пример #1
0
        void CreateNativeFont(FontFamily family, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet, bool gdiVerticalFont)
        {
            this.sizeInPoints  = ConversionHelpers.GraphicsUnitConversion(unit, GraphicsUnit.Point, 96f, emSize);
            this.underLine     = 0 != (style & FontStyle.Underline);
            this.strikeThrough = 0 != (style & FontStyle.Strikeout);

            this.size = emSize;
            this.unit = unit;

            var size = sizeInPoints * 96f / 72f;

            var traits = CTFontSymbolicTraits.None;

            traits |= style.IsBold() ? CTFontSymbolicTraits.Bold : 0;
            traits |= style.IsItalic() ? CTFontSymbolicTraits.Italic : 0;

            this.nativeFont = CTFontWithFamily(family, traits, size);
        }