Re: pango-cairo backward compat
- From: Allin Cottrell <cottrell wfu edu>
- To: Behdad Esfahbod <behdad behdad org>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: pango-cairo backward compat
- Date: Thu, 5 Nov 2009 19:20:16 -0500 (EST)
On Thu, 5 Nov 2009, Behdad Esfahbod wrote:
On 11/05/2009 05:37 PM, Allin Cottrell wrote:
I'm trying to write a function in such a way that (a) it doesn't
use currently deprecated code if that's avoidable while (b) it
builds OK against earlier versions of pango. I'd be grateful if
any pango expert could take a quick look at this and see if
anything looks wrong:
PangoLayout *gp_cairo_create_layout (void)
{
static PangoFontMap *fontmap;
PangoContext *context;
PangoLayout *layout;
if (fontmap == NULL) {
fontmap = pango_cairo_font_map_new_for_font_type(CAIRO_FONT_TYPE_FT);
if (fontmap == NULL) {
fontmap = pango_cairo_font_map_get_default();
}
}
#if PANGO_VERSION_MAJOR> 1 || PANGO_VERSION_MINOR>= 22
context = pango_font_map_create_context(fontmap);
#else
context = pango_cairo_font_map_create_context((PangoCairoFontMap *)
fontmap);
#endif
layout = pango_layout_new(context);
g_object_unref(context);
return layout;
}
My main concern is whether the cast from PangoFontMap to
PangoCairoFontMap is kosher.
Yes, that's fine.
Excellent, thanks for confirming that.
Allin Cottrell
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]