Add support for user-provided freetype faces to Xft
This commit is contained in:
parent
bff617fa56
commit
be0948508c
|
@ -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.
|
* Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
|
||||||
*
|
*
|
||||||
|
@ -32,4 +32,10 @@ FcFreeTypeCharIndex (FT_Face face, FcChar32 ucs4);
|
||||||
FcCharSet *
|
FcCharSet *
|
||||||
FcFreeTypeCharSet (FT_Face face, FcBlanks *blanks);
|
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
|
#endif
|
||||||
|
|
|
@ -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.
|
* Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
|
||||||
*
|
*
|
||||||
|
@ -70,6 +70,8 @@
|
||||||
case FcTypeCharSet: \
|
case FcTypeCharSet: \
|
||||||
__v__.u.c = va_arg (va, FcCharSet *); \
|
__v__.u.c = va_arg (va, FcCharSet *); \
|
||||||
break; \
|
break; \
|
||||||
|
case FcTypeFTFace: \
|
||||||
|
__v__.u.f = va_arg (va, FT_Face); \
|
||||||
} \
|
} \
|
||||||
if (!FcPatternAdd (__p__, __o__, __v__, FcTrue)) \
|
if (!FcPatternAdd (__p__, __o__, __v__, FcTrue)) \
|
||||||
goto _FcPatternVapBuild_bail1; \
|
goto _FcPatternVapBuild_bail1; \
|
||||||
|
|
|
@ -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.
|
* 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_GLOBAL_ADVANCE "globaladvance" /* Bool (true) */
|
||||||
#define FC_FILE "file" /* String */
|
#define FC_FILE "file" /* String */
|
||||||
#define FC_INDEX "index" /* Int */
|
#define FC_INDEX "index" /* Int */
|
||||||
|
#define FC_FT_FACE "ftface" /* FT_Face */
|
||||||
#define FC_RASTERIZER "rasterizer" /* String */
|
#define FC_RASTERIZER "rasterizer" /* String */
|
||||||
#define FC_OUTLINE "outline" /* Bool */
|
#define FC_OUTLINE "outline" /* Bool */
|
||||||
#define FC_SCALABLE "scalable" /* Bool */
|
#define FC_SCALABLE "scalable" /* Bool */
|
||||||
|
@ -145,7 +146,8 @@ typedef enum _FcType {
|
||||||
FcTypeString,
|
FcTypeString,
|
||||||
FcTypeBool,
|
FcTypeBool,
|
||||||
FcTypeMatrix,
|
FcTypeMatrix,
|
||||||
FcTypeCharSet
|
FcTypeCharSet,
|
||||||
|
FcTypeFTFace
|
||||||
} FcType;
|
} FcType;
|
||||||
|
|
||||||
typedef struct _FcMatrix {
|
typedef struct _FcMatrix {
|
||||||
|
@ -186,6 +188,7 @@ typedef struct _FcValue {
|
||||||
double d;
|
double d;
|
||||||
const FcMatrix *m;
|
const FcMatrix *m;
|
||||||
const FcCharSet *c;
|
const FcCharSet *c;
|
||||||
|
void *f;
|
||||||
} u;
|
} u;
|
||||||
} FcValue;
|
} FcValue;
|
||||||
|
|
||||||
|
|
|
@ -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.
|
* Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
|
||||||
*
|
*
|
||||||
|
@ -1099,9 +1099,6 @@ FcNameUnparseCharSet (FcStrBuf *buf, const FcCharSet *c)
|
||||||
return FcTrue;
|
return FcTrue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <freetype/freetype.h>
|
|
||||||
#include <fontconfig/fcfreetype.h>
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Figure out whether the available freetype has FT_Get_Next_Char
|
* Figure out whether the available freetype has FT_Get_Next_Char
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
#include <freetype/freetype.h>
|
#include <freetype/freetype.h>
|
||||||
#include <freetype/internal/ftobjs.h>
|
#include <freetype/internal/ftobjs.h>
|
||||||
#include <freetype/tttables.h>
|
#include <freetype/tttables.h>
|
||||||
#include <fontconfig/fcfreetype.h>
|
|
||||||
|
|
||||||
static const struct {
|
static const struct {
|
||||||
int bit;
|
int bit;
|
||||||
|
|
|
@ -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.
|
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
|
||||||
*
|
*
|
||||||
|
@ -36,6 +36,7 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <fontconfig/fontconfig.h>
|
#include <fontconfig/fontconfig.h>
|
||||||
#include <fontconfig/fcprivate.h>
|
#include <fontconfig/fcprivate.h>
|
||||||
|
#include <fontconfig/fcfreetype.h>
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
29
src/fcpat.c
29
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.
|
* 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);
|
return FcMatrixEqual (va.u.m, vb.u.m);
|
||||||
case FcTypeCharSet:
|
case FcTypeCharSet:
|
||||||
return FcCharSetEqual (va.u.c, vb.u.c);
|
return FcCharSetEqual (va.u.c, vb.u.c);
|
||||||
|
case FcTypeFTFace:
|
||||||
|
return va.u.f == vb.u.f;
|
||||||
}
|
}
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
}
|
}
|
||||||
|
@ -416,6 +418,16 @@ FcPatternAddCharSet (FcPattern *p, const char *object, const FcCharSet *c)
|
||||||
return FcPatternAdd (p, object, v, FcTrue);
|
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
|
FcResult
|
||||||
FcPatternGet (FcPattern *p, const char *object, int id, FcValue *v)
|
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;
|
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 *
|
FcPattern *
|
||||||
FcPatternDuplicate (FcPattern *orig)
|
FcPatternDuplicate (FcPattern *orig)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue