The per-layout thing can be set using pango_cairo_context_set_resolution(). behdad On 06/11/2009 11:36 AM, Zoltan Boszormenyi wrote:
Hi, I found this call to work OK: pango_cairo_font_map_set_resolution(pango_cairo_font_map_get_default(), gdk_screen_get_resolution(gdk_screen_get_default())); But it seems to me that it's a global setting, not a per layout thing. I can't seem to get a PangoCairoFontMap out of a cairo_t. Thanks, Zoltán Böszörményi Behdad Esfahbod írta:Humm, what happens if you get the PangoContext from the label, create layout, and render to your own cairo_t? Should work. behdad On 06/11/2009 09:56 AM, Zoltan Boszormenyi wrote:Hi, thanks very much, the font now is the same, but it's still a bit larger, see the attached picture. Is there some other option I can apply? Thanks in advance, Zoltán Behdad Esfahbod írta:Try copying setting the font description of the label on your PangoContext. widget->style->font_desc. On 06/11/2009 08:33 AM, Zoltan Boszormenyi wrote:Zoltan Boszormenyi írta:Hi, I need to create a scrolling label widget. I already succeeded marrying gtklabel and gtkimage, I use a Cairo surface and created PangoLayout out of it, I render the label text into the Cairo+Pango layout, I use the expose method used by GtkImage to display the pixbuf in the widget, and added a timer so the pixbuf is scrolled in a double buffered way. Now, the problem is that the text rendered into the pixbuf is much larger than the usual widget texts, like on stock GtkButton and GtkLabel. I attached the screenshot from my example application. How can I copy the PangoContext that a plain widget use? E.g. the following code doesn't seem to work: ================================= label->surface = cairo_image_surface_create_for_data(cairo_data, CAIRO_FORMAT_ARGB32, width, height, rowstride); label->cairo = cairo_create (label->surface); label->layout = pango_cairo_create_layout(label->cairo); /* This is the layout used by GtkLabel, etc. */ layout = gtk_widget_create_pango_layout (GTK_WIDGET (label), "This long string gives a good enough length for any line to have."); pango_cairo_context_set_font_options( pango_layout_get_context(label->layout), pango_cairo_context_get_font_options(pango_layout_get_context(layout))); pango_cairo_update_context(label->cairo, pango_layout_get_context(layout)); pango_layout_context_changed(label->layout); g_object_unref (layout); ================================= What is the proper way to get the same font, fontsize, etc. on a Cairo layout? Thanks in advance, Zoltán BöszörményiThe following code also doesn't work, I get the same large font for my GtkScrollLabel that my previously attached screenshot showed: label->cairo = cairo_create (label->surface); pango_cairo_update_context(label->cairo, gtk_widget_get_pango_context (GTK_WIDGET(label))); label->layout = pango_cairo_create_layout(label->cairo); Is there and easy way to render the text in the same size as GtkLabel's default? Thanks in advance, Zoltán Böszörményi _______________________________________________ gtk-list mailing list gtk-list gnome org http://mail.gnome.org/mailman/listinfo/gtk-list_______________________________________________ gtk-list mailing list gtk-list gnome org http://mail.gnome.org/mailman/listinfo/gtk-list