summaryrefslogtreecommitdiff
path: root/pango/modules.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2000-02-16 22:05:43 +0000
committerOwen Taylor <otaylor@src.gnome.org>2000-02-16 22:05:43 +0000
commit7f846326d416e9ab3eadca9f02b9a0129095f30b (patch)
tree4b2812b858cd830ca1282e3697d029ca347df24a /pango/modules.c
parent4f335d6e4a3f5b4e6ddd1cd78f919aa80c990262 (diff)
downloadpango-7f846326d416e9ab3eadca9f02b9a0129095f30b.tar.gz
Make refcounted.
Wed Feb 16 16:39:46 2000 Owen Taylor <otaylor@redhat.com> * libpango/pango-coverage.c (pango_coverage_get): Make refcounted. * libpango/modules.c (struct _PangoEnginePair): Since we don't currently unload engines, cache loaded engines. (Not really quite satisfactory, but should work OK) * libpango/pango-context.c (pango_context_get_font_description): Added a global font description. * libpango/modules.c (_pango_find_map): Allow NULL language tags. * libpango/pango-context.c (pango_itemize) examples/viewer.c: Switch itemize over to take a PangoAttrList. * examples/viewer.c: Conform to changes in itemization interface * libpango/font.[ch]: Add a compare function for FontDescription * libpango/pango-attributes.[ch]: Change the iteration iterface to be more convenient. * libpango/pango-context.[ch]: Add the ability to set a default font. * libpango/pango-context.[ch]: Take the font for itemization from the attributes on the text. * libpango/pangox.c: Cache currently loaded fonts, and cache coverages.
Diffstat (limited to 'pango/modules.c')
-rw-r--r--pango/modules.c55
1 files changed, 30 insertions, 25 deletions
diff --git a/pango/modules.c b/pango/modules.c
index 36040000..f2433ca8 100644
--- a/pango/modules.c
+++ b/pango/modules.c
@@ -34,15 +34,16 @@ typedef struct _PangoEnginePair PangoEnginePair;
struct _PangoMapInfo
{
- gchar *lang;
- gchar *engine_type;
- gchar *render_type;
+ const gchar *lang;
+ const gchar *engine_type;
+ const gchar *render_type;
};
struct _PangoEnginePair
{
- gchar *module;
PangoEngineInfo info;
+ gchar *module;
+ PangoEngine *engine;
};
GList *engines;
@@ -67,9 +68,9 @@ _pango_find_map (const char *lang,
map_hash = g_hash_table_new ((GHashFunc)map_info_hash,
(GCompareFunc)map_info_equal);
- map_info.lang = (char *)lang;
- map_info.engine_type = (char *)engine_type;
- map_info.render_type = (char *)render_type;
+ map_info.lang = lang ? lang : "NONE";
+ map_info.engine_type = engine_type;
+ map_info.render_type = render_type;
map = g_hash_table_lookup (map_hash, &map_info);
if (!map)
@@ -103,28 +104,30 @@ _pango_load_engine (const char *id)
{
GModule *module;
PangoEngine *(*load) (const gchar *id);
- PangoEngine *engine;
-
- module = g_module_open (pair->module, 0);
- if (!module)
- {
- fprintf(stderr, "Cannot load module %s: %s\n",
- pair->module, g_module_error());
- return NULL;
- }
- g_module_symbol (module, "script_engine_load", (gpointer)&load);
- if (!load)
+ if (!pair->engine)
{
- fprintf(stderr, "cannot retrieve script_engine_load from %s: %s\n",
- pair->module, g_module_error());
- g_module_close (module);
- return NULL;
+ module = g_module_open (pair->module, 0);
+ if (!module)
+ {
+ fprintf(stderr, "Cannot load module %s: %s\n",
+ pair->module, g_module_error());
+ return NULL;
+ }
+
+ g_module_symbol (module, "script_engine_load", (gpointer)&load);
+ if (!load)
+ {
+ fprintf(stderr, "cannot retrieve script_engine_load from %s: %s\n",
+ pair->module, g_module_error());
+ g_module_close (module);
+ return NULL;
+ }
+
+ pair->engine = (*load) (id);
}
- engine = (*load) (id);
-
- return engine;
+ return pair->engine;
}
}
@@ -291,6 +294,8 @@ read_modules (void)
g_list_free (ranges);
g_free (line);
+ pair->engine = NULL;
+
engines = g_list_prepend (engines, pair);
}
engines = g_list_reverse (engines);