summaryrefslogtreecommitdiff
path: root/pango/pangox-fontcache.c
diff options
context:
space:
mode:
Diffstat (limited to 'pango/pangox-fontcache.c')
-rw-r--r--pango/pangox-fontcache.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/pango/pangox-fontcache.c b/pango/pangox-fontcache.c
index 301d8b2f..ed556e74 100644
--- a/pango/pangox-fontcache.c
+++ b/pango/pangox-fontcache.c
@@ -34,7 +34,7 @@ typedef struct _CacheEntry CacheEntry;
struct _PangoXFontCache
{
Display *display;
-
+
GHashTable *forward;
GHashTable *back;
@@ -66,7 +66,7 @@ free_cache_entry (char *xlfd,
/**
* pango_x_font_cache_free:
* @cache: a #PangoXFontCache
- *
+ *
* Frees a #PangoXFontCache and all associated memory. All fonts loaded
* through this font cache will be freed along with the cache.
**/
@@ -74,9 +74,9 @@ void
pango_x_font_cache_free (PangoXFontCache *cache)
{
g_return_if_fail (cache != NULL);
-
+
g_hash_table_foreach (cache->forward, (GHFunc)free_cache_entry, cache);
-
+
g_hash_table_destroy (cache->forward);
g_hash_table_destroy (cache->back);
@@ -86,9 +86,9 @@ pango_x_font_cache_free (PangoXFontCache *cache)
/**
* pango_x_font_cache_new:
* @display: an X display.
- *
+ *
* Creates a font cache for the specified display.
- *
+ *
* Return value: The newly allocated #PangoXFontCache, which should be
* freed with pango_x_font_cache_free().
**/
@@ -98,18 +98,18 @@ pango_x_font_cache_new (Display *display)
PangoXFontCache *cache;
g_return_val_if_fail (display != NULL, NULL);
-
+
cache = g_new (PangoXFontCache, 1);
cache->display = display;
-
+
cache->forward = g_hash_table_new (g_str_hash, g_str_equal);
cache->back = g_hash_table_new (g_direct_hash, g_direct_equal);
-
+
cache->mru = NULL;
cache->mru_tail = NULL;
cache->mru_count = 0;
-
+
return cache;
}
@@ -130,11 +130,11 @@ cache_entry_unref (PangoXFontCache *cache, CacheEntry *entry)
* pango_x_font_cache_load:
* @cache: a #PangoXFontCache
* @xlfd: the X Logical Font Description to load.
- *
+ *
* Loads a #XFontStruct from a X Logical Font Description. The
* result may be newly loaded, or it may have been previously
* stored.
- *
+ *
* Return value: The font structure, or %NULL if the font could
* not be loaded. In order to free this structure, you must call
* pango_x_font_cache_unload().
@@ -160,7 +160,7 @@ pango_x_font_cache_load (PangoXFontCache *cache,
if (!fs)
return NULL;
-
+
entry = g_new (CacheEntry, 1);
entry->xlfd = g_strdup (xlfd);
@@ -170,15 +170,15 @@ pango_x_font_cache_load (PangoXFontCache *cache,
entry->mru = NULL;
g_hash_table_insert (cache->forward, entry->xlfd, entry);
- g_hash_table_insert (cache->back, entry->fs, entry);
+ g_hash_table_insert (cache->back, entry->fs, entry);
}
-
+
if (entry->mru)
{
if (cache->mru_count > 1 && entry->mru->prev)
{
/* Move to the head of the mru list */
-
+
if (entry->mru == cache->mru_tail)
{
cache->mru_tail = cache->mru_tail->prev;
@@ -189,7 +189,7 @@ pango_x_font_cache_load (PangoXFontCache *cache,
entry->mru->prev->next = entry->mru->next;
entry->mru->next->prev = entry->mru->prev;
}
-
+
entry->mru->next = cache->mru;
entry->mru->prev = NULL;
cache->mru->prev = entry->mru;
@@ -199,13 +199,13 @@ pango_x_font_cache_load (PangoXFontCache *cache,
else
{
entry->ref_count++;
-
+
/* Insert into the mru list */
-
+
if (cache->mru_count == CACHE_SIZE)
{
CacheEntry *old_entry = cache->mru_tail->data;
-
+
cache->mru_tail = cache->mru_tail->prev;
cache->mru_tail->next = NULL;
@@ -229,7 +229,7 @@ pango_x_font_cache_load (PangoXFontCache *cache,
* pango_x_font_cache_unload:
* @cache: a #PangoXFontCache
* @fs: the font structure to unload
- *
+ *
* Frees a font structure previously loaded with pango_x_font_cache_load().
**/
void
@@ -244,5 +244,5 @@ pango_x_font_cache_unload (PangoXFontCache *cache,
entry = g_hash_table_lookup (cache->back, fs);
g_return_if_fail (entry != NULL);
- cache_entry_unref (cache, entry);
+ cache_entry_unref (cache, entry);
}