X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=src%2Ffclist.c;h=d804c150386b5909c9853db9c2a88289c62df107;hb=dffcb2a083bc5f959ed96dbdf0f365ebc0e710cc;hp=3de04a009ec645992fbc9f9c151c41a5a150bacc;hpb=766a9b2f61458202be0fbf5745ce1e02ecd95c6e;p=fontconfig.git diff --git a/src/fclist.c b/src/fclist.c index 3de04a0..d804c15 100644 --- a/src/fclist.c +++ b/src/fclist.c @@ -1,5 +1,5 @@ /* - * $RCSId: xc/lib/fontconfig/src/fclist.c,v 1.11tsi Exp $ + * fontconfig/src/fclist.c * * Copyright © 2000 Keith Packard * @@ -13,9 +13,9 @@ * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR @@ -350,7 +350,10 @@ FcGetDefaultObjectLangIndex (FcPattern *font, FcObject object) if (value.type == FcTypeString) { FcLangResult res = FcLangCompare (value.u.s, lang); - if (res == FcLangEqual || (res == FcLangDifferentCountry && idx < 0)) + if (res == FcLangEqual) + return i; + + if (res == FcLangDifferentCountry && idx < 0) idx = i; } } @@ -457,6 +460,7 @@ FcFontSetList (FcConfig *config, FcListHashTable table; int i; FcListBucket *bucket; + int destroy_os = 0; if (!config) { @@ -468,6 +472,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 +543,8 @@ bail2: bail1: FcListHashTableCleanup (&table); bail0: + if (destroy_os) + FcObjectSetDestroy (os); return 0; } @@ -545,6 +558,9 @@ FcFontList (FcConfig *config, if (!config) { + if (!FcInitBringUptoDate ()) + return 0; + config = FcConfigGetCurrent (); if (!config) return 0;