void dia_font_finalize(GObject* object) { DiaFont* font = DIA_FONT(object); if (font->pfd) pango_font_description_free(font->pfd); font->pfd = NULL; if (font->metrics) pango_font_metrics_unref(font->metrics); font->metrics = NULL; if (font->loaded) g_object_unref(font->loaded); font->loaded = NULL; G_OBJECT_CLASS(parent_class)->finalize(object); }
DiaFont* dia_font_new_from_style(DiaFontStyle style, real height) { DiaFont* retval; /* in the future we could establish Dia's own default font * matching to be as (font-)system independent as possible. * For now fall back to Pangos configuration --hb */ PangoFontDescription* pfd = pango_font_description_new(); dia_pfd_set_family(pfd,DIA_FONT_STYLE_GET_FAMILY(style)); dia_pfd_set_weight(pfd,DIA_FONT_STYLE_GET_WEIGHT(style)); dia_pfd_set_slant(pfd,DIA_FONT_STYLE_GET_SLANT(style)); dia_pfd_set_height(pfd,height); retval = DIA_FONT(g_object_new(DIA_TYPE_FONT, NULL)); retval->pfd = pfd; _dia_font_adjust_size (retval, height, FALSE); retval->legacy_name = NULL; return retval; }