Ejemplo n.º 1
0
        public FontManager()
        {
            families = new List <FontFamily> ();

            using (Pango.Context c = PangoHelper.ContextGet())
                families.AddRange(c.Families);
        }
Ejemplo n.º 2
0
        ///<summary>Constructor</summary>
        public Drawer(Gtk.Widget wid, Information inf)
        {
            widget    = wid;
            info      = inf;
            pixmapIds = new StringCollection();
            // make sure highlight colors are set
            info.SetupHighlight(wid);

            fontDescription = Pango.FontDescription.FromString(info.FontName);
            Pango.Language lang = Pango.Language.FromString(info.FontLanguage);

            Pango.Context pangoCtx = widget.PangoContext;
            pangoCtx.FontDescription = fontDescription;
            pangoCtx.Language        = lang;

            // set the font height and width
            pangoLayout = new Pango.Layout(pangoCtx);
            // we use a monospaced font, the actual character doesn't matter
            pangoLayout.SetText("X");
            pangoLayout.GetPixelSize(out width, out height);
            pangoLayout.SetText("");

            // create the font pixmaps
            InitializePixmaps();

            InitializeBackgroundGCs();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Sets the graphics target.
        /// </summary>
        /// <param name="graphics">The graphics surface.</param>
        public void SetGraphicsTarget(Cairo.Context graphics)
        {
            this.g           = graphics;
            this.g.Antialias = Antialias.Subpixel; // TODO  .TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
#if GTKSHARP3
            this.c = Pango.CairoHelper.CreateContext(this.g);
#endif
        }
Ejemplo n.º 4
0
		public override bool RegisterFontFromFile (string fontPath)
		{
			var result = AddFontFile (fontPath);
			if (result) {
				pango_cairo_font_map_set_default (System.IntPtr.Zero);
				systemContext = Gdk.PangoHelper.ContextGet ();
			}
			return result;
		}
Ejemplo n.º 5
0
        public override bool RegisterFontFromFile(string fontPath)
        {
            var result = AddFontFile(fontPath);

            if (result)
            {
                pango_cairo_font_map_set_default(System.IntPtr.Zero);
                systemContext = Gdk.PangoHelper.ContextGet();
            }
            return(result);
        }
Ejemplo n.º 6
0
        // Used by GeneratePDF
        public CairoContext(Cairo.Surface s, string font, int dpis) : base(s)
        {
            layout           = Pango.CairoHelper.CreateLayout(this);
            font_description = layout.FontDescription = FontDescription.FromString(font);

            if (dpis > 0)
            {
                Pango.Context c = layout.Context;
                Pango.CairoHelper.ContextSetResolution(c, dpis);
                c.Dispose();
            }
            FontLineSpace = def_linespace;
        }
Ejemplo n.º 7
0
 public static int MeasureTextHeight (this FontDescription description, Context context, Language language)
 {
     using (var metrics = context.GetMetrics (description, language)) {
         return ((int)(metrics.Ascent + metrics.Descent) + 512) >> 10; // PANGO_PIXELS (d)
     }
 }
Ejemplo n.º 8
0
 public static int MeasureTextHeight (this FontDescription description, Context context)
 {
     return MeasureTextHeight (description, context, context.Language);
 }
Ejemplo n.º 9
0
 static GtkFontBackendHandler()
 {
     systemContext = Gdk.PangoHelper.ContextGet ();
 }
Ejemplo n.º 10
0
 static GtkFontBackendHandler()
 {
     systemContext = Gdk.PangoHelper.ContextGet();
 }
Ejemplo n.º 11
0
 static TextBase()
 {
     using var surf  = new ImageSurface(Format.RGB24, 1, 1);
     using var ctx   = new Cairo.Context(surf);
     _defaultContext = Pango.CairoHelper.CreateContext(ctx);
 }