Hi,
I have got a GtkDrawingArea, I am drawing with cairo and pango.
GtkSettings *settings;
PangoLayout *layout;
PangoFontDescription *desc;
PangoRectangle ink_rect, logical_rect;
gchar *font_name;
gchar *note_str;
const gchar* note_strv[] = {
"𝅝",
"𝅗𝅥",
"𝅘𝅥",
"𝅘𝅥𝅮",
"𝅘𝅥𝅯",
NULL,
};
const gdouble font_size = 12.5;
const gdouble key_font_size = 12.5;
const gdouble x0 = 0.0;
const gdouble y0 = 0.0;
settings = gtk_settings_get_default();
font_name = NULL;
g_object_get(settings,
"gtk-font-name", &font_name,
NULL);
note_str = note_strv[2];
if(note_str != NULL){
layout = pango_cairo_create_layout(cr);
pango_layout_set_text(layout,
note_str,
-1);
desc = pango_font_description_from_string(font_name);
pango_font_description_set_size(desc,
key_font_size * PANGO_SCALE);
pango_layout_set_font_description(layout,
desc);
pango_font_description_free(desc);
pango_layout_get_extents(layout,
&ink_rect,
&logical_rect);
cairo_move_to(cr,
x0,
y0);
pango_cairo_show_layout(cr,
layout);
g_object_unref(layout);
}
If I call cairo_scale() then it scales additional layouts it shouldn’t. Howto prevent this?
I tried cairo_push_group() but this didn’t work as expected.
Just for reference my complete code:
best regards,
Joël