From be0948508ce4ebbb6e576b9dd31531efef6834e1 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 31 May 2002 23:21:25 +0000 Subject: [PATCH] Add support for user-provided freetype faces to Xft --- fontconfig/fcfreetype.h | 8 +++++++- fontconfig/fcprivate.h | 4 +++- fontconfig/fontconfig.h | 7 +++++-- src/fccharset.c | 5 +---- src/fcfreetype.c | 1 - src/fcint.h | 3 ++- src/fcpat.c | 29 ++++++++++++++++++++++++++++- 7 files changed, 46 insertions(+), 11 deletions(-) diff --git a/fontconfig/fcfreetype.h b/fontconfig/fcfreetype.h index 794e8e8..8d52d54 100644 --- a/fontconfig/fcfreetype.h +++ b/fontconfig/fcfreetype.h @@ -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 diff --git a/fontconfig/fcprivate.h b/fontconfig/fcprivate.h index 02732e8..16ea543 100644 --- a/fontconfig/fcprivate.h +++ b/fontconfig/fcprivate.h @@ -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; \ diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h index a75d741..fa1d0e8 100644 --- a/fontconfig/fontconfig.h +++ b/fontconfig/fontconfig.h @@ -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; diff --git a/src/fccharset.c b/src/fccharset.c index 1571741..c5ff183 100644 --- a/src/fccharset.c +++ b/src/fccharset.c @@ -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 -#include - /* * Figure out whether the available freetype has FT_Get_Next_Char */ diff --git a/src/fcfreetype.c b/src/fcfreetype.c index ccd9651..1005090 100644 --- a/src/fcfreetype.c +++ b/src/fcfreetype.c @@ -29,7 +29,6 @@ #include #include #include -#include static const struct { int bit; diff --git a/src/fcint.h b/src/fcint.h index d9a8703..beaa7c9 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -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 #include #include +#include #ifdef HAVE_CONFIG_H #include #endif diff --git a/src/fcpat.c b/src/fcpat.c index 164bea1..2ed2eca 100644 --- a/src/fcpat.c +++ b/src/fcpat.c @@ -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) { -- 2.39.5