summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog16
-rw-r--r--ChangeLog.pre-1-016
-rw-r--r--ChangeLog.pre-1-1016
-rw-r--r--ChangeLog.pre-1-216
-rw-r--r--ChangeLog.pre-1-416
-rw-r--r--ChangeLog.pre-1-616
-rw-r--r--ChangeLog.pre-1-816
-rw-r--r--pango/pangox-fontmap.c73
-rw-r--r--pango/pangox-private.h3
-rw-r--r--pango/pangox.c21
-rw-r--r--pango/pangox.h3
11 files changed, 178 insertions, 34 deletions
diff --git a/ChangeLog b/ChangeLog
index 1e91c40e..f586901a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,22 @@
-Mon Jun 5 15:35:03 2000 Owen Taylor <otaylor@redhat.com>
+Mon Jun 5 20:45:12 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangox-fontmap.c (pango_x_shutdown_display): Add
+ a function to free cached information for a particular
+ display. (This is basically pango_x_fontmap_destroy())
+
+ * pango/pangox.c pango/pangox-private.h pango/pangox-fontmap.c:
+ Make a XFont always keep a pointer to (and ref) a fontmap.
+
+Mon Jun 5 15:56:25 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangox-fontmap.c (pango_x_font_map_for_display): Remove
+ excessive ref.
* pango/pangox-fontcache.c (pango_x_font_cache_unload): Fix
problem with unloading fonts.
* pango/pangox-fontmap.c pango/pangox-private.h pangox/pangox.c:
- Add a simple PangoXFont; get rid of the eternal caching of
+ Add a simple cache for PangoXFonts; get rid of the eternal caching of
all fonts.
Wed May 31 16:11:46 2000 Owen Taylor <otaylor@redhat.com>
diff --git a/ChangeLog.pre-1-0 b/ChangeLog.pre-1-0
index 1e91c40e..f586901a 100644
--- a/ChangeLog.pre-1-0
+++ b/ChangeLog.pre-1-0
@@ -1,10 +1,22 @@
-Mon Jun 5 15:35:03 2000 Owen Taylor <otaylor@redhat.com>
+Mon Jun 5 20:45:12 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangox-fontmap.c (pango_x_shutdown_display): Add
+ a function to free cached information for a particular
+ display. (This is basically pango_x_fontmap_destroy())
+
+ * pango/pangox.c pango/pangox-private.h pango/pangox-fontmap.c:
+ Make a XFont always keep a pointer to (and ref) a fontmap.
+
+Mon Jun 5 15:56:25 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangox-fontmap.c (pango_x_font_map_for_display): Remove
+ excessive ref.
* pango/pangox-fontcache.c (pango_x_font_cache_unload): Fix
problem with unloading fonts.
* pango/pangox-fontmap.c pango/pangox-private.h pangox/pangox.c:
- Add a simple PangoXFont; get rid of the eternal caching of
+ Add a simple cache for PangoXFonts; get rid of the eternal caching of
all fonts.
Wed May 31 16:11:46 2000 Owen Taylor <otaylor@redhat.com>
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index 1e91c40e..f586901a 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,10 +1,22 @@
-Mon Jun 5 15:35:03 2000 Owen Taylor <otaylor@redhat.com>
+Mon Jun 5 20:45:12 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangox-fontmap.c (pango_x_shutdown_display): Add
+ a function to free cached information for a particular
+ display. (This is basically pango_x_fontmap_destroy())
+
+ * pango/pangox.c pango/pangox-private.h pango/pangox-fontmap.c:
+ Make a XFont always keep a pointer to (and ref) a fontmap.
+
+Mon Jun 5 15:56:25 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangox-fontmap.c (pango_x_font_map_for_display): Remove
+ excessive ref.
* pango/pangox-fontcache.c (pango_x_font_cache_unload): Fix
problem with unloading fonts.
* pango/pangox-fontmap.c pango/pangox-private.h pangox/pangox.c:
- Add a simple PangoXFont; get rid of the eternal caching of
+ Add a simple cache for PangoXFonts; get rid of the eternal caching of
all fonts.
Wed May 31 16:11:46 2000 Owen Taylor <otaylor@redhat.com>
diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2
index 1e91c40e..f586901a 100644
--- a/ChangeLog.pre-1-2
+++ b/ChangeLog.pre-1-2
@@ -1,10 +1,22 @@
-Mon Jun 5 15:35:03 2000 Owen Taylor <otaylor@redhat.com>
+Mon Jun 5 20:45:12 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangox-fontmap.c (pango_x_shutdown_display): Add
+ a function to free cached information for a particular
+ display. (This is basically pango_x_fontmap_destroy())
+
+ * pango/pangox.c pango/pangox-private.h pango/pangox-fontmap.c:
+ Make a XFont always keep a pointer to (and ref) a fontmap.
+
+Mon Jun 5 15:56:25 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangox-fontmap.c (pango_x_font_map_for_display): Remove
+ excessive ref.
* pango/pangox-fontcache.c (pango_x_font_cache_unload): Fix
problem with unloading fonts.
* pango/pangox-fontmap.c pango/pangox-private.h pangox/pangox.c:
- Add a simple PangoXFont; get rid of the eternal caching of
+ Add a simple cache for PangoXFonts; get rid of the eternal caching of
all fonts.
Wed May 31 16:11:46 2000 Owen Taylor <otaylor@redhat.com>
diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4
index 1e91c40e..f586901a 100644
--- a/ChangeLog.pre-1-4
+++ b/ChangeLog.pre-1-4
@@ -1,10 +1,22 @@
-Mon Jun 5 15:35:03 2000 Owen Taylor <otaylor@redhat.com>
+Mon Jun 5 20:45:12 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangox-fontmap.c (pango_x_shutdown_display): Add
+ a function to free cached information for a particular
+ display. (This is basically pango_x_fontmap_destroy())
+
+ * pango/pangox.c pango/pangox-private.h pango/pangox-fontmap.c:
+ Make a XFont always keep a pointer to (and ref) a fontmap.
+
+Mon Jun 5 15:56:25 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangox-fontmap.c (pango_x_font_map_for_display): Remove
+ excessive ref.
* pango/pangox-fontcache.c (pango_x_font_cache_unload): Fix
problem with unloading fonts.
* pango/pangox-fontmap.c pango/pangox-private.h pangox/pangox.c:
- Add a simple PangoXFont; get rid of the eternal caching of
+ Add a simple cache for PangoXFonts; get rid of the eternal caching of
all fonts.
Wed May 31 16:11:46 2000 Owen Taylor <otaylor@redhat.com>
diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6
index 1e91c40e..f586901a 100644
--- a/ChangeLog.pre-1-6
+++ b/ChangeLog.pre-1-6
@@ -1,10 +1,22 @@
-Mon Jun 5 15:35:03 2000 Owen Taylor <otaylor@redhat.com>
+Mon Jun 5 20:45:12 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangox-fontmap.c (pango_x_shutdown_display): Add
+ a function to free cached information for a particular
+ display. (This is basically pango_x_fontmap_destroy())
+
+ * pango/pangox.c pango/pangox-private.h pango/pangox-fontmap.c:
+ Make a XFont always keep a pointer to (and ref) a fontmap.
+
+Mon Jun 5 15:56:25 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangox-fontmap.c (pango_x_font_map_for_display): Remove
+ excessive ref.
* pango/pangox-fontcache.c (pango_x_font_cache_unload): Fix
problem with unloading fonts.
* pango/pangox-fontmap.c pango/pangox-private.h pangox/pangox.c:
- Add a simple PangoXFont; get rid of the eternal caching of
+ Add a simple cache for PangoXFonts; get rid of the eternal caching of
all fonts.
Wed May 31 16:11:46 2000 Owen Taylor <otaylor@redhat.com>
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index 1e91c40e..f586901a 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,10 +1,22 @@
-Mon Jun 5 15:35:03 2000 Owen Taylor <otaylor@redhat.com>
+Mon Jun 5 20:45:12 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangox-fontmap.c (pango_x_shutdown_display): Add
+ a function to free cached information for a particular
+ display. (This is basically pango_x_fontmap_destroy())
+
+ * pango/pangox.c pango/pangox-private.h pango/pangox-fontmap.c:
+ Make a XFont always keep a pointer to (and ref) a fontmap.
+
+Mon Jun 5 15:56:25 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangox-fontmap.c (pango_x_font_map_for_display): Remove
+ excessive ref.
* pango/pangox-fontcache.c (pango_x_font_cache_unload): Fix
problem with unloading fonts.
* pango/pangox-fontmap.c pango/pangox-private.h pangox/pangox.c:
- Add a simple PangoXFont; get rid of the eternal caching of
+ Add a simple cache for PangoXFonts; get rid of the eternal caching of
all fonts.
Wed May 31 16:11:46 2000 Owen Taylor <otaylor@redhat.com>
diff --git a/pango/pangox-fontmap.c b/pango/pangox-fontmap.c
index 6309387a..2727c0f5 100644
--- a/pango/pangox-fontmap.c
+++ b/pango/pangox-fontmap.c
@@ -161,7 +161,8 @@ static void pango_x_font_map_list_families (PangoFontMap *
gchar ***families,
int *n_families);
-static void pango_x_font_map_read_aliases (PangoXFontMap *xfontmap);
+static void pango_x_fontmap_cache_clear (PangoXFontMap *xfontmap);
+static void pango_x_font_map_read_aliases (PangoXFontMap *xfontmap);
static gint pango_x_get_size (PangoXFontMap *fontmap,
const char *fontname);
@@ -173,6 +174,8 @@ static char * pango_x_get_xlfd_field (const char *fontname,
char *buffer);
static char * pango_x_get_identifier (const char *fontname);
+static PangoFontClass *parent_class; /* Parent class structure for PangoXFontMap */
+
static GType
pango_x_font_map_get_type (void)
{
@@ -215,6 +218,8 @@ pango_x_font_map_class_init (PangoXFontMapClass *class)
GObjectClass *object_class = G_OBJECT_CLASS (class);
PangoFontMapClass *font_map_class = PANGO_FONT_MAP_CLASS (class);
+ parent_class = g_type_class_peek_parent (class);
+
object_class->finalize = pango_x_font_map_finalize;
font_map_class->load_font = pango_x_font_map_load_font;
font_map_class->list_fonts = pango_x_font_map_list_fonts;
@@ -232,6 +237,8 @@ pango_x_font_map_for_display (Display *display)
int num_fonts, i;
int screen;
+ g_return_val_if_fail (display != NULL, NULL);
+
/* Make sure that the type system is initialized */
g_type_init();
@@ -240,9 +247,7 @@ pango_x_font_map_for_display (Display *display)
xfontmap = tmp_list->data;
if (xfontmap->display == display)
- {
- return PANGO_FONT_MAP (xfontmap);
- }
+ return PANGO_FONT_MAP (xfontmap);
}
xfontmap = (PangoXFontMap *)g_type_create_instance (PANGO_TYPE_X_FONT_MAP);
@@ -270,7 +275,6 @@ pango_x_font_map_for_display (Display *display)
pango_x_font_map_read_aliases (xfontmap);
- g_object_ref (G_OBJECT (xfontmap));
fontmaps = g_list_prepend (fontmaps, xfontmap);
/* This is a little screwed up, since different screens on the same display
@@ -279,21 +283,54 @@ pango_x_font_map_for_display (Display *display)
screen = DefaultScreen (xfontmap->display);
xfontmap->resolution = (PANGO_SCALE * 72.27 / 25.4) * ((double) DisplayWidthMM (xfontmap->display, screen) /
DisplayWidth (xfontmap->display, screen));
+
return PANGO_FONT_MAP (xfontmap);
}
+/**
+ * pango_x_shutdown_display:
+ * @display: an X #Display
+ *
+ * Free cached resources for the given X display structure.
+ **/
+void
+pango_x_shutdown_display (Display *display)
+{
+ GList *tmp_list;
+
+ g_return_if_fail (display != NULL);
+
+ tmp_list = fontmaps;
+ while (tmp_list)
+ {
+ PangoXFontMap *xfontmap = tmp_list->data;
+
+ if (xfontmap->display == display)
+ {
+ fontmaps = g_list_delete_link (fontmaps, tmp_list);
+ pango_x_fontmap_cache_clear (xfontmap);
+ g_object_unref (G_OBJECT (xfontmap));
+ }
+
+ tmp_list = tmp_list->next;
+ }
+}
+
static void
pango_x_font_map_finalize (GObject *object)
{
PangoXFontMap *xfontmap = PANGO_X_FONT_MAP (object);
- pango_x_font_cache_free (xfontmap->font_cache);
g_list_foreach (xfontmap->freed_fonts->head, (GFunc)g_object_unref, NULL);
g_queue_free (xfontmap->freed_fonts);
+ pango_x_font_cache_free (xfontmap->font_cache);
+
/* FIXME: Lots more here */
+
+ fontmaps = g_list_remove (fontmaps, xfontmap);
- fontmaps = g_list_remove (fontmaps, object);
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
typedef struct
@@ -492,7 +529,7 @@ pango_x_font_map_load_font (PangoFontMap *fontmap,
if (!result)
{
- PangoXFont *xfont = pango_x_font_new (xfontmap->display, best_match->xlfd, description->size);
+ PangoXFont *xfont = pango_x_font_new (fontmap, best_match->xlfd, description->size);
xfont->fontmap = fontmap;
xfont->entry = best_match;
@@ -1412,6 +1449,15 @@ pango_x_font_map_get_font_cache (PangoFontMap *font_map)
return PANGO_X_FONT_MAP (font_map)->font_cache;
}
+Display *
+pango_x_fontmap_get_display (PangoFontMap *fontmap)
+{
+ g_return_val_if_fail (fontmap != NULL, NULL);
+ g_return_val_if_fail (PANGO_X_IS_FONT_MAP (fontmap), NULL);
+
+ return PANGO_X_FONT_MAP (fontmap)->display;
+}
+
void
pango_x_fontmap_cache_add (PangoFontMap *fontmap,
PangoXFont *xfont)
@@ -1449,3 +1495,14 @@ pango_x_fontmap_cache_remove (PangoFontMap *fontmap,
g_object_unref (G_OBJECT (xfont));
}
+
+static void
+pango_x_fontmap_cache_clear (PangoXFontMap *xfontmap)
+{
+ g_list_foreach (xfontmap->freed_fonts->head, (GFunc)g_object_unref, NULL);
+ g_list_free (xfontmap->freed_fonts->head);
+ xfontmap->freed_fonts->head = NULL;
+ xfontmap->freed_fonts->tail = NULL;
+ xfontmap->freed_fonts->length = 0;
+}
+
diff --git a/pango/pangox-private.h b/pango/pangox-private.h
index 5d90c186..7d581178 100644
--- a/pango/pangox-private.h
+++ b/pango/pangox-private.h
@@ -60,7 +60,7 @@ struct _PangoXFont
PangoXFontEntry *entry; /* Used to remove cached fonts */
};
-PangoXFont * pango_x_font_new (Display *display,
+PangoXFont * pango_x_font_new (PangoFontMap *fontmap,
const char *spec,
int size);
PangoMap * pango_x_get_shaper_map (const char *lang);
@@ -74,6 +74,7 @@ PangoCoverage *pango_x_font_entry_get_coverage (PangoXFontEntry *entry,
void pango_x_font_entry_remove (PangoXFontEntry *entry,
PangoFont *font);
+Display * pango_x_fontmap_get_display (PangoFontMap *fontmap);
void pango_x_fontmap_cache_add (PangoFontMap *fontmap,
PangoXFont *xfont);
void pango_x_fontmap_cache_remove (PangoFontMap *fontmap,
diff --git a/pango/pangox.c b/pango/pangox.c
index 9110ace1..37ab9c7c 100644
--- a/pango/pangox.c
+++ b/pango/pangox.c
@@ -128,11 +128,9 @@ static void
pango_x_make_font_struct (PangoFont *font, PangoXSubfontInfo *info)
{
PangoXFont *xfont = (PangoXFont *)font;
- PangoFontMap *fontmap;
PangoXFontCache *cache;
- fontmap = pango_x_font_map_for_display (xfont->display);
- cache = pango_x_font_map_get_font_cache (fontmap);
+ cache = pango_x_font_map_get_font_cache (xfont->fontmap);
info->font_struct = pango_x_font_cache_load (cache, info->xlfd);
if (!info->font_struct)
@@ -266,16 +264,18 @@ pango_x_font_class_init (PangoXFontClass *class)
}
PangoXFont *
-pango_x_font_new (Display *display, const char *spec, int size)
+pango_x_font_new (PangoFontMap *fontmap, const char *spec, int size)
{
PangoXFont *result;
- g_return_val_if_fail (display != NULL, NULL);
+ g_return_val_if_fail (fontmap != NULL, NULL);
g_return_val_if_fail (spec != NULL, NULL);
result = (PangoXFont *)g_type_create_instance (PANGO_TYPE_X_FONT);
- result->display = display;
+ result->fontmap = fontmap;
+ g_object_ref (G_OBJECT (fontmap));
+ result->display = pango_x_fontmap_get_display (fontmap);
result->fonts = g_strsplit(spec, ",", -1);
for (result->n_fonts = 0; result->fonts[result->n_fonts]; result->n_fonts++)
@@ -305,7 +305,7 @@ pango_x_load_font (Display *display,
g_return_val_if_fail (display != NULL, NULL);
g_return_val_if_fail (spec != NULL, NULL);
- result = pango_x_font_new (display, spec, -1);
+ result = pango_x_font_new (pango_x_font_map_for_display (display), spec, -1);
return (PangoFont *)result;
}
@@ -916,7 +916,7 @@ pango_x_font_shutdown (GObject *object)
* if it is already there, do nothing and the font will be
* freed.
*/
- if (!xfont->in_cache)
+ if (!xfont->in_cache && xfont->fontmap)
pango_x_fontmap_cache_add (xfont->fontmap, xfont);
G_OBJECT_CLASS (parent_class)->shutdown (object);
@@ -934,8 +934,7 @@ static void
pango_x_font_finalize (GObject *object)
{
PangoXFont *xfont = (PangoXFont *)object;
- PangoFontMap *fontmap = pango_x_font_map_for_display (xfont->display);
- PangoXFontCache *cache = pango_x_font_map_get_font_cache (fontmap);
+ PangoXFontCache *cache = pango_x_font_map_get_font_cache (xfont->fontmap);
int i;
@@ -962,6 +961,8 @@ pango_x_font_finalize (GObject *object)
if (xfont->entry)
pango_x_font_entry_remove (xfont->entry, (PangoFont *)xfont);
+ g_object_unref (G_OBJECT (xfont->fontmap));
+
g_strfreev (xfont->fonts);
G_OBJECT_CLASS (parent_class)->finalize (object);
diff --git a/pango/pangox.h b/pango/pangox.h
index 5e44ab30..43750708 100644
--- a/pango/pangox.h
+++ b/pango/pangox.h
@@ -95,7 +95,8 @@ XFontStruct * pango_x_font_cache_load (PangoXFontCache *cache,
void pango_x_font_cache_unload (PangoXFontCache *cache,
XFontStruct *fs);
-PangoFontMap * pango_x_font_map_for_display (Display *display);
+PangoFontMap * pango_x_font_map_for_display (Display *display);
+void pango_x_shutdown_display (Display *display);
PangoXFontCache *pango_x_font_map_get_font_cache (PangoFontMap *font_map);
char *pango_x_font_subfont_xlfd (PangoFont *font,