Fix weird first/not-first lameness in font matches, replacing with target
qualifiers on test elements. Update library manual page.
This commit is contained in:
parent
80a7d66439
commit
938bc63358
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $XFree86: xc/lib/fontconfig/fontconfig/fcprivate.h,v 1.2 2002/02/15 06:01:27 keithp Exp $
|
* $XFree86: xc/lib/fontconfig/fontconfig/fcprivate.h,v 1.3 2002/05/31 23:21:24 keithp Exp $
|
||||||
*
|
*
|
||||||
* Copyright Š 2001 Keith Packard, member of The XFree86 Project, Inc.
|
* Copyright Š 2001 Keith Packard, member of The XFree86 Project, Inc.
|
||||||
*
|
*
|
||||||
|
@ -72,6 +72,9 @@
|
||||||
break; \
|
break; \
|
||||||
case FcTypeFTFace: \
|
case FcTypeFTFace: \
|
||||||
__v__.u.f = va_arg (va, FT_Face); \
|
__v__.u.f = va_arg (va, FT_Face); \
|
||||||
|
break; \
|
||||||
|
case FcTypePattern: \
|
||||||
|
__v__.u.p = va_arg (va, FcPattern *); \
|
||||||
} \
|
} \
|
||||||
if (!FcPatternAdd (__p__, __o__, __v__, FcTrue)) \
|
if (!FcPatternAdd (__p__, __o__, __v__, FcTrue)) \
|
||||||
goto _FcPatternVapBuild_bail1; \
|
goto _FcPatternVapBuild_bail1; \
|
||||||
|
|
|
@ -71,6 +71,7 @@ typedef int FcBool;
|
||||||
#define FC_SOURCE "source" /* String (X11, freetype) */
|
#define FC_SOURCE "source" /* String (X11, freetype) */
|
||||||
#define FC_CHARSET "charset" /* CharSet */
|
#define FC_CHARSET "charset" /* CharSet */
|
||||||
#define FC_LANG "lang" /* String OS/2 CodePageRange */
|
#define FC_LANG "lang" /* String OS/2 CodePageRange */
|
||||||
|
#define FC_PATTERN "pattern" /* FcPattern */
|
||||||
|
|
||||||
#define FC_DIR_CACHE_FILE "fonts.cache"
|
#define FC_DIR_CACHE_FILE "fonts.cache"
|
||||||
#define FC_USER_CACHE_FILE ".fonts.cache"
|
#define FC_USER_CACHE_FILE ".fonts.cache"
|
||||||
|
@ -109,7 +110,8 @@ typedef enum _FcType {
|
||||||
FcTypeBool,
|
FcTypeBool,
|
||||||
FcTypeMatrix,
|
FcTypeMatrix,
|
||||||
FcTypeCharSet,
|
FcTypeCharSet,
|
||||||
FcTypeFTFace
|
FcTypeFTFace,
|
||||||
|
FcTypePattern
|
||||||
} FcType;
|
} FcType;
|
||||||
|
|
||||||
typedef struct _FcMatrix {
|
typedef struct _FcMatrix {
|
||||||
|
@ -141,6 +143,8 @@ typedef enum _FcResult {
|
||||||
FcResultMatch, FcResultNoMatch, FcResultTypeMismatch, FcResultNoId
|
FcResultMatch, FcResultNoMatch, FcResultTypeMismatch, FcResultNoId
|
||||||
} FcResult;
|
} FcResult;
|
||||||
|
|
||||||
|
typedef struct _FcPattern FcPattern;
|
||||||
|
|
||||||
typedef struct _FcValue {
|
typedef struct _FcValue {
|
||||||
FcType type;
|
FcType type;
|
||||||
union {
|
union {
|
||||||
|
@ -151,11 +155,10 @@ typedef struct _FcValue {
|
||||||
const FcMatrix *m;
|
const FcMatrix *m;
|
||||||
const FcCharSet *c;
|
const FcCharSet *c;
|
||||||
void *f;
|
void *f;
|
||||||
|
const FcPattern *p;
|
||||||
} u;
|
} u;
|
||||||
} FcValue;
|
} FcValue;
|
||||||
|
|
||||||
typedef struct _FcPattern FcPattern;
|
|
||||||
|
|
||||||
typedef struct _FcFontSet {
|
typedef struct _FcFontSet {
|
||||||
int nfont;
|
int nfont;
|
||||||
int sfont;
|
int sfont;
|
||||||
|
@ -336,13 +339,13 @@ FcCharSetNextPage (const FcCharSet *a,
|
||||||
|
|
||||||
/* fcdbg.c */
|
/* fcdbg.c */
|
||||||
void
|
void
|
||||||
FcValuePrint (FcValue v);
|
FcValuePrint (const FcValue v);
|
||||||
|
|
||||||
void
|
void
|
||||||
FcPatternPrint (FcPattern *p);
|
FcPatternPrint (const FcPattern *p);
|
||||||
|
|
||||||
void
|
void
|
||||||
FcFontSetPrint (FcFontSet *s);
|
FcFontSetPrint (const FcFontSet *s);
|
||||||
|
|
||||||
/* fcdefault.c */
|
/* fcdefault.c */
|
||||||
void
|
void
|
||||||
|
@ -602,6 +605,9 @@ FcPatternAddCharSet (FcPattern *p, const char *object, const FcCharSet *c);
|
||||||
FcBool
|
FcBool
|
||||||
FcPatternAddBool (FcPattern *p, const char *object, FcBool b);
|
FcPatternAddBool (FcPattern *p, const char *object, FcBool b);
|
||||||
|
|
||||||
|
FcBool
|
||||||
|
FcPatternAddPattern (FcPattern *p, const char *object, const FcPattern *pp);
|
||||||
|
|
||||||
FcResult
|
FcResult
|
||||||
FcPatternGetInteger (FcPattern *p, const char *object, int n, int *i);
|
FcPatternGetInteger (FcPattern *p, const char *object, int n, int *i);
|
||||||
|
|
||||||
|
@ -620,6 +626,9 @@ FcPatternGetCharSet (FcPattern *p, const char *object, int n, FcCharSet **c);
|
||||||
FcResult
|
FcResult
|
||||||
FcPatternGetBool (FcPattern *p, const char *object, int n, FcBool *b);
|
FcPatternGetBool (FcPattern *p, const char *object, int n, FcBool *b);
|
||||||
|
|
||||||
|
FcResult
|
||||||
|
FcPatternGetPattern (FcPattern *p, const char *object, int n, FcPattern **pp);
|
||||||
|
|
||||||
FcPattern *
|
FcPattern *
|
||||||
FcPatternVaBuild (FcPattern *orig, va_list va);
|
FcPatternVaBuild (FcPattern *orig, va_list va);
|
||||||
|
|
||||||
|
|
|
@ -127,6 +127,11 @@
|
||||||
-->
|
-->
|
||||||
<include ignore_missing="yes">~/.fonts.conf</include>
|
<include ignore_missing="yes">~/.fonts.conf</include>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Load local system customization file
|
||||||
|
-->
|
||||||
|
<include ignore_missing="yes">local.conf</include>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Alias well known font names to available TrueType fonts
|
Alias well known font names to available TrueType fonts
|
||||||
-->
|
-->
|
||||||
|
@ -197,11 +202,11 @@
|
||||||
|
|
||||||
<match target="font">
|
<match target="font">
|
||||||
<!-- check to see if the font is roman -->
|
<!-- check to see if the font is roman -->
|
||||||
<test qual="first" name="slant">
|
<test name="slant">
|
||||||
<const>roman</const>
|
<const>roman</const>
|
||||||
</test>
|
</test>
|
||||||
<!-- check to see if the pattern requested non-roman -->
|
<!-- check to see if the pattern requested non-roman -->
|
||||||
<test qual="not_first" name="slant" compare="not_eq">
|
<test target="pattern" name="slant" compare="not_eq">
|
||||||
<const>roman</const>
|
<const>roman</const>
|
||||||
</test>
|
</test>
|
||||||
<!-- multiply the matrix to slant the font -->
|
<!-- multiply the matrix to slant the font -->
|
||||||
|
|
|
@ -112,11 +112,15 @@
|
||||||
if 'qual' is 'first', then the match succeeds only if the first value matches.
|
if 'qual' is 'first', then the match succeeds only if the first value matches.
|
||||||
if 'qual' is 'not_first', then the match succeeds only if any value other than
|
if 'qual' is 'not_first', then the match succeeds only if any value other than
|
||||||
the first matches.
|
the first matches.
|
||||||
|
For match elements with target=font, if test 'target' is 'pattern',
|
||||||
|
then the test is applied to the pattern used in matching rather than
|
||||||
|
to the resulting font.
|
||||||
-->
|
-->
|
||||||
<!ELEMENT test (%expr;)*>
|
<!ELEMENT test (%expr;)*>
|
||||||
<!ATTLIST test
|
<!ATTLIST test
|
||||||
qual (any|all|first|not_first) "any"
|
qual (any|all|first|not_first) "any"
|
||||||
name CDATA #REQUIRED
|
name CDATA #REQUIRED
|
||||||
|
target (pattern|font|default) "default"
|
||||||
compare (eq|not_eq|less|less_eq|more|more_eq) "eq">
|
compare (eq|not_eq|less|less_eq|more|more_eq) "eq">
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
142
src/fccfg.c
142
src/fccfg.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $XFree86: xc/lib/fontconfig/src/fccfg.c,v 1.15 2002/06/21 06:14:45 keithp Exp $
|
* $XFree86: xc/lib/fontconfig/src/fccfg.c,v 1.18 2002/07/31 01:36:37 keithp Exp $
|
||||||
*
|
*
|
||||||
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
|
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
|
||||||
*
|
*
|
||||||
|
@ -438,16 +438,20 @@ FcConfigAddEdit (FcConfig *config,
|
||||||
subst->next = 0;
|
subst->next = 0;
|
||||||
subst->test = test;
|
subst->test = test;
|
||||||
subst->edit = edit;
|
subst->edit = edit;
|
||||||
|
num = 0;
|
||||||
|
for (t = test; t; t = t->next)
|
||||||
|
{
|
||||||
|
if (t->kind == FcMatchDefault)
|
||||||
|
t->kind = kind;
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
if (config->maxObjects < num)
|
||||||
|
config->maxObjects = num;
|
||||||
if (FcDebug () & FC_DBG_EDIT)
|
if (FcDebug () & FC_DBG_EDIT)
|
||||||
{
|
{
|
||||||
printf ("Add Subst ");
|
printf ("Add Subst ");
|
||||||
FcSubstPrint (subst);
|
FcSubstPrint (subst);
|
||||||
}
|
}
|
||||||
num = 0;
|
|
||||||
for (t = test; t; t = t->next)
|
|
||||||
num++;
|
|
||||||
if (config->maxObjects < num)
|
|
||||||
config->maxObjects = num;
|
|
||||||
return FcTrue;
|
return FcTrue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,7 +487,6 @@ FcConfigCompareValue (FcValue m,
|
||||||
v = FcConfigPromote (v, m);
|
v = FcConfigPromote (v, m);
|
||||||
if (m.type == v.type)
|
if (m.type == v.type)
|
||||||
{
|
{
|
||||||
ret = FcFalse;
|
|
||||||
switch (m.type) {
|
switch (m.type) {
|
||||||
case FcTypeInteger:
|
case FcTypeInteger:
|
||||||
break; /* FcConfigPromote prevents this from happening */
|
break; /* FcConfigPromote prevents this from happening */
|
||||||
|
@ -588,6 +591,19 @@ FcConfigCompareValue (FcValue m,
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case FcTypePattern:
|
||||||
|
switch (op) {
|
||||||
|
case FcOpEqual:
|
||||||
|
ret = FcPatternEqual (m.u.p, v.u.p);
|
||||||
|
break;
|
||||||
|
case FcOpNotEqual:
|
||||||
|
ret = !FcPatternEqual (m.u.p, v.u.p);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -658,15 +674,22 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
|
||||||
v.type = FcTypeVoid;
|
v.type = FcTypeVoid;
|
||||||
FcValueDestroy (vl);
|
FcValueDestroy (vl);
|
||||||
break;
|
break;
|
||||||
case FcOpOr:
|
|
||||||
case FcOpAnd:
|
|
||||||
case FcOpEqual:
|
|
||||||
case FcOpContains:
|
case FcOpContains:
|
||||||
case FcOpNotEqual:
|
case FcOpNotEqual:
|
||||||
case FcOpLess:
|
case FcOpLess:
|
||||||
case FcOpLessEqual:
|
case FcOpLessEqual:
|
||||||
case FcOpMore:
|
case FcOpMore:
|
||||||
case FcOpMoreEqual:
|
case FcOpMoreEqual:
|
||||||
|
vl = FcConfigEvaluate (p, e->u.tree.left);
|
||||||
|
vr = FcConfigEvaluate (p, e->u.tree.right);
|
||||||
|
v.type = FcTypeBool;
|
||||||
|
v.u.b = FcConfigCompareValue (vl, e->op, vr);
|
||||||
|
FcValueDestroy (vl);
|
||||||
|
FcValueDestroy (vr);
|
||||||
|
break;
|
||||||
|
case FcOpOr:
|
||||||
|
case FcOpAnd:
|
||||||
|
case FcOpEqual:
|
||||||
case FcOpPlus:
|
case FcOpPlus:
|
||||||
case FcOpMinus:
|
case FcOpMinus:
|
||||||
case FcOpTimes:
|
case FcOpTimes:
|
||||||
|
@ -696,31 +719,6 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
|
||||||
v.type = FcTypeDouble;
|
v.type = FcTypeDouble;
|
||||||
v.u.d = vl.u.d / vr.u.d;
|
v.u.d = vl.u.d / vr.u.d;
|
||||||
break;
|
break;
|
||||||
case FcOpEqual:
|
|
||||||
case FcOpContains:
|
|
||||||
v.type = FcTypeBool;
|
|
||||||
v.u.b = vl.u.d == vr.u.d;
|
|
||||||
break;
|
|
||||||
case FcOpNotEqual:
|
|
||||||
v.type = FcTypeBool;
|
|
||||||
v.u.b = vl.u.d != vr.u.d;
|
|
||||||
break;
|
|
||||||
case FcOpLess:
|
|
||||||
v.type = FcTypeBool;
|
|
||||||
v.u.b = vl.u.d < vr.u.d;
|
|
||||||
break;
|
|
||||||
case FcOpLessEqual:
|
|
||||||
v.type = FcTypeBool;
|
|
||||||
v.u.b = vl.u.d <= vr.u.d;
|
|
||||||
break;
|
|
||||||
case FcOpMore:
|
|
||||||
v.type = FcTypeBool;
|
|
||||||
v.u.b = vl.u.d > vr.u.d;
|
|
||||||
break;
|
|
||||||
case FcOpMoreEqual:
|
|
||||||
v.type = FcTypeBool;
|
|
||||||
v.u.b = vl.u.d >= vr.u.d;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
v.type = FcTypeVoid;
|
v.type = FcTypeVoid;
|
||||||
break;
|
break;
|
||||||
|
@ -742,15 +740,6 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
|
||||||
v.type = FcTypeBool;
|
v.type = FcTypeBool;
|
||||||
v.u.b = vl.u.b && vr.u.b;
|
v.u.b = vl.u.b && vr.u.b;
|
||||||
break;
|
break;
|
||||||
case FcOpEqual:
|
|
||||||
case FcOpContains:
|
|
||||||
v.type = FcTypeBool;
|
|
||||||
v.u.b = vl.u.b == vr.u.b;
|
|
||||||
break;
|
|
||||||
case FcOpNotEqual:
|
|
||||||
v.type = FcTypeBool;
|
|
||||||
v.u.b = vl.u.b != vr.u.b;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
v.type = FcTypeVoid;
|
v.type = FcTypeVoid;
|
||||||
break;
|
break;
|
||||||
|
@ -758,15 +747,6 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
|
||||||
break;
|
break;
|
||||||
case FcTypeString:
|
case FcTypeString:
|
||||||
switch (e->op) {
|
switch (e->op) {
|
||||||
case FcOpEqual:
|
|
||||||
case FcOpContains:
|
|
||||||
v.type = FcTypeBool;
|
|
||||||
v.u.b = FcStrCmpIgnoreCase (vl.u.s, vr.u.s) == 0;
|
|
||||||
break;
|
|
||||||
case FcOpNotEqual:
|
|
||||||
v.type = FcTypeBool;
|
|
||||||
v.u.b = FcStrCmpIgnoreCase (vl.u.s, vr.u.s) != 0;
|
|
||||||
break;
|
|
||||||
case FcOpPlus:
|
case FcOpPlus:
|
||||||
v.type = FcTypeString;
|
v.type = FcTypeString;
|
||||||
v.u.s = FcStrPlus (vl.u.s, vr.u.s);
|
v.u.s = FcStrPlus (vl.u.s, vr.u.s);
|
||||||
|
@ -780,15 +760,6 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
|
||||||
break;
|
break;
|
||||||
case FcTypeMatrix:
|
case FcTypeMatrix:
|
||||||
switch (e->op) {
|
switch (e->op) {
|
||||||
case FcOpEqual:
|
|
||||||
case FcOpContains:
|
|
||||||
v.type = FcTypeBool;
|
|
||||||
v.u.b = FcMatrixEqual (vl.u.m, vr.u.m);
|
|
||||||
break;
|
|
||||||
case FcOpNotEqual:
|
|
||||||
v.type = FcTypeBool;
|
|
||||||
v.u.b = FcMatrixEqual (vl.u.m, vr.u.m);
|
|
||||||
break;
|
|
||||||
case FcOpTimes:
|
case FcOpTimes:
|
||||||
v.type = FcTypeMatrix;
|
v.type = FcTypeMatrix;
|
||||||
m = malloc (sizeof (FcMatrix));
|
m = malloc (sizeof (FcMatrix));
|
||||||
|
@ -808,26 +779,6 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FcTypeCharSet:
|
|
||||||
switch (e->op) {
|
|
||||||
case FcOpContains:
|
|
||||||
/* vl contains vr if vr is a subset of vl */
|
|
||||||
v.type = FcTypeBool;
|
|
||||||
v.u.b = FcCharSetIsSubset (vr.u.c, vl.u.c);
|
|
||||||
break;
|
|
||||||
case FcOpEqual:
|
|
||||||
v.type = FcTypeBool;
|
|
||||||
v.u.b = FcCharSetEqual (vl.u.c, vr.u.c);
|
|
||||||
break;
|
|
||||||
case FcOpNotEqual:
|
|
||||||
v.type = FcTypeBool;
|
|
||||||
v.u.b = !FcCharSetEqual (vl.u.c, vr.u.c);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
v.type = FcTypeVoid;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
v.type = FcTypeVoid;
|
v.type = FcTypeVoid;
|
||||||
break;
|
break;
|
||||||
|
@ -1068,6 +1019,8 @@ FcConfigSubstitute (FcConfig *config,
|
||||||
FcTest *t;
|
FcTest *t;
|
||||||
FcEdit *e;
|
FcEdit *e;
|
||||||
FcValueList *l;
|
FcValueList *l;
|
||||||
|
FcPattern *p_pat = 0;
|
||||||
|
FcPattern *m;
|
||||||
|
|
||||||
if (!config)
|
if (!config)
|
||||||
{
|
{
|
||||||
|
@ -1089,7 +1042,10 @@ FcConfigSubstitute (FcConfig *config,
|
||||||
if (kind == FcMatchPattern)
|
if (kind == FcMatchPattern)
|
||||||
s = config->substPattern;
|
s = config->substPattern;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
s = config->substFont;
|
s = config->substFont;
|
||||||
|
(void) FcPatternGetPattern (p, FC_PATTERN, 0, &p_pat);
|
||||||
|
}
|
||||||
for (; s; s = s->next)
|
for (; s; s = s->next)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -1103,7 +1059,15 @@ FcConfigSubstitute (FcConfig *config,
|
||||||
printf ("FcConfigSubstitute test ");
|
printf ("FcConfigSubstitute test ");
|
||||||
FcTestPrint (t);
|
FcTestPrint (t);
|
||||||
}
|
}
|
||||||
st[i].elt = FcPatternFindElt (p, t->field);
|
st[i].elt = 0;
|
||||||
|
if (kind == FcMatchFont && t->kind == FcMatchPattern)
|
||||||
|
m = p_pat;
|
||||||
|
else
|
||||||
|
m = p;
|
||||||
|
if (m)
|
||||||
|
st[i].elt = FcPatternFindElt (m, t->field);
|
||||||
|
else
|
||||||
|
st[i].elt = 0;
|
||||||
/*
|
/*
|
||||||
* If there's no such field in the font,
|
* If there's no such field in the font,
|
||||||
* then FcQualAll matches while FcQualAny does not
|
* then FcQualAll matches while FcQualAny does not
|
||||||
|
@ -1122,7 +1086,7 @@ FcConfigSubstitute (FcConfig *config,
|
||||||
* Check to see if there is a match, mark the location
|
* Check to see if there is a match, mark the location
|
||||||
* to apply match-relative edits
|
* to apply match-relative edits
|
||||||
*/
|
*/
|
||||||
st[i].value = FcConfigMatchValueList (p, t, st[i].elt->values);
|
st[i].value = FcConfigMatchValueList (m, t, st[i].elt->values);
|
||||||
if (!st[i].value)
|
if (!st[i].value)
|
||||||
break;
|
break;
|
||||||
if (t->qual == FcQualFirst && st[i].value != st[i].elt->values)
|
if (t->qual == FcQualFirst && st[i].value != st[i].elt->values)
|
||||||
|
@ -1148,11 +1112,17 @@ FcConfigSubstitute (FcConfig *config,
|
||||||
*/
|
*/
|
||||||
l = FcConfigValues (p, e->expr, e->binding);
|
l = FcConfigValues (p, e->expr, e->binding);
|
||||||
/*
|
/*
|
||||||
* Locate any test associated with this field
|
* Locate any test associated with this field, skipping
|
||||||
|
* tests associated with the pattern when substituting in
|
||||||
|
* the font
|
||||||
*/
|
*/
|
||||||
for (t = s->test, i = 0; t; t = t->next, i++)
|
for (t = s->test, i = 0; t; t = t->next, i++)
|
||||||
if (!FcStrCmpIgnoreCase ((FcChar8 *) t->field, (FcChar8 *) e->field))
|
{
|
||||||
|
if ((t->kind == FcMatchFont || kind == FcMatchPattern) &&
|
||||||
|
!FcStrCmpIgnoreCase ((FcChar8 *) t->field,
|
||||||
|
(FcChar8 *) e->field))
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
switch (e->op) {
|
switch (e->op) {
|
||||||
case FcOpAssign:
|
case FcOpAssign:
|
||||||
/*
|
/*
|
||||||
|
|
29
src/fcdbg.c
29
src/fcdbg.c
|
@ -27,7 +27,7 @@
|
||||||
#include "fcint.h"
|
#include "fcint.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
FcValuePrint (FcValue v)
|
FcValuePrint (const FcValue v)
|
||||||
{
|
{
|
||||||
switch (v.type) {
|
switch (v.type) {
|
||||||
case FcTypeVoid:
|
case FcTypeVoid:
|
||||||
|
@ -54,18 +54,23 @@ FcValuePrint (FcValue v)
|
||||||
case FcTypeFTFace:
|
case FcTypeFTFace:
|
||||||
printf (" face");
|
printf (" face");
|
||||||
break;
|
break;
|
||||||
|
case FcTypePattern:
|
||||||
|
printf (" pattern {");
|
||||||
|
FcPatternPrint (v.u.p);
|
||||||
|
printf (" } ");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FcValueListPrint (FcValueList *l)
|
FcValueListPrint (const FcValueList *l)
|
||||||
{
|
{
|
||||||
for (; l; l = l->next)
|
for (; l; l = l->next)
|
||||||
FcValuePrint (l->value);
|
FcValuePrint (l->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FcPatternPrint (FcPattern *p)
|
FcPatternPrint (const FcPattern *p)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
FcPatternElt *e;
|
FcPatternElt *e;
|
||||||
|
@ -126,7 +131,7 @@ FcOpPrint (FcOp op)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FcExprPrint (FcExpr *expr)
|
FcExprPrint (const FcExpr *expr)
|
||||||
{
|
{
|
||||||
switch (expr->op) {
|
switch (expr->op) {
|
||||||
case FcOpInteger: printf ("%d", expr->u.ival); break;
|
case FcOpInteger: printf ("%d", expr->u.ival); break;
|
||||||
|
@ -206,8 +211,16 @@ FcExprPrint (FcExpr *expr)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FcTestPrint (FcTest *test)
|
FcTestPrint (const FcTest *test)
|
||||||
{
|
{
|
||||||
|
switch (test->kind) {
|
||||||
|
case FcMatchPattern:
|
||||||
|
printf ("pattern ");
|
||||||
|
break;
|
||||||
|
case FcMatchFont:
|
||||||
|
printf ("font ");
|
||||||
|
break;
|
||||||
|
}
|
||||||
switch (test->qual) {
|
switch (test->qual) {
|
||||||
case FcQualAny:
|
case FcQualAny:
|
||||||
printf ("any ");
|
printf ("any ");
|
||||||
|
@ -230,7 +243,7 @@ FcTestPrint (FcTest *test)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FcEditPrint (FcEdit *edit)
|
FcEditPrint (const FcEdit *edit)
|
||||||
{
|
{
|
||||||
printf ("Edit %s ", edit->field);
|
printf ("Edit %s ", edit->field);
|
||||||
FcOpPrint (edit->op);
|
FcOpPrint (edit->op);
|
||||||
|
@ -239,7 +252,7 @@ FcEditPrint (FcEdit *edit)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FcSubstPrint (FcSubst *subst)
|
FcSubstPrint (const FcSubst *subst)
|
||||||
{
|
{
|
||||||
FcEdit *e;
|
FcEdit *e;
|
||||||
FcTest *t;
|
FcTest *t;
|
||||||
|
@ -261,7 +274,7 @@ FcSubstPrint (FcSubst *subst)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FcFontSetPrint (FcFontSet *s)
|
FcFontSetPrint (const FcFontSet *s)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
19
src/fcint.h
19
src/fcint.h
|
@ -138,8 +138,11 @@ typedef enum _FcQual {
|
||||||
FcQualAny, FcQualAll, FcQualFirst, FcQualNotFirst
|
FcQualAny, FcQualAll, FcQualFirst, FcQualNotFirst
|
||||||
} FcQual;
|
} FcQual;
|
||||||
|
|
||||||
|
#define FcMatchDefault ((FcMatchKind) -1)
|
||||||
|
|
||||||
typedef struct _FcTest {
|
typedef struct _FcTest {
|
||||||
struct _FcTest *next;
|
struct _FcTest *next;
|
||||||
|
FcMatchKind kind;
|
||||||
FcQual qual;
|
FcQual qual;
|
||||||
const char *field;
|
const char *field;
|
||||||
FcOp op;
|
FcOp op;
|
||||||
|
@ -429,22 +432,22 @@ FcFreeTypeGetPrivateMap (FT_Encoding encoding);
|
||||||
|
|
||||||
/* fcdbg.c */
|
/* fcdbg.c */
|
||||||
void
|
void
|
||||||
FcValueListPrint (FcValueList *l);
|
FcValueListPrint (const FcValueList *l);
|
||||||
|
|
||||||
void
|
void
|
||||||
FcOpPrint (FcOp op);
|
FcOpPrint (FcOp op);
|
||||||
|
|
||||||
void
|
void
|
||||||
FcTestPrint (FcTest *test);
|
FcTestPrint (const FcTest *test);
|
||||||
|
|
||||||
void
|
void
|
||||||
FcExprPrint (FcExpr *expr);
|
FcExprPrint (const FcExpr *expr);
|
||||||
|
|
||||||
void
|
void
|
||||||
FcEditPrint (FcEdit *edit);
|
FcEditPrint (const FcEdit *edit);
|
||||||
|
|
||||||
void
|
void
|
||||||
FcSubstPrint (FcSubst *subst);
|
FcSubstPrint (const FcSubst *subst);
|
||||||
|
|
||||||
int
|
int
|
||||||
FcDebug (void);
|
FcDebug (void);
|
||||||
|
@ -477,7 +480,11 @@ char *
|
||||||
FcConfigSaveField (const char *field);
|
FcConfigSaveField (const char *field);
|
||||||
|
|
||||||
FcTest *
|
FcTest *
|
||||||
FcTestCreate (FcQual qual, const FcChar8 *field, FcOp compare, FcExpr *expr);
|
FcTestCreate (FcMatchKind kind,
|
||||||
|
FcQual qual,
|
||||||
|
const FcChar8 *field,
|
||||||
|
FcOp compare,
|
||||||
|
FcExpr *expr);
|
||||||
|
|
||||||
void
|
void
|
||||||
FcTestDestroy (FcTest *test);
|
FcTestDestroy (FcTest *test);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $XFree86: xc/lib/fontconfig/src/fclist.c,v 1.5 2002/06/03 08:31:15 keithp Exp $
|
* $XFree86: xc/lib/fontconfig/src/fclist.c,v 1.7 2002/06/19 20:08:22 keithp Exp $
|
||||||
*
|
*
|
||||||
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
|
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
|
||||||
*
|
*
|
||||||
|
@ -247,6 +247,8 @@ FcListValueHash (FcValue v)
|
||||||
return FcCharSetCount (v.u.c);
|
return FcCharSetCount (v.u.c);
|
||||||
case FcTypeFTFace:
|
case FcTypeFTFace:
|
||||||
return (FcChar32) v.u.f;
|
return (FcChar32) v.u.f;
|
||||||
|
case FcTypePattern:
|
||||||
|
return (FcChar32) v.u.p->num;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $XFree86: xc/lib/fontconfig/src/fcmatch.c,v 1.15 2002/06/29 20:31:02 keithp Exp $
|
* $XFree86: xc/lib/fontconfig/src/fcmatch.c,v 1.16 2002/07/06 23:47:44 keithp Exp $
|
||||||
*
|
*
|
||||||
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
|
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
|
||||||
*
|
*
|
||||||
|
@ -384,26 +384,12 @@ FcFontRenderPrepare (FcConfig *config,
|
||||||
pe = FcPatternFindElt (pat, fe->object);
|
pe = FcPatternFindElt (pat, fe->object);
|
||||||
if (pe)
|
if (pe)
|
||||||
{
|
{
|
||||||
int j;
|
|
||||||
double score[NUM_MATCH_VALUES];
|
|
||||||
|
|
||||||
for (j = 0; j < NUM_MATCH_VALUES; j++)
|
|
||||||
score[j] = 0;
|
|
||||||
if (!FcCompareValueList (pe->object, pe->values,
|
if (!FcCompareValueList (pe->object, pe->values,
|
||||||
fe->values, &v, score, &result))
|
fe->values, &v, 0, &result))
|
||||||
{
|
{
|
||||||
FcPatternDestroy (new);
|
FcPatternDestroy (new);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
for (j = 0; j < NUM_MATCH_VALUES; j++)
|
|
||||||
if (score[j] >= 100.0)
|
|
||||||
{
|
|
||||||
FcValueList *pv;
|
|
||||||
|
|
||||||
for (pv = pe->values; pv; pv = pv->next)
|
|
||||||
FcPatternAdd (new, fe->object, pv->value, FcTrue);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
v = fe->values->value;
|
v = fe->values->value;
|
||||||
|
@ -416,6 +402,7 @@ FcFontRenderPrepare (FcConfig *config,
|
||||||
if (!fe)
|
if (!fe)
|
||||||
FcPatternAdd (new, pe->object, pe->values->value, FcTrue);
|
FcPatternAdd (new, pe->object, pe->values->value, FcTrue);
|
||||||
}
|
}
|
||||||
|
FcPatternAddPattern (new, FC_PATTERN, pat);
|
||||||
FcConfigSubstitute (config, new, FcMatchFont);
|
FcConfigSubstitute (config, new, FcMatchFont);
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $XFree86: xc/lib/fontconfig/src/fcname.c,v 1.9 2002/06/26 22:14:08 keithp Exp $
|
* $XFree86: xc/lib/fontconfig/src/fcname.c,v 1.10 2002/06/29 20:31:02 keithp Exp $
|
||||||
*
|
*
|
||||||
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
|
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
|
||||||
*
|
*
|
||||||
|
@ -472,6 +472,8 @@ FcNameUnparseValue (FcStrBuf *buf,
|
||||||
return FcNameUnparseCharSet (buf, v.u.c);
|
return FcNameUnparseCharSet (buf, v.u.c);
|
||||||
case FcTypeFTFace:
|
case FcTypeFTFace:
|
||||||
return FcTrue;
|
return FcTrue;
|
||||||
|
case FcTypePattern:
|
||||||
|
return FcTrue;
|
||||||
}
|
}
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
}
|
}
|
||||||
|
|
43
src/fcpat.c
43
src/fcpat.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $XFree86: xc/lib/fontconfig/src/fcpat.c,v 1.11 2002/07/06 23:47:44 keithp Exp $
|
* $XFree86: xc/lib/fontconfig/src/fcpat.c,v 1.12 2002/08/07 01:45:59 keithp Exp $
|
||||||
*
|
*
|
||||||
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
|
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
|
||||||
*
|
*
|
||||||
|
@ -55,6 +55,9 @@ FcValueDestroy (FcValue v)
|
||||||
case FcTypeCharSet:
|
case FcTypeCharSet:
|
||||||
FcCharSetDestroy ((FcCharSet *) v.u.c);
|
FcCharSetDestroy ((FcCharSet *) v.u.c);
|
||||||
break;
|
break;
|
||||||
|
case FcTypePattern:
|
||||||
|
FcPatternDestroy ((FcPattern *) v.u.p);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -79,6 +82,9 @@ FcValueSave (FcValue v)
|
||||||
if (!v.u.c)
|
if (!v.u.c)
|
||||||
v.type = FcTypeVoid;
|
v.type = FcTypeVoid;
|
||||||
break;
|
break;
|
||||||
|
case FcTypePattern:
|
||||||
|
FcPatternReference ((FcPattern *) v.u.p);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -101,6 +107,9 @@ FcValueListDestroy (FcValueList *l)
|
||||||
case FcTypeCharSet:
|
case FcTypeCharSet:
|
||||||
FcCharSetDestroy ((FcCharSet *) l->value.u.c);
|
FcCharSetDestroy ((FcCharSet *) l->value.u.c);
|
||||||
break;
|
break;
|
||||||
|
case FcTypePattern:
|
||||||
|
FcPatternDestroy ((FcPattern *) l->value.u.p);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -145,6 +154,8 @@ FcValueEqual (FcValue va, FcValue vb)
|
||||||
return FcCharSetEqual (va.u.c, vb.u.c);
|
return FcCharSetEqual (va.u.c, vb.u.c);
|
||||||
case FcTypeFTFace:
|
case FcTypeFTFace:
|
||||||
return va.u.f == vb.u.f;
|
return va.u.f == vb.u.f;
|
||||||
|
case FcTypePattern:
|
||||||
|
return FcPatternEqual (va.u.p, vb.u.p);
|
||||||
}
|
}
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
}
|
}
|
||||||
|
@ -195,6 +206,8 @@ FcValueHash (FcValue v)
|
||||||
case FcTypeFTFace:
|
case FcTypeFTFace:
|
||||||
return FcStringHash ((const FcChar8 *) ((FT_Face) v.u.f)->family_name) ^
|
return FcStringHash ((const FcChar8 *) ((FT_Face) v.u.f)->family_name) ^
|
||||||
FcStringHash ((const FcChar8 *) ((FT_Face) v.u.f)->style_name);
|
FcStringHash ((const FcChar8 *) ((FT_Face) v.u.f)->style_name);
|
||||||
|
case FcTypePattern:
|
||||||
|
return (FcChar32) v.u.p->num;
|
||||||
}
|
}
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
}
|
}
|
||||||
|
@ -446,6 +459,9 @@ bail2:
|
||||||
case FcTypeCharSet:
|
case FcTypeCharSet:
|
||||||
FcCharSetDestroy ((FcCharSet *) value.u.c);
|
FcCharSetDestroy ((FcCharSet *) value.u.c);
|
||||||
break;
|
break;
|
||||||
|
case FcTypePattern:
|
||||||
|
FcPatternDestroy ((FcPattern *) value.u.p);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -563,6 +579,16 @@ FcPatternAddFTFace (FcPattern *p, const char *object, const FT_Face f)
|
||||||
return FcPatternAdd (p, object, v, FcTrue);
|
return FcPatternAdd (p, object, v, FcTrue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FcBool
|
||||||
|
FcPatternAddPattern (FcPattern *p, const char *object, const FcPattern *pp)
|
||||||
|
{
|
||||||
|
FcValue v;
|
||||||
|
|
||||||
|
v.type = FcTypePattern;
|
||||||
|
v.u.p = pp;
|
||||||
|
return FcPatternAdd (p, object, v, FcTrue);
|
||||||
|
}
|
||||||
|
|
||||||
FcResult
|
FcResult
|
||||||
FcPatternGet (FcPattern *p, const char *object, int id, FcValue *v)
|
FcPatternGet (FcPattern *p, const char *object, int id, FcValue *v)
|
||||||
{
|
{
|
||||||
|
@ -704,6 +730,21 @@ FcPatternGetFTFace (FcPattern *p, const char *object, int id, FT_Face *f)
|
||||||
return FcResultMatch;
|
return FcResultMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FcResult
|
||||||
|
FcPatternGetPattern (FcPattern *p, const char *object, int id, FcPattern **pp)
|
||||||
|
{
|
||||||
|
FcValue v;
|
||||||
|
FcResult r;
|
||||||
|
|
||||||
|
r = FcPatternGet (p, object, id, &v);
|
||||||
|
if (r != FcResultMatch)
|
||||||
|
return r;
|
||||||
|
if (v.type != FcTypePattern)
|
||||||
|
return FcResultTypeMismatch;
|
||||||
|
*pp = (FcPattern *) v.u.p;
|
||||||
|
return FcResultMatch;
|
||||||
|
}
|
||||||
|
|
||||||
FcPattern *
|
FcPattern *
|
||||||
FcPatternDuplicate (FcPattern *orig)
|
FcPatternDuplicate (FcPattern *orig)
|
||||||
{
|
{
|
||||||
|
|
33
src/fcxml.c
33
src/fcxml.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $XFree86: xc/lib/fontconfig/src/fcxml.c,v 1.16 2002/07/12 19:19:16 keithp Exp $
|
* $XFree86: xc/lib/fontconfig/src/fcxml.c,v 1.17 2002/07/31 01:36:37 keithp Exp $
|
||||||
*
|
*
|
||||||
* Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
|
* Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
|
||||||
*
|
*
|
||||||
|
@ -49,13 +49,18 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FcTest *
|
FcTest *
|
||||||
FcTestCreate (FcQual qual, const FcChar8 *field, FcOp compare, FcExpr *expr)
|
FcTestCreate (FcMatchKind kind,
|
||||||
|
FcQual qual,
|
||||||
|
const FcChar8 *field,
|
||||||
|
FcOp compare,
|
||||||
|
FcExpr *expr)
|
||||||
{
|
{
|
||||||
FcTest *test = (FcTest *) malloc (sizeof (FcTest));
|
FcTest *test = (FcTest *) malloc (sizeof (FcTest));
|
||||||
|
|
||||||
if (test)
|
if (test)
|
||||||
{
|
{
|
||||||
test->next = 0;
|
test->next = 0;
|
||||||
|
test->kind = kind;
|
||||||
test->qual = qual;
|
test->qual = qual;
|
||||||
test->field = (char *) FcStrCopy (field);
|
test->field = (char *) FcStrCopy (field);
|
||||||
test->op = compare;
|
test->op = compare;
|
||||||
|
@ -1204,7 +1209,8 @@ FcParseAlias (FcConfigParse *parse)
|
||||||
}
|
}
|
||||||
if (edit)
|
if (edit)
|
||||||
{
|
{
|
||||||
test = FcTestCreate (FcQualAny,
|
test = FcTestCreate (FcMatchPattern,
|
||||||
|
FcQualAny,
|
||||||
(FcChar8 *) FC_FAMILY,
|
(FcChar8 *) FC_FAMILY,
|
||||||
FcOpEqual,
|
FcOpEqual,
|
||||||
family);
|
family);
|
||||||
|
@ -1358,6 +1364,8 @@ FcConfigLexCompare (const FcChar8 *compare)
|
||||||
static void
|
static void
|
||||||
FcParseTest (FcConfigParse *parse)
|
FcParseTest (FcConfigParse *parse)
|
||||||
{
|
{
|
||||||
|
const FcChar8 *kind_string;
|
||||||
|
FcMatchKind kind;
|
||||||
const FcChar8 *qual_string;
|
const FcChar8 *qual_string;
|
||||||
FcQual qual;
|
FcQual qual;
|
||||||
const FcChar8 *name;
|
const FcChar8 *name;
|
||||||
|
@ -1366,6 +1374,23 @@ FcParseTest (FcConfigParse *parse)
|
||||||
FcExpr *expr;
|
FcExpr *expr;
|
||||||
FcTest *test;
|
FcTest *test;
|
||||||
|
|
||||||
|
kind_string = FcConfigGetAttribute (parse, "target");
|
||||||
|
if (!kind_string)
|
||||||
|
kind = FcMatchDefault;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!strcmp ((char *) kind_string, "pattern"))
|
||||||
|
kind = FcMatchPattern;
|
||||||
|
else if (!strcmp ((char *) kind_string, "font"))
|
||||||
|
kind = FcMatchFont;
|
||||||
|
else if (!strcmp ((char *) kind_string, "default"))
|
||||||
|
kind = FcMatchDefault;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FcConfigMessage (parse, FcSevereWarning, "invalid test target \"%s\"", kind_string);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
qual_string = FcConfigGetAttribute (parse, "qual");
|
qual_string = FcConfigGetAttribute (parse, "qual");
|
||||||
if (!qual_string)
|
if (!qual_string)
|
||||||
qual = FcQualAny;
|
qual = FcQualAny;
|
||||||
|
@ -1409,7 +1434,7 @@ FcParseTest (FcConfigParse *parse)
|
||||||
FcConfigMessage (parse, FcSevereWarning, "missing test expression");
|
FcConfigMessage (parse, FcSevereWarning, "missing test expression");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
test = FcTestCreate (qual, name, compare, expr);
|
test = FcTestCreate (kind, qual, name, compare, expr);
|
||||||
if (!test)
|
if (!test)
|
||||||
{
|
{
|
||||||
FcConfigMessage (parse, FcSevereError, "out of memory");
|
FcConfigMessage (parse, FcSevereError, "out of memory");
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.\"
|
.\"
|
||||||
.\" $XFree86: fontconfig.man,v 1.2 2000/11/30 06:59:45 keithp Exp $
|
.\" $XFree86: xc/lib/fontconfig/src/fontconfig.man,v 1.2 2002/08/06 19:54:10 keithp Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
|
.\" Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
|
||||||
.\"
|
.\"
|
||||||
|
@ -166,6 +166,22 @@ first is to modify how fonts are selected; aliasing families and adding
|
||||||
suitable defaults. The second is to modify how the selected fonts are
|
suitable defaults. The second is to modify how the selected fonts are
|
||||||
rasterized. Those must apply to the selected font, not the original pattern
|
rasterized. Those must apply to the selected font, not the original pattern
|
||||||
as false matches will often occur.
|
as false matches will often occur.
|
||||||
|
.SS FONT LIST MATCHING
|
||||||
|
.P
|
||||||
|
While many applications want to locate a single font best matching their
|
||||||
|
search criteria, other applications need to build a set of fonts which can
|
||||||
|
be used to present any Unicode data. Fontconfig provides an API to generate
|
||||||
|
a list sorted by the nearness of each font to the pattern. Every font in
|
||||||
|
the system is considered, the best matching fonts are placed first. The
|
||||||
|
application then can select whether the remaining fonts are unconditionally
|
||||||
|
included in the list, or whether they are included only if they cover
|
||||||
|
portions of Unicode not covered by any of the preceeding fonts.
|
||||||
|
.P
|
||||||
|
The list resulting from this match is represented by references to the
|
||||||
|
original font patterns and so consumes very little memory. Using a list
|
||||||
|
entry involves creating a pattern which combines the information from the
|
||||||
|
font with the information from the original pattern and executing the font
|
||||||
|
substitutions.
|
||||||
.SS FONT NAMES
|
.SS FONT NAMES
|
||||||
Fontconfig provides a textual representation for patterns that the library
|
Fontconfig provides a textual representation for patterns that the library
|
||||||
can both accept and generate. The representation is in three parts, first a
|
can both accept and generate. The representation is in three parts, first a
|
||||||
|
@ -200,8 +216,8 @@ by the ISO 3166 country code. The hyphen and country code may be elided.
|
||||||
.P
|
.P
|
||||||
Fontconfig has orthographies for several languages built into the library.
|
Fontconfig has orthographies for several languages built into the library.
|
||||||
No provision has been made for adding new ones aside from rebuilding the
|
No provision has been made for adding new ones aside from rebuilding the
|
||||||
library. It currently supports 104 of the 139 languages named in ISO 639-1,
|
library. It currently supports 122 of the 139 languages named in ISO 639-1,
|
||||||
117 of the languages with two-letter codes from ISO 639-2 and another 24
|
141 of the languages with two-letter codes from ISO 639-2 and another 30
|
||||||
languages with only three-letter codes.
|
languages with only three-letter codes.
|
||||||
|
|
||||||
.SH DATATYPES
|
.SH DATATYPES
|
||||||
|
@ -295,6 +311,15 @@ results of listing fonts in this format. 'nfont' holds the number of
|
||||||
patterns in the 'fonts' array; 'sfont' is used to indicate the size of that
|
patterns in the 'fonts' array; 'sfont' is used to indicate the size of that
|
||||||
array.
|
array.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B FcStrSet
|
||||||
|
.B FcStrList
|
||||||
|
FcStrSet holds a list of strings that can be appended to and enumerated.
|
||||||
|
Its unique characteristic is that the enumeration works even while strings
|
||||||
|
are appended during enumeration. FcStrList is used during enumeration to
|
||||||
|
safely and correctly walk the list of strings even while that list is edited
|
||||||
|
in the middle of enumeration.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B FcObjectSet
|
.B FcObjectSet
|
||||||
.sp
|
.sp
|
||||||
|
@ -305,9 +330,34 @@ array.
|
||||||
const char **objects;
|
const char **objects;
|
||||||
} FcObjectSet;
|
} FcObjectSet;
|
||||||
.fi
|
.fi
|
||||||
|
.sp
|
||||||
holds a set of names and is used to specify which fields from fonts are
|
holds a set of names and is used to specify which fields from fonts are
|
||||||
placed in the the list of returned patterns when listing fonts.
|
placed in the the list of returned patterns when listing fonts.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B FcObjectType
|
||||||
|
.sp
|
||||||
|
typedef struct _FcObjectType {
|
||||||
|
const char *object;
|
||||||
|
FcType type;
|
||||||
|
} FcObjectType;
|
||||||
|
.fi
|
||||||
|
marks the type of a pattern element generated when parsing font names.
|
||||||
|
Applications can add new object types so that font names may contain the new
|
||||||
|
elements.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B FcConstant
|
||||||
|
.sp
|
||||||
|
typedef struct _FcConstant {
|
||||||
|
const FcChar8 *name;
|
||||||
|
const char *object;
|
||||||
|
int value;
|
||||||
|
} FcConstant;
|
||||||
|
.fi
|
||||||
|
Provides for symbolic constants for new pattern elements. When 'name' is
|
||||||
|
seen in a font name, an 'object' element is created with value 'value'.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B FcBlanks
|
.B FcBlanks
|
||||||
holds a list of Unicode chars which are expected to be blank; unexpectedly
|
holds a list of Unicode chars which are expected to be blank; unexpectedly
|
||||||
|
@ -357,6 +407,11 @@ Used as a return type for functions manipulating FcPattern objects.
|
||||||
.br
|
.br
|
||||||
.DT
|
.DT
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B FcAtomic
|
||||||
|
Used for locking access to config files. Provides a safe way to update
|
||||||
|
configuration files.
|
||||||
|
|
||||||
.SH FUNCTIONS
|
.SH FUNCTIONS
|
||||||
|
|
||||||
.SS FcMatrix
|
.SS FcMatrix
|
||||||
|
@ -450,6 +505,18 @@ Returns the number of chars that are in both 'a' and 'b'.
|
||||||
FcChar32 FcCharSetSubtractCount (const FcCharSet *a, const FcCharSet *b)
|
FcChar32 FcCharSetSubtractCount (const FcCharSet *a, const FcCharSet *b)
|
||||||
Returns the number of chars that are in 'a' but not in 'b'.
|
Returns the number of chars that are in 'a' but not in 'b'.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcBool FcCharSetIsSubset (const FcCharSet *a, const FcCharSet *b)
|
||||||
|
Returns whether 'a' is a subset of 'b'.
|
||||||
|
|
||||||
|
.TP FcChar32 FcCharSetFirstPage (const FcCharSet *a, FcChar32 [FC_CHARSET_MAP_SIZE], FcChar32 *next)
|
||||||
|
Builds an array of bits marking the first page of Unicode coverage of 'a'.
|
||||||
|
Returns the base of the array. 'next' contains the next page in the font.
|
||||||
|
|
||||||
|
.TP FcChar32 FcCharSetNextPage (const FcCharSet *a, FcChar32 [FC_CHARSET_MAP_SIZE], FcChar32 *next)
|
||||||
|
Builds an array of bits marking the Unicode coverage of 'a' for page '*next'.
|
||||||
|
Returns the base of the array. 'next' contains the next page in the font.
|
||||||
|
|
||||||
.SS FcValue
|
.SS FcValue
|
||||||
FcValue is a structure containing a type tag and a union of all possible
|
FcValue is a structure containing a type tag and a union of all possible
|
||||||
datatypes. The tag is an enum of type
|
datatypes. The tag is an enum of type
|
||||||
|
@ -479,6 +546,20 @@ Creates a pattern with no properties; used to build patterns from scratch.
|
||||||
void FcPatternDestroy (FcPattern *p)
|
void FcPatternDestroy (FcPattern *p)
|
||||||
Destroys a pattern, in the process destroying all related values.
|
Destroys a pattern, in the process destroying all related values.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcBool FcPatternEqual (const FcPattern *pa, const FcPattern *pb);
|
||||||
|
Returns whether 'pa' and 'pb' are exactly alike.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcBool FcPatternEqualSubset (const FcPattern *pa, const FcPattern *pb, const FcObjectSet *os)
|
||||||
|
Returns whether 'pa' and 'pb' have exactly the same values for all of the
|
||||||
|
objects in 'os'.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcChar32 FcPatternHash (const FcPattern *p)
|
||||||
|
Returns a 32-bit number which is the same for any two patterns which are
|
||||||
|
exactly alike.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
FcBool FcPatternAdd (FcPattern *p, const char *object, FcValue value, FcBool append)
|
FcBool FcPatternAdd (FcPattern *p, const char *object, FcValue value, FcBool append)
|
||||||
Adds a single value to the list of values associated with the property named
|
Adds a single value to the list of values associated with the property named
|
||||||
|
@ -565,7 +646,7 @@ Deletes all values associated with the property `object', returning
|
||||||
whether the property existed or not.
|
whether the property existed or not.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
void FcPatternPrint (FcPattern *p)
|
void FcPatternPrint (const FcPattern *p)
|
||||||
Prints an easily readable version of the pattern to stdout. There is
|
Prints an easily readable version of the pattern to stdout. There is
|
||||||
no provision for reparsing data in this format, it's just for diagnostics
|
no provision for reparsing data in this format, it's just for diagnostics
|
||||||
and debugging.
|
and debugging.
|
||||||
|
@ -635,6 +716,41 @@ FcObjectSet *FcObjectSetBuild (const char *first, ...)
|
||||||
FcObjectSet *FcObjectSetVaBuild (const char *first, va_list va)
|
FcObjectSet *FcObjectSetVaBuild (const char *first, va_list va)
|
||||||
These build an object set from a null-terminated list of property names.
|
These build an object set from a null-terminated list of property names.
|
||||||
|
|
||||||
|
.SS FcObjectType
|
||||||
|
Provides for applcation-specified font name object types so that new
|
||||||
|
pattern elements can be generated from font names.
|
||||||
|
|
||||||
|
.TP FcBool FcNameRegisterObjectTypes (const FcObjectType *types, int ntype)
|
||||||
|
Register 'ntype' new object types.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcBool FcNameUnregisterObjectTypes (const FcObjectType *types, int ntype)
|
||||||
|
Unregister 'ntype' object types.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
const FcObjectType *FcNameGetObjectType (const char *object)
|
||||||
|
Return the object type for the pattern element named 'object'.
|
||||||
|
|
||||||
|
.SS FcConstant
|
||||||
|
Provides for application-specified symbolic constants for font names.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcBool FcNameRegisterConstants (const FcConstant *consts, int nconsts)
|
||||||
|
Register 'nconsts' new symbolic constants.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcBool FcNameUnregisterConstants (const FcConstant *consts, int nconsts)
|
||||||
|
Unregister 'nconsts' symbolic constants.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
const FcConstant *FcNameGetConstant (FcChar8 *string)
|
||||||
|
Return the FcConstant structure related to symbolic constant 'string'.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcBool FcNameConstant (FcChar8 *string, int *result);
|
||||||
|
Returns whether a symbolic constant with name 'string' is registered,
|
||||||
|
placing the value of the constant in 'result' if present.
|
||||||
|
|
||||||
.SS FcBlanks
|
.SS FcBlanks
|
||||||
An FcBlanks object holds a list of Unicode chars which are expected to
|
An FcBlanks object holds a list of Unicode chars which are expected to
|
||||||
be blank when drawn. When scanning new fonts, any glyphs which are
|
be blank when drawn. When scanning new fonts, any glyphs which are
|
||||||
|
@ -684,6 +800,11 @@ FcConfigBuildFonts if necessary, returning FcFalse if that call fails.
|
||||||
FcConfig *FcConfigGetCurrent (void)
|
FcConfig *FcConfigGetCurrent (void)
|
||||||
Returns the current default configuration.
|
Returns the current default configuration.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcBool FcConfigUptoDate (FcConfig *config)
|
||||||
|
Checks all of the files related to 'config' and returns whether the
|
||||||
|
in-memory version is in sync with the disk version.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
FcBool FcConfigBuildFonts (FcConfig *config)
|
FcBool FcConfigBuildFonts (FcConfig *config)
|
||||||
Builds the set of available fonts for the given configuration. Note that
|
Builds the set of available fonts for the given configuration. Note that
|
||||||
|
@ -691,11 +812,18 @@ any changes to the configuration after this call have indeterminate effects.
|
||||||
Returns FcFalse if this operation runs out of memory.
|
Returns FcFalse if this operation runs out of memory.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
char **FcConfigGetDirs (FcConfig *config)
|
FcStrList *FcConfigGetConfigDirs (FcConfig *config)
|
||||||
Returns the list of font directories specified in 'config'.
|
Returns the list of font directories specified in the configuration files
|
||||||
|
for 'config'. Does not include any subdirectories.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
char **FcConfigGetConfigFiles (FcConfig *config)
|
FcStrList *FcConfigGetFontDirs (FcConfig *config)
|
||||||
|
Returns the list of font directories in 'config'. This includes the
|
||||||
|
configured font directories along with any directories below those in the
|
||||||
|
filesystem.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcStrList *FcConfigGetConfigFiles (FcConfig *config)
|
||||||
Returns the list of known configuration files used to generate 'config'.
|
Returns the list of known configuration files used to generate 'config'.
|
||||||
Note that this will not include any configuration done with FcConfigParse.
|
Note that this will not include any configuration done with FcConfigParse.
|
||||||
|
|
||||||
|
@ -713,6 +841,16 @@ FcBlanks *FcConfigGetBlanks (FcConfig *config)
|
||||||
Returns the FcBlanks object associated with the given configuration, if no
|
Returns the FcBlanks object associated with the given configuration, if no
|
||||||
blanks were present in the configuration, this function will return 0.
|
blanks were present in the configuration, this function will return 0.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
int FcConfigGetRescanInverval (FcConfig *config)
|
||||||
|
Returns the interval between automatic checks of the configuration (in
|
||||||
|
seconds) specified in 'config'. The configuration is checked during
|
||||||
|
a call to FcFontList when this interval has passed since the last check.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcBool FcConfigSetRescanInverval (FcConfig *config, int rescanInterval)
|
||||||
|
Sets the rescan interval; returns FcFalse if an error occurred.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
FcBool FcConfigAppFontAddFile (FcConfig *config, const char *file)
|
FcBool FcConfigAppFontAddFile (FcConfig *config, const char *file)
|
||||||
Adds an application-specific font to the configuration.
|
Adds an application-specific font to the configuration.
|
||||||
|
@ -736,7 +874,30 @@ if 'kind' is FcMatchFont, those tagged as font operations are applied.
|
||||||
FcPattern *FcFontMatch (FcConfig *config, FcPattern *p, FcResult *result)
|
FcPattern *FcFontMatch (FcConfig *config, FcPattern *p, FcResult *result)
|
||||||
Returns the font in 'config' most close matching 'p'. This function
|
Returns the font in 'config' most close matching 'p'. This function
|
||||||
should be called only after FcConfigSubstitute and FcDefaultSubstitute have
|
should be called only after FcConfigSubstitute and FcDefaultSubstitute have
|
||||||
been called; otherwise the results will be less useful.
|
been called for 'p'; otherwise the results will not be correct.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcFontSet *FcFontSort (FcConfig *config, FcPattern *p, FcBool trim, FcCharSet **csp, FcResult *result) Returns the list of fonts sorted by
|
||||||
|
closeness to 'p'. If 'trim' is FcTrue, elements in the list which don't
|
||||||
|
include Unicode coverage not provided by earlier elements in the list are
|
||||||
|
elided. The union of Unicode coverage of all of the fonts is returned in
|
||||||
|
'csp', if 'csp' is not NULL. This function should be called only after
|
||||||
|
FcConfigSubstitute and FcDefaultSubstitute have been called for 'p';
|
||||||
|
otherwise the results will not be correct.
|
||||||
|
.P
|
||||||
|
The returned FcFontSet references FcPattern structures which may be shared
|
||||||
|
by the return value from multiple FcFontSort calls, applications must not
|
||||||
|
modify these patterns. Instead, they should be passed, along with 'p' to
|
||||||
|
FcFontRenderPrepare which combines them into a complete pattern.
|
||||||
|
.P
|
||||||
|
The FcFontSet returned by FcFontSort is destroyed by caling FcFontSetDestroy.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcPattern *FcFontRenderPrepare (FcConfig *config, FcPattern *pat, FcPattern *font)
|
||||||
|
Creates a new pattern consisting of elements of 'font' not appearing in
|
||||||
|
'pat', elements of 'pat' not appearing in 'font' and the best matching value
|
||||||
|
from 'pat' for elements appearing in both. The result is passed to
|
||||||
|
FcConfigSubstitute with 'kind' FcMatchFont and then returned.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
FcFontSet *FcFontList (FcConfig *config, FcPattern *p, FcObjectSet *os)
|
FcFontSet *FcFontList (FcConfig *config, FcPattern *p, FcObjectSet *os)
|
||||||
|
@ -761,18 +922,80 @@ FC_CONFIG_DIR environment variable.
|
||||||
These functions provide some control over how the library is initialized.
|
These functions provide some control over how the library is initialized.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
FcBool FcInitConfig (void)
|
FcConfig *FcInitLoadConfig (void)
|
||||||
Initializes the default configuration using the default configuration file
|
Loads the default configuration file and returns the resulting configuration.
|
||||||
|
Does not load any font information.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
FcBool FcInitFonts (void)
|
FcConfig *FcInitLoadConfigAndFonts (void)
|
||||||
Initializes the set of fonts available in the default configuration
|
Loads the default configuration file and builds information about the
|
||||||
|
available fonts. Returns the resulting configuration.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
FcBool FcInit (void)
|
FcBool FcInit (void)
|
||||||
Calls FcInitConfig and FcInitFonts to completely initialize the default
|
Loads the default configuration file and the fonts referenced therein and
|
||||||
|
sets the default configuration to that result. Returns whether this
|
||||||
|
process succeeded or not. If the default configuration has already
|
||||||
|
been loaded, this routine does nothing and returns FcTrue.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
int FcGetVersion (void)
|
||||||
|
Returns the version number of the library.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcBool FcInitReinitialize (void)
|
||||||
|
Forces the default configuration file to be reloaded and resets the default
|
||||||
configuration.
|
configuration.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcBool FcInitBringUptoDate (void)
|
||||||
|
Checks the rescan interval in the default configuration, checking the
|
||||||
|
configuration if the interval has passed and reloading the configuration if
|
||||||
|
when any changes are detected.
|
||||||
|
|
||||||
|
.SS FcAtomic
|
||||||
|
These functions provide a safe way to update config files, allowing ongoing
|
||||||
|
reading of the old config file while locked for writing and ensuring that a
|
||||||
|
consistent and complete version of the config file is always available.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcAtomic * FcAtomicCreate (const FcChar8 *file)
|
||||||
|
Creates a data structure containing data needed to control access to 'file'.
|
||||||
|
Writing is done to a separate file. Once that file is complete, the original
|
||||||
|
configuration file is atomically replaced so that reading process always see
|
||||||
|
a consistent and complete file without the need to lock for reading.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcBool FcAtomicLock (FcAtomic *atomic)
|
||||||
|
Attempts to lock the file referenced by 'atomic'. Returns FcFalse if the
|
||||||
|
file is locked by another process, else returns FcTrue and leaves the file
|
||||||
|
locked.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcChar8 *FcAtomicNewFile (FcAtomic *atomic)
|
||||||
|
Returns the filename for writing a new version of the file refernced by
|
||||||
|
'atomic'.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcChar8 *FcAtomicOrigFile (FcAtomic *atomic)
|
||||||
|
Returns the file refernced by 'atomic'.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcBool FcAtomicReplaceOrig (FcAtomic *atomic)
|
||||||
|
Replaces the original file referenced by 'atomic' with the new file.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
void FcAtomicDeleteNew (FcAtomic *atomic)
|
||||||
|
Deletes the new file.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
void FcAtomicUnlock (FcAtomic *atomic)
|
||||||
|
Unlocks the file.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
void FcAtomicDestroy (FcAtomic *atomic)
|
||||||
|
Destroys 'atomic'.
|
||||||
|
|
||||||
.SS FreeType specific functions
|
.SS FreeType specific functions
|
||||||
.nf
|
.nf
|
||||||
.B #include <fontconfig/fcfreetype.h>
|
.B #include <fontconfig/fcfreetype.h>
|
||||||
|
@ -814,28 +1037,78 @@ FcConfigFilename. This doesn't load a complete configuration as any
|
||||||
include files referenced from 'file' will not be loaded.
|
include files referenced from 'file' will not be loaded.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
FcBool FcConfigParse (FcConfig *config, xmlDocPtr doc)
|
FcBool FcConfigParseAndLoad (FcConfig *config, const FcChar8 *file, FcBool complain)
|
||||||
Walks the given configuration and constructs the internal representation in
|
Walks the configuration in 'file' and constructs the internal representation in
|
||||||
'config'. Any include files referenced from within 'doc' will be loaded
|
'config'. Any include files referenced from within 'file' will be loaded
|
||||||
with FcConfigLoad and also parsed.
|
with FcConfigLoad and also parsed. If 'complain' is FcFalse, no warning
|
||||||
|
will be displayed if 'file' does not exist.
|
||||||
|
|
||||||
.SS File and Directory routines
|
.SS File and Directory routines
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
FcBool FcFileScan (FcFontSet *set, FcFileCache *cache, FcBlanks *blanks, const char *file, FcBool force)
|
FcBool FcFileScan (FcFontSet *set, FcStrSet *dirs, FcFileCache *cache, FcBlanks *blanks, const char *file, FcBool force)
|
||||||
Scans a single file and adds all fonts found to 'set'. If 'force' is FcTrue,
|
Scans a single file and adds all fonts found to 'set'. If 'force' is FcTrue,
|
||||||
then the file is scanned even if associated information is found in 'cache'.
|
then the file is scanned even if associated information is found in 'cache'.
|
||||||
|
If 'file' is a directory, it is added to 'dirs'.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
FcBool FcDirScan (FcFontSet *set, FcFileCache *cache, FcBlanks *blanks, const char *dir, FcBool force)
|
FcBool FcDirScan (FcFontSet *set, FcStrSet *dirs, FcFileCache *cache, FcBlanks *blanks, const char *dir, FcBool force)
|
||||||
Scans an entire directory and adds all fonts found to 'set'. If 'force' is
|
Scans an entire directory and adds all fonts found to 'set'. If 'force' is
|
||||||
FcTrue, then the directory and all files within it are scanned even if
|
FcTrue, then the directory and all files within it are scanned even if
|
||||||
information is present in the per-directory cache file or 'cache'.
|
information is present in the per-directory cache file or 'cache'. Any
|
||||||
|
subdirectories found are added to 'dirs'.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
FcBool FcDirSave (FcFontSet *set, const char *dir)
|
FcBool FcDirSave (FcFontSet *set, FcStrSet *dirs, const char *dir)
|
||||||
Creates the per-directory cache file for 'dir' and populates it with the
|
Creates the per-directory cache file for 'dir' and populates it with the
|
||||||
fonts in 'set'.
|
fonts in 'set' and subdirectories in 'dirs'.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcBool FcDirCacheValid (const FcChar8 *cache_file)
|
||||||
|
Returns FcTrue if 'cache_file' is no older than the directory containing it,
|
||||||
|
else FcFalse.
|
||||||
|
|
||||||
|
.SS FcStrSet and FcStrList
|
||||||
|
A data structure for enumerating strings, used to list directories while
|
||||||
|
scanning the configuration as directories are added while scanning.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcStrSet *FcStrSetCreate (void)
|
||||||
|
Create an empty set.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcBool FcStrSetMember (FcStrSet *set, const FcChar8 *s)
|
||||||
|
Returns whether 's' is a member of 'set'.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcBool FcStrSetAdd (FcStrSet *set, const FcChar8 *s)
|
||||||
|
Adds a copy of 's' to 'set'.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcBool FcStrSetAddFilename (FcStrSet *set, const FcChar8 *s)
|
||||||
|
Adds a copy 's' to 'set', The copy is created with FcStrCopyFilename
|
||||||
|
so that leading '~' values are replaced with the value of the HOME
|
||||||
|
environment variable.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcBool FcStrSetDel (FcStrSet *set, const FcChar8 *s)
|
||||||
|
Removes 's' from 'set', returning FcTrue if 's' was a member else FcFalse.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
void FcStrSetDestroy (FcStrSet *set)
|
||||||
|
Destroys 'set'.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcStrList *FcStrListCreate (FcStrSet *set)
|
||||||
|
Creates an enumerator to list the strings in 'set'.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcChar8 *FcStrListNext (FcStrList *list)
|
||||||
|
Returns the next string in 'set'.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
void FcStrListDone (FcStrList *list)
|
||||||
|
Destroys the enumerator 'list'.
|
||||||
|
|
||||||
.SS String utilities
|
.SS String utilities
|
||||||
|
|
||||||
|
@ -871,16 +1144,29 @@ bytes needed to hold the largest unicode char counted. The return value
|
||||||
indicates whether 'string' is a well-formed UTF16 string.
|
indicates whether 'string' is a well-formed UTF16 string.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
char *FcStrCopy (const char *s)
|
FcChar8 *FcStrCopy (const FcChar8 *s)
|
||||||
Allocates memory, copies 's' and returns the resulting buffer. Yes, this is
|
Allocates memory, copies 's' and returns the resulting buffer. Yes, this is
|
||||||
'strdup', but that function isn't available on every platform.
|
'strdup', but that function isn't available on every platform.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcChar8 *FcStrCopyFilename (const FcChar8 *s)
|
||||||
|
Just like FcStrCopy except that it converts any leading '~' characters in
|
||||||
|
's' to the value of the HOME environment variable.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
int FcStrCmpIgnoreCase (const char *s1, const char *s2)
|
int FcStrCmpIgnoreCase (const char *s1, const char *s2)
|
||||||
Returns the usual <0, 0, >0 result of comparing 's1' and 's2'. This test
|
Returns the usual <0, 0, >0 result of comparing 's1' and 's2'. This test
|
||||||
is case-insensitive in the ASCII range and will operate properly with UTF8
|
is case-insensitive in the ASCII range and will operate properly with UTF8
|
||||||
encoded strings, although it does not check for well formed strings.
|
encoded strings, although it does not check for well formed strings.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcChar8 *FcStrDirname (const FcChar8 *file)
|
||||||
|
Returns the directory containing 'file'.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
FcChar8 *FcStrBasename (const FcChar8 *file)
|
||||||
|
Returns the filename of 'file' stripped of any leading directory names.
|
||||||
|
|
||||||
.SH CONFIGURATION FILE FORMAT
|
.SH CONFIGURATION FILE FORMAT
|
||||||
Configuration files for fontconfig are stored in XML format; this
|
Configuration files for fontconfig are stored in XML format; this
|
||||||
format makes external configuration tools easier to write and ensures that
|
format makes external configuration tools easier to write and ensures that
|
||||||
|
|
Loading…
Reference in New Issue