public Pango.Weight GetWeight(Pango.Weight defaultWeight)
 {
     if (defaultWeight == Pango.Weight.Bold)
     {
         return(Bold ? Pango.Weight.Heavy : Pango.Weight.Bold);
     }
     return(Bold ? Pango.Weight.Bold : Pango.Weight.Normal);
 }
Exemple #2
0
        public static bool ParseWeight(string str, out Pango.Weight weight, bool warn)
        {
            IntPtr native_str = GLib.Marshaller.StringToPtrGStrdup(str);
            int    native_weight;
            bool   raw_ret = pango_parse_weight(native_str, out native_weight, warn);
            bool   ret     = raw_ret;

            GLib.Marshaller.Free(native_str);
            weight = (Pango.Weight)native_weight;
            return(ret);
        }
Exemple #3
0
        // Pango Style sounds like some sort of dance
        private static FontStyle FromPangoStyle(Pango.Style pangoStyle, Pango.Weight pangoWeight)
        {
            FontStyle result = FontStyle.Regular;

            if (pangoWeight == Pango.Weight.Bold)
            {
                result |= FontStyle.Bold;
            }

            if (pangoStyle == Pango.Style.Italic)
            {
                result |= FontStyle.Italic;
            }

            return(FontStyle.Regular);
        }
Exemple #4
0
 void AppendThreads(TreeIter it, ProcessInfo p)
 {
     ThreadInfo[] threads = p.GetThreads();
     Array.Sort(threads, delegate(ThreadInfo t1, ThreadInfo t2) {
         return(t1.Id.CompareTo(t2.Id));
     });
     foreach (ThreadInfo t in threads)
     {
         ThreadInfo   activeThread = DebuggingService.DebuggerSession.ActiveThread;
         Pango.Weight wi           = t == activeThread ? Pango.Weight.Bold : Pango.Weight.Normal;
         string       icon         = t == activeThread ? Gtk.Stock.GoForward : null;
         if (it.Equals(TreeIter.Zero))
         {
             store.AppendValues(icon, t.Id.ToString(), t.Name, t, (int)wi, t.Location);
         }
         else
         {
             store.AppendValues(it, icon, t.Id.ToString(), t.Name, t, (int)wi, t.Location);
         }
     }
 }
 static extern IntPtr pango_attr_weight_new(Pango.Weight weight);
 public void AddWeightAttribute(Pango.Weight weight, uint start, uint end)
 {
     Add(pango_attr_weight_new(weight), start, end);
 }
Exemple #7
0
        public static string FormatText(string fontFace, int fontSize, Pango.Weight weight, string color, string text)
        {
            var format = Styles.GetFormatString(fontFace, fontSize, color, weight);

            return(string.Format(format, GLib.Markup.EscapeText(text)));
        }
Exemple #8
0
 protected virtual void DrawLayout(Cairo.Context ctx, Pango.Layout layout, string fontFace, int fontSize, Pango.Weight weight, string color, int tx, int ty)
 {
     ctx.MoveTo(tx, ty);
     Pango.CairoHelper.ShowLayout(ctx, layout);
 }
Exemple #9
0
 public AttrWeight(Pango.Weight weight) : this(pango_attr_weight_new(weight))
 {
 }
 public static void OverrideFont(this Container container, string fontFamily = MainFont, Pango.Weight fontWeight = Pango.Weight.Normal)
 {
     foreach (var child in container.AllChildren)
     {
         var ct = child.GetType();
         if (ct == typeof(Label) || ct == typeof(Entry) || ct == typeof(CheckButton))
         {
             (child as Widget).OverrideFont(fontFamily, fontWeight);
         }
         else if (ct == typeof(CellView))
         {
             (child as Widget).OverrideFont(fontFamily, fontWeight);
         }
         else if (child as Notebook != null)
         {
             (child as Notebook).OverrideFont();
         }
         else if (child as NodeView != null)
         {
             (child as NodeView).OverrideFont();
         }
         else if (child as Container != null)
         {
             (child as Container).OverrideFont(fontFamily, fontWeight);
         }
     }
 }
    private static void OverrideFont(this Widget widget, string fontFamily = MainFont, Pango.Weight weight = Pango.Weight.Normal)
    {
        if (fontFamily == null)
        {
            fontFamily = MainFont;
        }
        var font = Pango.FontDescription.FromString(fontFamily);

        if (fontFamily != null)
        {
            font.Family = fontFamily;
        }
        font.Weight = weight;
        widget?.ModifyFont(font);
    }
Exemple #12
0
 public static string GetFormatString(string fontFace, int fontSize, string color, Pango.Weight weight = Pango.Weight.Normal)
 {
     return("<span font=\"" + fontFace + " " + fontSize + "px\" foreground=\"" + color + "\" font_weight=\"" + weight + "\">{0}</span>");
 }
Exemple #13
0
 private static Cairo.FontWeight PangoToCairoWeight(Pango.Weight weight)
 {
     return((weight == Pango.Weight.Bold) ? Cairo.FontWeight.Bold : Cairo.FontWeight.Normal);
 }