Пример #1
0
        public FontManager()
        {
            families = new List <FontFamily> ();

            using (Pango.Context c = PangoHelper.ContextGet())
                families.AddRange(c.Families);
        }
Пример #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();
        }
Пример #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
        }
Пример #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;
		}
Пример #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);
        }
Пример #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;
        }
Пример #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)
     }
 }
Пример #8
0
 public static int MeasureTextHeight (this FontDescription description, Context context)
 {
     return MeasureTextHeight (description, context, context.Language);
 }
Пример #9
0
 static GtkFontBackendHandler()
 {
     systemContext = Gdk.PangoHelper.ContextGet ();
 }
Пример #10
0
 static GtkFontBackendHandler()
 {
     systemContext = Gdk.PangoHelper.ContextGet();
 }
Пример #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);
 }