Add one more debugging option to see transformation on font-matching
just setting FC_MATCH=3 shows a lot of information and hard to keep on track for informamtion which is really necessary to see. to use this more effectively, added FC_DBG_MATCH_FILTER to see for what one really want to see. it takes a comma-separated-list of object names. If you want to see family name only, try like this: FC_DBG_MATCH_FILTER=family FC_DEBUG=4096 fc-match debugging output will be filtered out and see family only in the result.
This commit is contained in:
parent
1827ef7b1e
commit
10a57edd07
|
@ -258,7 +258,7 @@ debugging messages.
|
||||||
MEMORY 512 Monitor fontconfig memory usage
|
MEMORY 512 Monitor fontconfig memory usage
|
||||||
CONFIG 1024 Monitor which config files are loaded
|
CONFIG 1024 Monitor which config files are loaded
|
||||||
LANGSET 2048 Dump char sets used to construct lang values
|
LANGSET 2048 Dump char sets used to construct lang values
|
||||||
OBJTYPES 4096 Display message when value typechecks fail
|
MATCH2 4096 Display font-matching transformation in patterns
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
Add the value of the desired debug levels together and assign that (in
|
Add the value of the desired debug levels together and assign that (in
|
||||||
|
@ -787,6 +787,10 @@ is used to override the default configuration directory.
|
||||||
is used to output the detailed debugging messages. see <link linkend="debug">Debugging Applications</link> section for more details.
|
is used to output the detailed debugging messages. see <link linkend="debug">Debugging Applications</link> section for more details.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
|
<emphasis>FC_DBG_MATCH_FILTER</emphasis>
|
||||||
|
is used to filter out the patterns. this takes a comma-separated list of object names and effects only when FC_DEBUG has MATCH2. see <link linkend="debug">Debugging Applications</link> section for more details.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
<emphasis>FONTCONFIG_USE_MMAP</emphasis>
|
<emphasis>FONTCONFIG_USE_MMAP</emphasis>
|
||||||
is used to control the use of mmap(2) for the cache files if available. this take a boolean value. fontconfig will checks if the cache files are stored on the filesystem that is safe to use mmap(2). explicitly setting this environment variable will causes skipping this check and enforce to use or not use mmap(2) anyway.
|
is used to control the use of mmap(2) for the cache files if available. this take a boolean value. fontconfig will checks if the cache files are stored on the filesystem that is safe to use mmap(2). explicitly setting this environment variable will causes skipping this check and enforce to use or not use mmap(2) anyway.
|
||||||
</para>
|
</para>
|
||||||
|
|
|
@ -517,6 +517,9 @@ FcValuePrint (const FcValue v);
|
||||||
FcPublic void
|
FcPublic void
|
||||||
FcPatternPrint (const FcPattern *p);
|
FcPatternPrint (const FcPattern *p);
|
||||||
|
|
||||||
|
FcPublic void
|
||||||
|
FcPatternPrint2 (FcPattern *p1, FcPattern *p2, const FcObjectSet *os);
|
||||||
|
|
||||||
FcPublic void
|
FcPublic void
|
||||||
FcFontSetPrint (const FcFontSet *s);
|
FcFontSetPrint (const FcFontSet *s);
|
||||||
|
|
||||||
|
@ -828,6 +831,9 @@ FcPatternEqualSubset (const FcPattern *pa, const FcPattern *pb, const FcObjectSe
|
||||||
FcPublic FcChar32
|
FcPublic FcChar32
|
||||||
FcPatternHash (const FcPattern *p);
|
FcPatternHash (const FcPattern *p);
|
||||||
|
|
||||||
|
FcPublic int
|
||||||
|
FcPatternPosition (const FcPattern *p, const char *object);
|
||||||
|
|
||||||
FcPublic FcBool
|
FcPublic FcBool
|
||||||
FcPatternAdd (FcPattern *p, const char *object, FcValue value, FcBool append);
|
FcPatternAdd (FcPattern *p, const char *object, FcValue value, FcBool append);
|
||||||
|
|
||||||
|
|
78
src/fcdbg.c
78
src/fcdbg.c
|
@ -210,6 +210,84 @@ FcPatternPrint (const FcPattern *p)
|
||||||
printf ("(ignore blanks)"); \
|
printf ("(ignore blanks)"); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FcPatternPrint2 (FcPattern *pp1,
|
||||||
|
FcPattern *pp2,
|
||||||
|
const FcObjectSet *os)
|
||||||
|
{
|
||||||
|
int i, j, k, pos;
|
||||||
|
FcPatternElt *e1, *e2;
|
||||||
|
FcPattern *p1, *p2;
|
||||||
|
|
||||||
|
if (os)
|
||||||
|
{
|
||||||
|
p1 = FcPatternFilter (pp1, os);
|
||||||
|
p2 = FcPatternFilter (pp2, os);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p1 = pp1;
|
||||||
|
p2 = pp2;
|
||||||
|
}
|
||||||
|
printf ("Pattern has %d elts (size %d), %d elts (size %d)\n",
|
||||||
|
p1->num, p1->size, p2->num, p2->size);
|
||||||
|
for (i = 0, j = 0; i < p1->num; i++)
|
||||||
|
{
|
||||||
|
e1 = &FcPatternElts(p1)[i];
|
||||||
|
e2 = &FcPatternElts(p2)[j];
|
||||||
|
if (e1->object != e2->object)
|
||||||
|
{
|
||||||
|
pos = FcPatternPosition (p2, FcObjectName (e1->object));
|
||||||
|
if (pos >= 0)
|
||||||
|
{
|
||||||
|
for (k = j; k < pos; k++)
|
||||||
|
{
|
||||||
|
e2 = &FcPatternElts(p2)[k];
|
||||||
|
printf ("\t%s: (None) -> ", FcObjectName (e2->object));
|
||||||
|
FcValueListPrint (FcPatternEltValues (e2));
|
||||||
|
printf ("\n");
|
||||||
|
}
|
||||||
|
j = pos;
|
||||||
|
goto cont;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf ("\t%s:", FcObjectName (e1->object));
|
||||||
|
FcValueListPrint (FcPatternEltValues (e1));
|
||||||
|
printf (" -> (None)\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cont:
|
||||||
|
printf ("\t%s:", FcObjectName (e1->object));
|
||||||
|
FcValueListPrint (FcPatternEltValues (e1));
|
||||||
|
printf (" -> ");
|
||||||
|
e2 = &FcPatternElts(p2)[j];
|
||||||
|
FcValueListPrint (FcPatternEltValues (e2));
|
||||||
|
printf ("\n");
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (j < p2->num)
|
||||||
|
{
|
||||||
|
for (k = j; k < p2->num; k++)
|
||||||
|
{
|
||||||
|
e2 = &FcPatternElts(p2)[k];
|
||||||
|
if (FcObjectName (e2->object))
|
||||||
|
{
|
||||||
|
printf ("\t%s: (None) -> ", FcObjectName (e2->object));
|
||||||
|
FcValueListPrint (FcPatternEltValues (e2));
|
||||||
|
printf ("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (p1 != pp1)
|
||||||
|
FcPatternDestroy (p1);
|
||||||
|
if (p2 != pp2)
|
||||||
|
FcPatternDestroy (p2);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FcOpPrint (FcOp op_)
|
FcOpPrint (FcOp op_)
|
||||||
{
|
{
|
||||||
|
|
|
@ -87,6 +87,7 @@ extern pfnSHGetFolderPathA pSHGetFolderPathA;
|
||||||
#define FC_DBG_SCANV 256
|
#define FC_DBG_SCANV 256
|
||||||
#define FC_DBG_CONFIG 1024
|
#define FC_DBG_CONFIG 1024
|
||||||
#define FC_DBG_LANGSET 2048
|
#define FC_DBG_LANGSET 2048
|
||||||
|
#define FC_DBG_MATCH2 4096
|
||||||
|
|
||||||
#define _FC_ASSERT_STATIC1(_line, _cond) typedef int _static_assert_on_line_##_line##_failed[(_cond)?1:-1] FC_UNUSED
|
#define _FC_ASSERT_STATIC1(_line, _cond) typedef int _static_assert_on_line_##_line##_failed[(_cond)?1:-1] FC_UNUSED
|
||||||
#define _FC_ASSERT_STATIC0(_line, _cond) _FC_ASSERT_STATIC1 (_line, (_cond))
|
#define _FC_ASSERT_STATIC0(_line, _cond) _FC_ASSERT_STATIC1 (_line, (_cond))
|
||||||
|
|
|
@ -689,6 +689,47 @@ FcFontSetMatchInternal (FcFontSet **sets,
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
FcPatternPrint (best);
|
FcPatternPrint (best);
|
||||||
}
|
}
|
||||||
|
if (FcDebug () & FC_DBG_MATCH2)
|
||||||
|
{
|
||||||
|
char *env = getenv ("FC_DBG_MATCH_FILTER");
|
||||||
|
FcObjectSet *os = NULL;
|
||||||
|
|
||||||
|
if (env)
|
||||||
|
{
|
||||||
|
char *ss, *s;
|
||||||
|
char *p;
|
||||||
|
FcBool f = FcTrue;
|
||||||
|
|
||||||
|
ss = s = strdup (env);
|
||||||
|
os = FcObjectSetCreate ();
|
||||||
|
while (f)
|
||||||
|
{
|
||||||
|
size_t len;
|
||||||
|
char *x;
|
||||||
|
|
||||||
|
if (!(p = strchr (s, ',')))
|
||||||
|
{
|
||||||
|
f = FcFalse;
|
||||||
|
len = strlen (s) + 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
len = (p - s) + 1;
|
||||||
|
}
|
||||||
|
x = malloc (sizeof (char) * len);
|
||||||
|
strncpy (x, s, len - 1);
|
||||||
|
x[len - 1] = 0;
|
||||||
|
if (FcObjectFromName (x) > 0)
|
||||||
|
FcObjectSetAdd (os, x);
|
||||||
|
s = p + 1;
|
||||||
|
free (x);
|
||||||
|
}
|
||||||
|
free (ss);
|
||||||
|
}
|
||||||
|
FcPatternPrint2 (p, best, os);
|
||||||
|
if (os)
|
||||||
|
FcObjectSetDestroy (os);
|
||||||
|
}
|
||||||
/* assuming that 'result' is initialized with FcResultNoMatch
|
/* assuming that 'result' is initialized with FcResultNoMatch
|
||||||
* outside this function */
|
* outside this function */
|
||||||
if (best)
|
if (best)
|
||||||
|
|
|
@ -425,6 +425,12 @@ FcPatternObjectPosition (const FcPattern *p, FcObject object)
|
||||||
return -(mid + 1);
|
return -(mid + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
FcPatternPosition (const FcPattern *p, const char *object)
|
||||||
|
{
|
||||||
|
return FcPatternObjectPosition (p, FcObjectFromName (object));
|
||||||
|
}
|
||||||
|
|
||||||
FcPatternElt *
|
FcPatternElt *
|
||||||
FcPatternObjectFindElt (const FcPattern *p, FcObject object)
|
FcPatternObjectFindElt (const FcPattern *p, FcObject object)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue