From 48a16fa8090b67b046b2bb686ff4f6f038a2b8e8 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Tue, 4 Jun 2002 00:20:51 +0000 Subject: [PATCH] on Jun 3 18:56:09 2002 Owen Taylor Xft2 and fontconfig conversion, based largely on a patch from Keith Packard. * configure.in acconfig.h: Add checks for fontconfig, switch Xft checks to switch for Xft2 using pkg-config. * pangoxft.pc.in pangoxft.pc.in modules/{arabic,basic,hebrew,indic,tamil}/Makefile.am pango/Makefile.am: Reflect new Xft/fontconfig dependencies. * pango/pangoxft-private.h pango/pangoxft-fontmap.c modules/arabic/arabic-xft.c modules/indic/indic-xft.c: Switch over to using Xft2 and fontconfig. * pango/pangoft2.c pango/pangoft2-fontmap.c pango/pangoft2-private.h pango/pango/Makefile.am: Remove usage of mini-xft in favor of fontconfig. * pango/pango-ot.h pango/opentype/pango-ot-info.c pango/pangoxft.h modules/arabic/arabic-{xft,ft2}.c modules/indic/indic-xft.c: Attach OpenType information directly to the FT_Face structure using FT_Generic. * modules/tamil/Makefile.am modules/tamil/tamil-xft.c configure.in: Remove this module, no longer needed. * pango/pangoxft-font.c (pango_xft_real_render): Coalesce calls to Xft rendering functions. --- src/pango-ot-info.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/pango-ot-info.c b/src/pango-ot-info.c index 95d8dce5c..f32f141da 100644 --- a/src/pango-ot-info.c +++ b/src/pango-ot-info.c @@ -94,21 +94,38 @@ pango_ot_info_finalize (GObject *object) } } +void +pango_ot_info_finalizer (void *object) +{ + FT_Face face = object; + PangoOTInfo *info = face->generic.data; + + info->face = NULL; + g_object_unref (info); +} + /** * pango_ot_info_new: * @face: a #FT_Face. - * @returns: a new #PangoOTInfo for @face. + * @returns: the #PangoOTInfo for @face. This object will + * have the same lifetime as FT_Face. * - * Creates a new #PangoOTInfo structure for the given FreeType font. + * Returns the #PangoOTInfo structure for the given FreeType font. **/ PangoOTInfo * -pango_ot_info_new (FT_Face face) +pango_ot_info_get (FT_Face face) { PangoOTInfo *info; - info = g_object_new (PANGO_TYPE_OT_INFO, NULL); - - info->face = face; + if (face->generic.data) + return face->generic.data; + else + { + info = face->generic.data = g_object_new (PANGO_TYPE_OT_INFO, NULL); + face->generic.finalizer = pango_ot_info_finalizer; + + info->face = face; + } return info; }