Пример #1
0
        public FormattedTextImpl(
            Pango.Context context,
            string text,
            string fontFamily,
            double fontSize,
            FontStyle fontStyle,
            TextAlignment textAlignment,
            FontWeight fontWeight)
        {
            Contract.Requires <ArgumentNullException>(context != null);
            Contract.Requires <ArgumentNullException>(text != null);
            Layout = new Pango.Layout(context);
            _text  = text;
            Layout.SetText(text);
            Layout.FontDescription = new Pango.FontDescription
            {
                Family = fontFamily,
                Size   = Pango.Units.FromDouble(CorrectScale(fontSize)),
                Style  = (Pango.Style)fontStyle,
                Weight = fontWeight.ToCairo()
            };

            Layout.Alignment  = textAlignment.ToCairo();
            Layout.Attributes = new Pango.AttrList();
        }
Пример #2
0
        public FormattedTextImpl(
            Pango.Context context,
            string text,
            string fontFamily,
            double fontSize,
            FontStyle fontStyle,
            TextAlignment textAlignment,
            FontWeight fontWeight)
        {
            Contract.Requires<ArgumentNullException>(context != null);
            Contract.Requires<ArgumentNullException>(text != null);
            Layout = new Pango.Layout(context);
            _text = text;
            Layout.SetText(text);
            Layout.FontDescription = new Pango.FontDescription
            {
                Family = fontFamily,
                Size = Pango.Units.FromDouble(CorrectScale(fontSize)),
                Style = (Pango.Style)fontStyle,
                Weight = fontWeight.ToCairo()
            };

            Layout.Alignment = textAlignment.ToCairo();
            Layout.Attributes = new Pango.AttrList();
        }
Пример #3
0
        public FormattedTextImpl(
            string text,
            string fontFamily,
            double fontSize,
            FontStyle fontStyle,
            TextAlignment textAlignment,
            FontWeight fontWeight)
        {
            var context = Locator.Current.GetService<Pango.Context>();
            this.Layout = new Pango.Layout(context);
            this.Layout.SetText(text);
            this.Layout.FontDescription = new Pango.FontDescription
            {
                Family = fontFamily,
                Size = Pango.Units.FromDouble(fontSize * 0.73),
                Style = (Pango.Style)fontStyle,
                Weight = fontWeight.ToCairo()
            };

            this.Layout.Alignment = textAlignment.ToCairo();
        }
Пример #4
0
        public FormattedTextImpl(
            string text,
            string fontFamily,
            double fontSize,
            FontStyle fontStyle,
            TextAlignment textAlignment,
            FontWeight fontWeight)
        {
            var context = Locator.Current.GetService <Pango.Context>();

            Layout = new Pango.Layout(context);
            Layout.SetText(text);
            Layout.FontDescription = new Pango.FontDescription
            {
                Family = fontFamily,
                Size   = Pango.Units.FromDouble(fontSize * 0.73),
                Style  = (Pango.Style)fontStyle,
                Weight = fontWeight.ToCairo()
            };

            Layout.Alignment = textAlignment.ToCairo();
        }