]> git.wh0rd.org - fontconfig.git/commitdiff
Add support for user-provided freetype faces to Xft
authorKeith Packard <keithp@keithp.com>
Fri, 31 May 2002 23:21:25 +0000 (23:21 +0000)
committerKeith Packard <keithp@keithp.com>
Fri, 31 May 2002 23:21:25 +0000 (23:21 +0000)
fontconfig/fcfreetype.h
fontconfig/fcprivate.h
fontconfig/fontconfig.h
src/fccharset.c
src/fcfreetype.c
src/fcint.h
src/fcpat.c

index 794e8e8162029d52ad2d69b42aa16e4eea4f27d5..8d52d546147c46382dba22447c934245458b3e53 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $XFree86: $
+ * $XFree86: xc/lib/fontconfig/fontconfig/fcfreetype.h,v 1.2 2002/02/15 06:01:27 keithp Exp $
  *
  * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
  *
@@ -32,4 +32,10 @@ FcFreeTypeCharIndex (FT_Face face, FcChar32 ucs4);
 FcCharSet *
 FcFreeTypeCharSet (FT_Face face, FcBlanks *blanks);
 
+FcResult
+FcPatternGetFTFace (FcPattern *p, const char *object, int n, FT_Face *f);
+
+FcBool
+FcPatternAddFTFace (FcPattern *p, const char *object, const FT_Face f);
+
 #endif
index 02732e80156be268af46de824958361d9c4a3935..16ea543ead1a4e7219e7536ae7e5d426f30ae85d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $XFree86: $
+ * $XFree86: xc/lib/fontconfig/fontconfig/fcprivate.h,v 1.2 2002/02/15 06:01:27 keithp Exp $
  *
  * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
  *
@@ -70,6 +70,8 @@
        case FcTypeCharSet:                                         \
            __v__.u.c = va_arg (va, FcCharSet *);                   \
            break;                                                  \
+       case FcTypeFTFace:                                          \
+           __v__.u.f = va_arg (va, FT_Face);                       \
        }                                                           \
        if (!FcPatternAdd (__p__, __o__, __v__, FcTrue))            \
            goto _FcPatternVapBuild_bail1;                          \
index a75d741c2392cc32b05edb79a5b0f31823eddad8..fa1d0e81ebe775a0e62ba9c207c2ce35c4bec3d9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $XFree86: xc/lib/fontconfig/fontconfig/fontconfig.h,v 1.12 2002/05/29 08:21:33 keithp Exp $
+ * $XFree86: xc/lib/fontconfig/fontconfig/fontconfig.h,v 1.13 2002/05/31 04:42:42 keithp Exp $
  *
  * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
  *
@@ -59,6 +59,7 @@ typedef int           FcBool;
 #define FC_GLOBAL_ADVANCE   "globaladvance"    /* Bool (true) */
 #define FC_FILE                    "file"              /* String */
 #define FC_INDEX           "index"             /* Int */
+#define FC_FT_FACE         "ftface"            /* FT_Face */
 #define FC_RASTERIZER      "rasterizer"        /* String */
 #define FC_OUTLINE         "outline"           /* Bool */
 #define FC_SCALABLE        "scalable"          /* Bool */
@@ -145,7 +146,8 @@ typedef enum _FcType {
     FcTypeString, 
     FcTypeBool,
     FcTypeMatrix,
-    FcTypeCharSet
+    FcTypeCharSet,
+    FcTypeFTFace
 } FcType;
 
 typedef struct _FcMatrix {
@@ -186,6 +188,7 @@ typedef struct _FcValue {
        double          d;
        const FcMatrix  *m;
        const FcCharSet *c;
+       void            *f;
     } u;
 } FcValue;
 
index 1571741878366b8440975beed7aacb141a7fa9b3..c5ff183d62c0a4d9d65e4dcd71ba421fc3441292 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $XFree86: xc/lib/fontconfig/src/fccharset.c,v 1.9 2002/05/29 22:07:33 keithp Exp $
+ * $XFree86: xc/lib/fontconfig/src/fccharset.c,v 1.10 2002/05/31 04:42:42 keithp Exp $
  *
  * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
  *
@@ -1099,9 +1099,6 @@ FcNameUnparseCharSet (FcStrBuf *buf, const FcCharSet *c)
     return FcTrue;
 }
 
-#include <freetype/freetype.h>
-#include <fontconfig/fcfreetype.h>
-
 /*
  * Figure out whether the available freetype has FT_Get_Next_Char
  */
index ccd96510ecceb509409cb19a204ea3339378174e..100509055545da7328d98bbaba724d2b4df1f3c9 100644 (file)
@@ -29,7 +29,6 @@
 #include <freetype/freetype.h>
 #include <freetype/internal/ftobjs.h>
 #include <freetype/tttables.h>
-#include <fontconfig/fcfreetype.h>
 
 static const struct {
     int            bit;
index d9a870319fb22efe0dde8535d4cf32fe7edd8a5c..beaa7c9931633d81bf6727b37bda2530ab4c0c5f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $XFree86: xc/lib/fontconfig/src/fcint.h,v 1.10 2002/05/29 22:07:33 keithp Exp $
+ * $XFree86: xc/lib/fontconfig/src/fcint.h,v 1.11 2002/05/31 04:42:42 keithp Exp $
  *
  * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
  *
@@ -36,6 +36,7 @@
 #include <time.h>
 #include <fontconfig/fontconfig.h>
 #include <fontconfig/fcprivate.h>
+#include <fontconfig/fcfreetype.h>
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 164bea1611e529b8904c8050deba56291be8c8f2..2ed2eca102465e4afd12644405c35ad6914510eb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $XFree86: xc/lib/fontconfig/src/fcpat.c,v 1.4 2002/05/22 04:12:35 keithp Exp $
+ * $XFree86: xc/lib/fontconfig/src/fcpat.c,v 1.5 2002/05/29 22:07:33 keithp Exp $
  *
  * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
  *
@@ -142,6 +142,8 @@ FcValueEqual (FcValue va, FcValue vb)
        return FcMatrixEqual (va.u.m, vb.u.m);
     case FcTypeCharSet:
        return FcCharSetEqual (va.u.c, vb.u.c);
+    case FcTypeFTFace:
+       return va.u.f == vb.u.f;
     }
     return FcFalse;
 }
@@ -416,6 +418,16 @@ FcPatternAddCharSet (FcPattern *p, const char *object, const FcCharSet *c)
     return FcPatternAdd (p, object, v, FcTrue);
 }
 
+FcBool
+FcPatternAddFTFace (FcPattern *p, const char *object, const FT_Face f)
+{
+    FcValue    v;
+
+    v.type = FcTypeFTFace;
+    v.u.f = (void *) f;
+    return FcPatternAdd (p, object, v, FcTrue);
+}
+
 FcResult
 FcPatternGet (FcPattern *p, const char *object, int id, FcValue *v)
 {
@@ -542,6 +554,21 @@ FcPatternGetCharSet (FcPattern *p, const char *object, int id, FcCharSet **c)
     return FcResultMatch;
 }
 
+FcResult
+FcPatternGetFTFace (FcPattern *p, const char *object, int id, FT_Face *f)
+{
+    FcValue    v;
+    FcResult   r;
+
+    r = FcPatternGet (p, object, id, &v);
+    if (r != FcResultMatch)
+       return r;
+    if (v.type != FcTypeFTFace)
+       return FcResultTypeMismatch;
+    *f = (FT_Face) v.u.f;
+    return FcResultMatch;
+}
+
 FcPattern *
 FcPatternDuplicate (FcPattern *orig)
 {