コード例 #1
0
        public Font(int size, FontStyle style = 0)
        {
            UIFont uiFont = UIFont.SystemFontOfSize(size);
            CTFontDescriptorAttributes fda = new CTFontDescriptorAttributes()
            {
                FamilyName = uiFont.FamilyName,
                Size       = (float)uiFont.PointSize
            };

            uiFont.Dispose();

            if ((style & FontStyle.Bold) != 0)
            {
                fda.StyleName = "Bold";
            }
            else if ((style & FontStyle.Italic) != 0)
            {
                fda.StyleName = "Italic";
            }

            CTFontDescriptor fd = new CTFontDescriptor(fda);

            nativeFont = new CTFont(fd, 0);
            fd.Dispose();
        }
コード例 #2
0
        public Font(Xamarin.Forms.NamedSize namedSize, FontStyle style = 0)
        {
            UIFont uiFont = UIFont.SystemFontOfSize((float)Xamarin.Forms.Device.GetNamedSize(namedSize, typeof(Xamarin.Forms.Label)));
            CTFontDescriptorAttributes fda = new CTFontDescriptorAttributes()
            {
                FamilyName = uiFont.FamilyName,
                Size       = (float)uiFont.PointSize
            };

            uiFont.Dispose();

            if ((style & FontStyle.Bold) != 0)
            {
                fda.StyleName = "Bold";
            }
            else if ((style & FontStyle.Italic) != 0)
            {
                fda.StyleName = "Italic";
            }

            CTFontDescriptor fd = new CTFontDescriptor(fda);

            nativeFont = new CTFont(fd, 0);
            fd.Dispose();
        }
コード例 #3
0
        public Font(string name, int size, FontStyle style = 0)
        {
            CTFontDescriptorAttributes fda = new CTFontDescriptorAttributes()
            {
                FamilyName = name,
                Size       = size
            };

            if ((style & FontStyle.Bold) != 0)
            {
                fda.StyleName = "Bold";
            }
            else if ((style & FontStyle.Italic) != 0)
            {
                fda.StyleName = "Italic";
            }

            CTFontDescriptor fd = new CTFontDescriptor(fda);

            nativeFont = new CTFont(fd, 0);
            fd.Dispose();
        }