public FontManager() { families = new List <FontFamily> (); using (Pango.Context c = PangoHelper.ContextGet()) families.AddRange(c.Families); }
///<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(); }
/// <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 }
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; }
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); }
// 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; }
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) } }
public static int MeasureTextHeight (this FontDescription description, Context context) { return MeasureTextHeight (description, context, context.Language); }
static GtkFontBackendHandler() { systemContext = Gdk.PangoHelper.ContextGet (); }
static GtkFontBackendHandler() { systemContext = Gdk.PangoHelper.ContextGet(); }
static TextBase() { using var surf = new ImageSurface(Format.RGB24, 1, 1); using var ctx = new Cairo.Context(surf); _defaultContext = Pango.CairoHelper.CreateContext(ctx); }