diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2008-08-13 02:24:42 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2009-02-13 16:53:56 -0800 |
commit | 29874098537e763e8e4cd3fefb1ecc0f36b808a5 (patch) | |
tree | 89c21bdd57d49373ab772d23c55fd40b9ab9320a /src | |
parent | 77c0d8bce86ca088782d5631617c0ef681d91312 (diff) |
Implement fc-list --verbose (#13015)
A private FcObjectGetSet() is implemented that provides an
FcObjectSet of all registered elements. FcFontSetList() is
then modified to use the object set from FcObjectGetSet() if
provided object-set is NULL.
Alternatively FcObjectGetSet() can be made public. In that
case fc-list can use that as a base if --verbose is included,
and also add any elements provided by the user (though that has
no effect, as all elements from the cache are already registered).
Currently fc-list ignores user-provided elements if --verbose
is specified.
Diffstat (limited to 'src')
-rw-r--r-- | src/fcint.h | 3 | ||||
-rw-r--r-- | src/fclist.c | 10 | ||||
-rw-r--r-- | src/fcname.c | 14 |
3 files changed, 27 insertions, 0 deletions
diff --git a/src/fcint.h b/src/fcint.h index fe59947..5798702 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -863,6 +863,9 @@ FcObjectFromName (const char * name); FcPrivate const char * FcObjectName (FcObject object); +FcPrivate FcObjectSet * +FcObjectGetSet (void); + FcPrivate FcBool FcObjectInit (void); diff --git a/src/fclist.c b/src/fclist.c index a0306ca..2a53b79 100644 --- a/src/fclist.c +++ b/src/fclist.c @@ -457,6 +457,7 @@ FcFontSetList (FcConfig *config, FcListHashTable table; int i; FcListBucket *bucket; + int destroy_os = 0; if (!config) { @@ -468,6 +469,13 @@ FcFontSetList (FcConfig *config, goto bail0; } FcListHashTableInit (&table); + + if (!os) + { + os = FcObjectGetSet (); + destroy_os = 1; + } + /* * Walk all available fonts adding those that * match to the hash table @@ -532,6 +540,8 @@ bail2: bail1: FcListHashTableCleanup (&table); bail0: + if (destroy_os) + FcObjectSetDestroy (os); return 0; } diff --git a/src/fcname.c b/src/fcname.c index 51544de..0815cf3 100644 --- a/src/fcname.c +++ b/src/fcname.c @@ -327,6 +327,20 @@ FcObjectFromName (const char * name) return 0; } +FcObjectSet * +FcObjectGetSet (void) +{ + int i; + FcObjectSet *os = NULL; + + + os = FcObjectSetCreate (); + for (i = 0; i < FcObjectsNumber; i++) + FcObjectSetAdd (os, FcObjects[i].object); + + return os; +} + FcBool FcObjectInit (void) { |