[Fontconfig] fontconfig: Branch 'master' - 3 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Mon Dec 31 18:11:31 PST 2012


 doc/fontconfig-user.sgml |   12 +++++++++---
 src/fccfg.c              |   21 +++++++++++++++------
 src/fcname.c             |    1 +
 3 files changed, 25 insertions(+), 9 deletions(-)

New commits:
commit 209750a4e0a3e1d7b8c5c971e9e2cbd5770d959f
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Dec 31 20:11:12 2012 -0600

    Warn if <name target="font"> appears in <match target="pattern">

diff --git a/src/fccfg.c b/src/fccfg.c
index 1454f33..06f672b 100644
--- a/src/fccfg.c
+++ b/src/fccfg.c
@@ -164,7 +164,7 @@ FcConfigUptoDate (FcConfig *config)
         (font_time.set && (font_time.time - now) > 0))
 	{
 	    fprintf (stderr,
-                    "Fontconfig warning: Directory/file mtime in the future. New fonts may not be detected\n");
+                    "Fontconfig warning: Directory/file mtime in the future. New fonts may not be detected.\n");
 	    config->rescanTime = now;
 	    return FcTrue;
 	}
@@ -870,7 +870,6 @@ static FcValue
 FcConfigEvaluate (FcPattern *p, FcPattern *p_pat, FcMatchKind kind, FcExpr *e)
 {
     FcValue	v, vl, vr;
-    FcResult	r;
     FcMatrix	*m;
     FcChar8     *str;
     FcOp	op = FC_OP_GET_OP (e->op);
@@ -928,11 +927,21 @@ FcConfigEvaluate (FcPattern *p, FcPattern *p_pat, FcMatchKind kind, FcExpr *e)
 	break;
     case FcOpField:
 	if (kind == FcMatchFont && e->u.name.kind == FcMatchPattern)
-	    r = FcPatternObjectGet (p_pat, e->u.name.object, 0, &v);
-	else
-	    r = FcPatternObjectGet (p, e->u.name.object, 0, &v);
-	if (r != FcResultMatch)
+	{
+	    if (FcResultMatch != FcPatternObjectGet (p_pat, e->u.name.object, 0, &v))
+		v.type = FcTypeVoid;
+	}
+	else if (kind == FcMatchPattern && e->u.name.kind == FcMatchFont)
+	{
+	    fprintf (stderr,
+                    "Fontconfig warning: <name> tag has target=\"font\" in a <match target=\"pattern\">.\n");
 	    v.type = FcTypeVoid;
+	}
+	else
+	{
+	    if (FcResultMatch != FcPatternObjectGet (p, e->u.name.object, 0, &v))
+		v.type = FcTypeVoid;
+	}
 	v = FcValueSave (v);
 	break;
     case FcOpConst:
commit 424cfa1684f8af8bb6ecb01dc83bfc3d0a14f20a
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Dec 31 20:00:17 2012 -0600

    Adjust docs for recent changes

diff --git a/doc/fontconfig-user.sgml b/doc/fontconfig-user.sgml
index f7632ea..c842371 100644
--- a/doc/fontconfig-user.sgml
+++ b/doc/fontconfig-user.sgml
@@ -434,8 +434,9 @@ zero for purely fractional values (e.g. use 0.5 instead of .5 and -0.5
 instead of -.5).
   </para></refsect2>
   <refsect2><title><literal><matrix></literal></title><para>
-This element holds the four <literal><double></literal> elements of an affine
-transformation.
+This element holds four numerical expressions of an affine transformation.
+At their simplest these will be four <literal><double></literal> elements
+but they can also be more involved expressions.
   </para></refsect2>
   <refsect2><title><literal><range></literal></title><para>
 This element holds the two <literal><int></literal> elements of a range
@@ -451,7 +452,12 @@ a RFC-3066-style languages or more.
   </para></refsect2>
   <refsect2><title><literal><name></literal></title><para>
 Holds a property name.  Evaluates to the first value from the property of
-the font, not the pattern.
+the pattern.  If the 'target' attribute is not present, it will default to
+'default', in which case the property is returned from the font pattern
+during a target="font" match, and to the pattern during a target="pattern"
+match.  The attribute can also take the values 'font' or 'pattern' to
+explicitly choose which pattern to use.  It is an error to use a target
+of 'font' in a match that has target="pattern".
   </para></refsect2>
   <refsect2><title><literal><const></literal></title><para>
 Holds the name of a constant; these are always integers and serve as
commit 31ce352bb350a10c6ae08f1415d348458b64bf61
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Dec 31 19:55:37 2012 -0600

    Initialize matrix during name parsing
    
    Before:
    $ fc-match sans:matrix=2 -v | grep matrix
    	matrix: [2 6.95183e-310; 0 0](s)
    
    After:
    $ fc-match sans:matrix=2 -v | grep matrix
    	matrix: [2 0; 0 1](s)

diff --git a/src/fcname.c b/src/fcname.c
index b7c0217..0cdbd42 100644
--- a/src/fcname.c
+++ b/src/fcname.c
@@ -595,6 +595,7 @@ FcNameConvert (FcType type, FcChar8 *string)
 	v.u.d = strtod ((char *) string, 0);
 	break;
     case FcTypeMatrix:
+	m.xx = m.yy = 1.; m.xy = m.yx = 0.;
 	sscanf ((char *) string, "%lg %lg %lg %lg", &m.xx, &m.xy, &m.yx, &m.yy);
 	v.u.m = FcMatrixCopy (&m);
 	break;


More information about the Fontconfig mailing list