2002-02-15 00:34:13 +01:00
|
|
|
/*
|
2008-08-12 22:34:24 +02:00
|
|
|
* fontconfig/src/fcdefault.c
|
2002-02-15 00:34:13 +01:00
|
|
|
*
|
2004-12-07 02:14:46 +01:00
|
|
|
* Copyright © 2001 Keith Packard
|
2002-02-15 00:34:13 +01:00
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, distribute, and sell this software and its
|
|
|
|
* documentation for any purpose is hereby granted without fee, provided that
|
|
|
|
* the above copyright notice appear in all copies and that both that
|
|
|
|
* copyright notice and this permission notice appear in supporting
|
2010-11-10 22:45:42 +01:00
|
|
|
* documentation, and that the name of the author(s) not be used in
|
2002-02-15 00:34:13 +01:00
|
|
|
* advertising or publicity pertaining to distribution of the software without
|
2010-11-10 22:45:42 +01:00
|
|
|
* specific, written prior permission. The authors make no
|
2002-02-15 00:34:13 +01:00
|
|
|
* representations about the suitability of this software for any purpose. It
|
|
|
|
* is provided "as is" without express or implied warranty.
|
|
|
|
*
|
2009-03-12 21:00:08 +01:00
|
|
|
* THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
2002-02-15 00:34:13 +01:00
|
|
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
2009-03-12 21:00:08 +01:00
|
|
|
* EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
2002-02-15 00:34:13 +01:00
|
|
|
* 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
|
|
|
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "fcint.h"
|
2013-01-16 08:35:28 +01:00
|
|
|
#include <limits.h>
|
2012-03-29 13:25:20 +02:00
|
|
|
#include <string.h>
|
2002-02-15 00:34:13 +01:00
|
|
|
|
2012-10-07 21:52:25 +02:00
|
|
|
/* MT-safe */
|
|
|
|
|
2006-04-06 06:52:21 +02:00
|
|
|
static const struct {
|
2006-08-30 13:16:22 +02:00
|
|
|
FcObject field;
|
2002-02-15 00:34:13 +01:00
|
|
|
FcBool value;
|
|
|
|
} FcBoolDefaults[] = {
|
2006-08-30 13:16:22 +02:00
|
|
|
{ FC_HINTING_OBJECT, FcTrue }, /* !FT_LOAD_NO_HINTING */
|
|
|
|
{ FC_VERTICAL_LAYOUT_OBJECT, FcFalse }, /* FC_LOAD_VERTICAL_LAYOUT */
|
|
|
|
{ FC_AUTOHINT_OBJECT, FcFalse }, /* FC_LOAD_FORCE_AUTOHINT */
|
|
|
|
{ FC_GLOBAL_ADVANCE_OBJECT, FcTrue }, /* !FC_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH */
|
|
|
|
{ FC_EMBEDDED_BITMAP_OBJECT, FcTrue }, /* !FC_LOAD_NO_BITMAP */
|
2006-09-03 02:52:12 +02:00
|
|
|
{ FC_DECORATIVE_OBJECT, FcFalse },
|
2015-05-19 00:26:03 +02:00
|
|
|
{ FC_SYMBOL_OBJECT, FcFalse },
|
2017-09-12 18:21:05 +02:00
|
|
|
{ FC_VARIABLE_OBJECT, FcFalse },
|
2002-02-15 00:34:13 +01:00
|
|
|
};
|
|
|
|
|
2005-09-23 01:45:53 +02:00
|
|
|
#define NUM_FC_BOOL_DEFAULTS (int) (sizeof FcBoolDefaults / sizeof FcBoolDefaults[0])
|
2002-02-15 00:34:13 +01:00
|
|
|
|
2012-10-07 21:52:25 +02:00
|
|
|
FcStrSet *default_langs;
|
|
|
|
|
2012-03-29 13:25:20 +02:00
|
|
|
FcStrSet *
|
|
|
|
FcGetDefaultLangs (void)
|
2005-10-22 16:21:14 +02:00
|
|
|
{
|
2012-10-07 21:52:25 +02:00
|
|
|
FcStrSet *result;
|
|
|
|
retry:
|
|
|
|
result = (FcStrSet *) fc_atomic_ptr_get (&default_langs);
|
|
|
|
if (!result)
|
2005-10-22 16:21:14 +02:00
|
|
|
{
|
2012-10-07 21:52:25 +02:00
|
|
|
char *langs;
|
|
|
|
|
|
|
|
result = FcStrSetCreate ();
|
|
|
|
|
|
|
|
langs = getenv ("FC_LANG");
|
|
|
|
if (!langs || !langs[0])
|
|
|
|
langs = getenv ("LC_ALL");
|
|
|
|
if (!langs || !langs[0])
|
|
|
|
langs = getenv ("LC_CTYPE");
|
|
|
|
if (!langs || !langs[0])
|
|
|
|
langs = getenv ("LANG");
|
|
|
|
if (langs && langs[0])
|
|
|
|
{
|
|
|
|
if (!FcStrSetAddLangs (result, langs))
|
|
|
|
FcStrSetAdd (result, (const FcChar8 *) "en");
|
|
|
|
}
|
|
|
|
else
|
2012-03-29 13:25:20 +02:00
|
|
|
FcStrSetAdd (result, (const FcChar8 *) "en");
|
2012-10-07 21:52:25 +02:00
|
|
|
|
|
|
|
FcRefSetConst (&result->ref);
|
|
|
|
if (!fc_atomic_ptr_cmpexch (&default_langs, NULL, result)) {
|
|
|
|
FcRefInit (&result->ref, 1);
|
|
|
|
FcStrSetDestroy (result);
|
|
|
|
goto retry;
|
|
|
|
}
|
2005-10-22 16:21:14 +02:00
|
|
|
}
|
2012-03-29 13:25:20 +02:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
2005-10-22 16:21:14 +02:00
|
|
|
|
2012-10-07 21:52:25 +02:00
|
|
|
static FcChar8 *default_lang; /* MT-safe */
|
|
|
|
|
2012-03-29 13:25:20 +02:00
|
|
|
FcChar8 *
|
|
|
|
FcGetDefaultLang (void)
|
|
|
|
{
|
2012-10-07 21:52:25 +02:00
|
|
|
FcChar8 *lang;
|
|
|
|
retry:
|
|
|
|
lang = fc_atomic_ptr_get (&default_lang);
|
|
|
|
if (!lang)
|
2005-10-22 16:21:14 +02:00
|
|
|
{
|
2012-10-07 21:52:25 +02:00
|
|
|
FcStrSet *langs = FcGetDefaultLangs ();
|
2013-01-02 09:06:15 +01:00
|
|
|
lang = FcStrdup (langs->strs[0]);
|
2012-10-07 21:52:25 +02:00
|
|
|
|
|
|
|
if (!fc_atomic_ptr_cmpexch (&default_lang, NULL, lang)) {
|
|
|
|
free (lang);
|
|
|
|
goto retry;
|
|
|
|
}
|
2005-10-22 16:21:14 +02:00
|
|
|
}
|
|
|
|
|
2012-10-07 21:52:25 +02:00
|
|
|
return lang;
|
|
|
|
}
|
|
|
|
|
2013-01-16 03:41:26 +01:00
|
|
|
static FcChar8 *default_prgname;
|
|
|
|
|
|
|
|
FcChar8 *
|
|
|
|
FcGetPrgname (void)
|
|
|
|
{
|
|
|
|
FcChar8 *prgname;
|
|
|
|
retry:
|
|
|
|
prgname = fc_atomic_ptr_get (&default_prgname);
|
|
|
|
if (!prgname)
|
|
|
|
{
|
|
|
|
#ifdef _WIN32
|
|
|
|
char buf[MAX_PATH+1];
|
|
|
|
|
|
|
|
/* TODO This is ASCII-only; fix it. */
|
|
|
|
if (GetModuleFileNameA (GetModuleHandle (NULL), buf, sizeof (buf) / sizeof (buf[0])) > 0)
|
|
|
|
{
|
|
|
|
char *p;
|
|
|
|
unsigned int len;
|
|
|
|
|
|
|
|
p = strrchr (buf, '\\');
|
|
|
|
if (p)
|
|
|
|
p++;
|
|
|
|
else
|
|
|
|
p = buf;
|
|
|
|
|
|
|
|
len = strlen (p);
|
|
|
|
|
|
|
|
if (len > 4 && 0 == strcmp (p + len - 4, ".exe"))
|
|
|
|
{
|
|
|
|
len -= 4;
|
|
|
|
buf[len] = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
prgname = FcStrdup (p);
|
|
|
|
}
|
2013-01-17 04:49:16 +01:00
|
|
|
#elif defined (HAVE_GETPROGNAME)
|
|
|
|
const char *q = getprogname ();
|
|
|
|
if (q)
|
|
|
|
prgname = FcStrdup (q);
|
|
|
|
else
|
|
|
|
prgname = FcStrdup ("");
|
2013-01-16 03:41:26 +01:00
|
|
|
#else
|
2013-01-23 04:32:37 +01:00
|
|
|
# if defined (HAVE_GETEXECNAME)
|
2017-03-01 11:48:02 +01:00
|
|
|
char *p = FcStrdup(getexecname ());
|
2013-12-16 09:44:37 +01:00
|
|
|
# elif defined (HAVE_READLINK)
|
2017-03-01 11:48:02 +01:00
|
|
|
size_t size = FC_PATH_MAX;
|
2013-01-17 04:01:28 +01:00
|
|
|
char *p = NULL;
|
2013-01-16 03:41:26 +01:00
|
|
|
|
2017-03-01 11:48:02 +01:00
|
|
|
while (1)
|
2013-01-16 03:41:26 +01:00
|
|
|
{
|
2017-03-01 11:48:02 +01:00
|
|
|
char *buf = malloc (size);
|
|
|
|
ssize_t len;
|
|
|
|
|
|
|
|
if (!buf)
|
|
|
|
break;
|
|
|
|
|
|
|
|
len = readlink ("/proc/self/exe", buf, size - 1);
|
|
|
|
if (len < 0)
|
|
|
|
{
|
|
|
|
free (buf);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (len < size - 1)
|
|
|
|
{
|
|
|
|
buf[len] = 0;
|
|
|
|
p = buf;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
free (buf);
|
|
|
|
size *= 2;
|
2013-01-17 04:01:28 +01:00
|
|
|
}
|
2013-12-16 09:44:37 +01:00
|
|
|
# else
|
|
|
|
char *p = NULL;
|
2013-01-23 04:32:37 +01:00
|
|
|
# endif
|
2013-01-17 04:01:28 +01:00
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
char *r = strrchr (p, '/');
|
|
|
|
if (r)
|
|
|
|
r++;
|
2013-01-16 03:41:26 +01:00
|
|
|
else
|
2013-01-17 04:01:28 +01:00
|
|
|
r = p;
|
2013-01-16 03:41:26 +01:00
|
|
|
|
2013-01-17 04:01:28 +01:00
|
|
|
prgname = FcStrdup (r);
|
2013-01-16 03:41:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!prgname)
|
|
|
|
prgname = FcStrdup ("");
|
2017-03-01 11:48:02 +01:00
|
|
|
|
|
|
|
if (p)
|
|
|
|
free (p);
|
2013-01-17 04:49:16 +01:00
|
|
|
#endif
|
2013-01-16 03:41:26 +01:00
|
|
|
|
|
|
|
if (!fc_atomic_ptr_cmpexch (&default_prgname, NULL, prgname)) {
|
|
|
|
free (prgname);
|
|
|
|
goto retry;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (prgname && !prgname[0])
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return prgname;
|
|
|
|
}
|
|
|
|
|
2022-11-25 13:15:32 +01:00
|
|
|
static FcChar8 *default_desktop_name;
|
|
|
|
|
|
|
|
FcChar8 *
|
|
|
|
FcGetDesktopName (void)
|
|
|
|
{
|
|
|
|
FcChar8 *desktop_name;
|
|
|
|
retry:
|
|
|
|
desktop_name = fc_atomic_ptr_get (&default_desktop_name);
|
|
|
|
if (!desktop_name)
|
|
|
|
{
|
|
|
|
char *s = getenv ("XDG_CURRENT_DESKTOP");
|
|
|
|
|
|
|
|
if (!s)
|
|
|
|
desktop_name = FcStrdup ("");
|
|
|
|
else
|
|
|
|
desktop_name = FcStrdup (s);
|
|
|
|
if (!desktop_name)
|
|
|
|
{
|
|
|
|
fprintf (stderr, "Fontconfig error: out of memory in %s\n",
|
|
|
|
__FUNCTION__);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!fc_atomic_ptr_cmpexch(&default_desktop_name, NULL, desktop_name))
|
|
|
|
{
|
|
|
|
free (desktop_name);
|
|
|
|
goto retry;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (desktop_name && !desktop_name[0])
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return desktop_name;
|
|
|
|
}
|
|
|
|
|
2012-10-07 21:52:25 +02:00
|
|
|
void
|
|
|
|
FcDefaultFini (void)
|
|
|
|
{
|
2012-10-07 22:26:53 +02:00
|
|
|
FcChar8 *lang;
|
|
|
|
FcStrSet *langs;
|
2013-01-16 03:41:26 +01:00
|
|
|
FcChar8 *prgname;
|
2022-11-25 13:15:32 +01:00
|
|
|
FcChar8 *desktop;
|
2012-10-07 22:26:53 +02:00
|
|
|
|
|
|
|
lang = fc_atomic_ptr_get (&default_lang);
|
2022-11-25 13:15:32 +01:00
|
|
|
if (lang && fc_atomic_ptr_cmpexch (&default_lang, lang, NULL))
|
|
|
|
{
|
2012-10-07 22:26:53 +02:00
|
|
|
free (lang);
|
2012-10-07 21:52:25 +02:00
|
|
|
}
|
2012-10-07 22:26:53 +02:00
|
|
|
|
|
|
|
langs = fc_atomic_ptr_get (&default_langs);
|
2022-11-25 13:15:32 +01:00
|
|
|
if (langs && fc_atomic_ptr_cmpexch (&default_langs, langs, NULL))
|
|
|
|
{
|
2012-10-07 22:26:53 +02:00
|
|
|
FcRefInit (&langs->ref, 1);
|
|
|
|
FcStrSetDestroy (langs);
|
2012-10-07 21:52:25 +02:00
|
|
|
}
|
2013-01-16 03:41:26 +01:00
|
|
|
|
|
|
|
prgname = fc_atomic_ptr_get (&default_prgname);
|
2022-11-25 13:15:32 +01:00
|
|
|
if (prgname && fc_atomic_ptr_cmpexch (&default_prgname, prgname, NULL))
|
|
|
|
{
|
2013-01-16 03:41:26 +01:00
|
|
|
free (prgname);
|
|
|
|
}
|
2022-11-25 13:15:32 +01:00
|
|
|
|
|
|
|
desktop = fc_atomic_ptr_get (&default_desktop_name);
|
|
|
|
if (desktop && fc_atomic_ptr_cmpexch(&default_desktop_name, desktop, NULL))
|
|
|
|
{
|
|
|
|
free (desktop);
|
|
|
|
}
|
2005-10-22 16:21:14 +02:00
|
|
|
}
|
|
|
|
|
2002-02-15 00:34:13 +01:00
|
|
|
void
|
|
|
|
FcDefaultSubstitute (FcPattern *pattern)
|
|
|
|
{
|
2018-05-11 13:48:30 +02:00
|
|
|
FcPatternIter iter;
|
2012-03-26 09:34:34 +02:00
|
|
|
FcValue v, namelang, v2;
|
2002-02-15 00:34:13 +01:00
|
|
|
int i;
|
2013-11-20 10:44:59 +01:00
|
|
|
double dpi, size, scale, pixelsize;
|
2002-02-15 00:34:13 +01:00
|
|
|
|
2018-05-11 13:48:30 +02:00
|
|
|
if (!FcPatternFindObjectIter (pattern, &iter, FC_WEIGHT_OBJECT))
|
2013-10-28 03:54:04 +01:00
|
|
|
FcPatternObjectAddInteger (pattern, FC_WEIGHT_OBJECT, FC_WEIGHT_NORMAL);
|
2007-10-25 10:35:32 +02:00
|
|
|
|
2018-05-11 13:48:30 +02:00
|
|
|
if (!FcPatternFindObjectIter (pattern, &iter, FC_SLANT_OBJECT))
|
2007-10-25 10:35:32 +02:00
|
|
|
FcPatternObjectAddInteger (pattern, FC_SLANT_OBJECT, FC_SLANT_ROMAN);
|
2002-02-15 00:34:13 +01:00
|
|
|
|
2018-05-11 13:48:30 +02:00
|
|
|
if (!FcPatternFindObjectIter (pattern, &iter, FC_WIDTH_OBJECT))
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternObjectAddInteger (pattern, FC_WIDTH_OBJECT, FC_WIDTH_NORMAL);
|
2003-03-12 23:16:43 +01:00
|
|
|
|
2002-02-15 00:34:13 +01:00
|
|
|
for (i = 0; i < NUM_FC_BOOL_DEFAULTS; i++)
|
2018-05-11 13:48:30 +02:00
|
|
|
if (!FcPatternFindObjectIter (pattern, &iter, FcBoolDefaults[i].field))
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternObjectAddBool (pattern, FcBoolDefaults[i].field, FcBoolDefaults[i].value);
|
2010-04-12 18:18:50 +02:00
|
|
|
|
2013-11-20 10:44:59 +01:00
|
|
|
if (FcPatternObjectGetDouble (pattern, FC_SIZE_OBJECT, 0, &size) != FcResultMatch)
|
2017-09-13 01:18:59 +02:00
|
|
|
{
|
|
|
|
FcRange *r;
|
|
|
|
double b, e;
|
|
|
|
if (FcPatternObjectGetRange (pattern, FC_SIZE_OBJECT, 0, &r) == FcResultMatch && FcRangeGetDouble (r, &b, &e))
|
|
|
|
size = (b + e) * .5;
|
|
|
|
else
|
|
|
|
size = 12.0L;
|
|
|
|
}
|
2013-11-20 10:44:59 +01:00
|
|
|
if (FcPatternObjectGetDouble (pattern, FC_SCALE_OBJECT, 0, &scale) != FcResultMatch)
|
|
|
|
scale = 1.0;
|
|
|
|
if (FcPatternObjectGetDouble (pattern, FC_DPI_OBJECT, 0, &dpi) != FcResultMatch)
|
|
|
|
dpi = 75.0;
|
2002-02-15 00:34:13 +01:00
|
|
|
|
2018-05-11 13:48:30 +02:00
|
|
|
if (!FcPatternFindObjectIter (pattern, &iter, FC_PIXEL_SIZE_OBJECT))
|
2013-11-20 10:44:59 +01:00
|
|
|
{
|
|
|
|
(void) FcPatternObjectDel (pattern, FC_SCALE_OBJECT);
|
|
|
|
FcPatternObjectAddDouble (pattern, FC_SCALE_OBJECT, scale);
|
|
|
|
pixelsize = size * scale;
|
|
|
|
(void) FcPatternObjectDel (pattern, FC_DPI_OBJECT);
|
|
|
|
FcPatternObjectAddDouble (pattern, FC_DPI_OBJECT, dpi);
|
|
|
|
pixelsize *= dpi / 72.0;
|
|
|
|
FcPatternObjectAddDouble (pattern, FC_PIXEL_SIZE_OBJECT, pixelsize);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-05-11 13:48:30 +02:00
|
|
|
FcPatternIterGetValue(pattern, &iter, 0, &v, NULL);
|
2013-11-20 10:44:59 +01:00
|
|
|
size = v.u.d;
|
|
|
|
size = size / dpi * 72.0 / scale;
|
2002-02-15 00:34:13 +01:00
|
|
|
}
|
2013-11-20 10:44:59 +01:00
|
|
|
(void) FcPatternObjectDel (pattern, FC_SIZE_OBJECT);
|
|
|
|
FcPatternObjectAddDouble (pattern, FC_SIZE_OBJECT, size);
|
2002-07-10 00:08:14 +02:00
|
|
|
|
2018-05-11 13:48:30 +02:00
|
|
|
if (!FcPatternFindObjectIter (pattern, &iter, FC_FONTVERSION_OBJECT))
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternObjectAddInteger (pattern, FC_FONTVERSION_OBJECT, 0x7fffffff);
|
2003-09-23 22:12:20 +02:00
|
|
|
|
2018-05-11 13:48:30 +02:00
|
|
|
if (!FcPatternFindObjectIter (pattern, &iter, FC_HINT_STYLE_OBJECT))
|
2006-08-30 13:16:22 +02:00
|
|
|
FcPatternObjectAddInteger (pattern, FC_HINT_STYLE_OBJECT, FC_HINT_FULL);
|
2018-05-11 13:48:30 +02:00
|
|
|
|
|
|
|
if (!FcPatternFindObjectIter (pattern, &iter, FC_NAMELANG_OBJECT))
|
2012-03-26 09:34:34 +02:00
|
|
|
FcPatternObjectAddString (pattern, FC_NAMELANG_OBJECT, FcGetDefaultLang ());
|
2018-05-11 13:48:30 +02:00
|
|
|
|
2012-03-26 09:34:34 +02:00
|
|
|
/* shouldn't be failed. */
|
|
|
|
FcPatternObjectGet (pattern, FC_NAMELANG_OBJECT, 0, &namelang);
|
|
|
|
/* Add a fallback to ensure the english name when the requested language
|
|
|
|
* isn't available. this would helps for the fonts that have non-English
|
|
|
|
* name at the beginning.
|
|
|
|
*/
|
|
|
|
/* Set "en-us" instead of "en" to avoid giving higher score to "en".
|
|
|
|
* This is a hack for the case that the orth is not like ll-cc, because,
|
|
|
|
* if no namelang isn't explicitly set, it will has something like ll-cc
|
|
|
|
* according to current locale. which may causes FcLangDifferentTerritory
|
|
|
|
* at FcLangCompare(). thus, the English name is selected so that
|
|
|
|
* exact matched "en" has higher score than ll-cc.
|
|
|
|
*/
|
|
|
|
v2.type = FcTypeString;
|
2013-01-16 03:41:26 +01:00
|
|
|
v2.u.s = (FcChar8 *) "en-us";
|
2018-05-11 13:48:30 +02:00
|
|
|
if (!FcPatternFindObjectIter (pattern, &iter, FC_FAMILYLANG_OBJECT))
|
2012-03-26 09:34:34 +02:00
|
|
|
{
|
|
|
|
FcPatternObjectAdd (pattern, FC_FAMILYLANG_OBJECT, namelang, FcTrue);
|
|
|
|
FcPatternObjectAddWithBinding (pattern, FC_FAMILYLANG_OBJECT, v2, FcValueBindingWeak, FcTrue);
|
|
|
|
}
|
2018-05-11 13:48:30 +02:00
|
|
|
if (!FcPatternFindObjectIter (pattern, &iter, FC_STYLELANG_OBJECT))
|
2012-03-26 09:34:34 +02:00
|
|
|
{
|
|
|
|
FcPatternObjectAdd (pattern, FC_STYLELANG_OBJECT, namelang, FcTrue);
|
|
|
|
FcPatternObjectAddWithBinding (pattern, FC_STYLELANG_OBJECT, v2, FcValueBindingWeak, FcTrue);
|
|
|
|
}
|
2018-05-11 13:48:30 +02:00
|
|
|
if (!FcPatternFindObjectIter (pattern, &iter, FC_FULLNAMELANG_OBJECT))
|
2012-03-26 09:34:34 +02:00
|
|
|
{
|
|
|
|
FcPatternObjectAdd (pattern, FC_FULLNAMELANG_OBJECT, namelang, FcTrue);
|
|
|
|
FcPatternObjectAddWithBinding (pattern, FC_FULLNAMELANG_OBJECT, v2, FcValueBindingWeak, FcTrue);
|
|
|
|
}
|
2013-01-16 03:41:26 +01:00
|
|
|
|
|
|
|
if (FcPatternObjectGet (pattern, FC_PRGNAME_OBJECT, 0, &v) == FcResultNoMatch)
|
|
|
|
{
|
|
|
|
FcChar8 *prgname = FcGetPrgname ();
|
|
|
|
if (prgname)
|
|
|
|
FcPatternObjectAddString (pattern, FC_PRGNAME_OBJECT, prgname);
|
|
|
|
}
|
2020-05-25 11:22:18 +02:00
|
|
|
|
2022-11-25 13:15:32 +01:00
|
|
|
if (FcPatternObjectGet (pattern, FC_DESKTOP_NAME_OBJECT, 0, &v) == FcResultNoMatch)
|
|
|
|
{
|
|
|
|
FcChar8 *desktop = FcGetDesktopName ();
|
|
|
|
if (desktop)
|
|
|
|
FcPatternObjectAddString (pattern, FC_DESKTOP_NAME_OBJECT, desktop);
|
|
|
|
}
|
|
|
|
|
2020-05-25 11:22:18 +02:00
|
|
|
if (!FcPatternFindObjectIter (pattern, &iter, FC_ORDER_OBJECT))
|
|
|
|
FcPatternObjectAddInteger (pattern, FC_ORDER_OBJECT, 0);
|
2002-02-15 00:34:13 +01:00
|
|
|
}
|
2006-09-05 11:24:01 +02:00
|
|
|
#define __fcdefault__
|
|
|
|
#include "fcaliastail.h"
|
|
|
|
#undef __fcdefault__
|