Switch fontconfig from libxml2 to expat
This commit is contained in:
parent
2eb26602ff
commit
c2e7c611cb
|
@ -25,7 +25,8 @@ INCLUDES=$(FREETYPE2INCLUDES) $(LIBXML2INCLUDES) -I..
|
|||
|
||||
DEFINES=-DFC_FALLBACK_FONTS='"$(FALLBACK_FONTS)"'
|
||||
|
||||
REQUIREDLIBS=$(LDPRELIBS) $(FREETYPE2LIB) $(LIBXML2LIB)
|
||||
EXPATLIB=-lexpat
|
||||
REQUIREDLIBS=$(LDPRELIBS) $(FREETYPE2LIB) $(EXPATLIB)
|
||||
|
||||
SRCS=fcblanks.c fccache.c fccfg.c fccharset.c fcdbg.c fcdefault.c fcdir.c \
|
||||
fcfreetype.c fcfs.c fcinit.c fclist.c fcmatch.c fcmatrix.c fcname.c \
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $XFree86: $
|
||||
* $XFree86: xc/lib/fontconfig/src/fccharset.c,v 1.2 2002/02/15 06:01:28 keithp Exp $
|
||||
*
|
||||
* Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
|
||||
*
|
||||
|
@ -646,12 +646,12 @@ FcCharSetParseValue (FcChar8 *string, FcChar32 *value)
|
|||
}
|
||||
|
||||
static FcBool
|
||||
FcCharSetUnparseValue (FcNameBuf *buf, FcChar32 value)
|
||||
FcCharSetUnparseValue (FcStrBuf *buf, FcChar32 value)
|
||||
{
|
||||
int i;
|
||||
if (value == 0)
|
||||
{
|
||||
return FcNameBufChar (buf, ' ');
|
||||
return FcStrBufChar (buf, ' ');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -664,7 +664,7 @@ FcCharSetUnparseValue (FcNameBuf *buf, FcChar32 value)
|
|||
value /= 85;
|
||||
}
|
||||
for (i = 0; i < 5; i++)
|
||||
if (!FcNameBufChar (buf, *s++))
|
||||
if (!FcStrBufChar (buf, *s++))
|
||||
return FcFalse;
|
||||
}
|
||||
return FcTrue;
|
||||
|
@ -704,7 +704,7 @@ bail0:
|
|||
}
|
||||
|
||||
FcBool
|
||||
FcNameUnparseCharSet (FcNameBuf *buf, const FcCharSet *c)
|
||||
FcNameUnparseCharSet (FcStrBuf *buf, const FcCharSet *c)
|
||||
{
|
||||
FcCharSetIter ci;
|
||||
int i;
|
||||
|
@ -729,7 +729,7 @@ FcNameUnparseCharSet (FcNameBuf *buf, const FcCharSet *c)
|
|||
FcCharSetIter ci, checki;
|
||||
|
||||
/* null terminate for parser */
|
||||
FcNameBufChar (buf, '\0');
|
||||
FcStrBufChar (buf, '\0');
|
||||
/* step back over null for life after test */
|
||||
buf->len--;
|
||||
check = FcNameParseCharSet (buf->buf + len);
|
||||
|
|
20
src/fcdbg.c
20
src/fcdbg.c
|
@ -135,7 +135,10 @@ FcExprPrint (FcExpr *expr)
|
|||
expr->u.mval->yx,
|
||||
expr->u.mval->yy);
|
||||
case FcOpBool: printf ("%s", expr->u.bval ? "true" : "false"); break;
|
||||
case FcOpCharSet: printf ("charset\n"); break;
|
||||
case FcOpNil: printf ("nil\n");
|
||||
case FcOpField: printf ("%s", expr->u.field); break;
|
||||
case FcOpConst: printf ("%s", expr->u.constant); break;
|
||||
case FcOpQuest:
|
||||
FcExprPrint (expr->u.tree.left);
|
||||
printf (" quest ");
|
||||
|
@ -143,6 +146,12 @@ FcExprPrint (FcExpr *expr)
|
|||
printf (" colon ");
|
||||
FcExprPrint (expr->u.tree.right->u.tree.right);
|
||||
break;
|
||||
case FcOpAssign:
|
||||
case FcOpAssignReplace:
|
||||
case FcOpPrependFirst:
|
||||
case FcOpPrepend:
|
||||
case FcOpAppend:
|
||||
case FcOpAppendLast:
|
||||
case FcOpOr:
|
||||
case FcOpAnd:
|
||||
case FcOpEqual:
|
||||
|
@ -156,9 +165,16 @@ FcExprPrint (FcExpr *expr)
|
|||
case FcOpMinus:
|
||||
case FcOpTimes:
|
||||
case FcOpDivide:
|
||||
case FcOpComma:
|
||||
FcExprPrint (expr->u.tree.left);
|
||||
printf (" ");
|
||||
switch (expr->op) {
|
||||
case FcOpAssign: printf ("Assign"); break;
|
||||
case FcOpAssignReplace: printf ("AssignReplace"); break;
|
||||
case FcOpPrependFirst: printf ("PrependFirst"); break;
|
||||
case FcOpPrepend: printf ("Prepend"); break;
|
||||
case FcOpAppend: printf ("Append"); break;
|
||||
case FcOpAppendLast: printf ("AppendLast"); break;
|
||||
case FcOpOr: printf ("Or"); break;
|
||||
case FcOpAnd: printf ("And"); break;
|
||||
case FcOpEqual: printf ("Equal"); break;
|
||||
|
@ -172,6 +188,7 @@ FcExprPrint (FcExpr *expr)
|
|||
case FcOpMinus: printf ("Minus"); break;
|
||||
case FcOpTimes: printf ("Times"); break;
|
||||
case FcOpDivide: printf ("Divide"); break;
|
||||
case FcOpComma: printf ("Comma"); break;
|
||||
default: break;
|
||||
}
|
||||
printf (" ");
|
||||
|
@ -181,8 +198,7 @@ FcExprPrint (FcExpr *expr)
|
|||
printf ("Not ");
|
||||
FcExprPrint (expr->u.tree.left);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case FcOpInvalid: printf ("Invalid"); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
34
src/fcint.h
34
src/fcint.h
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $XFree86: $
|
||||
* $XFree86: xc/lib/fontconfig/src/fcint.h,v 1.2 2002/02/15 06:01:28 keithp Exp $
|
||||
*
|
||||
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
|
||||
*
|
||||
|
@ -33,10 +33,8 @@
|
|||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <libxml/parserInternals.h>
|
||||
#include <fontconfig/fontconfig.h>
|
||||
#include <fontconfig/fcprivate.h>
|
||||
#include <fontconfig/fcxml.h>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
@ -175,13 +173,13 @@ struct _FcCharSet {
|
|||
FcCharNode node;
|
||||
};
|
||||
|
||||
typedef struct _FcNameBuf {
|
||||
typedef struct _FcStrBuf {
|
||||
FcChar8 *buf;
|
||||
FcBool allocated;
|
||||
FcBool failed;
|
||||
int len;
|
||||
int size;
|
||||
} FcNameBuf;
|
||||
} FcStrBuf;
|
||||
|
||||
typedef struct _FcFileCacheEnt {
|
||||
struct _FcFileCacheEnt *next;
|
||||
|
@ -315,7 +313,7 @@ FcConfigCompareValue (const FcValue m,
|
|||
|
||||
/* fccharset.c */
|
||||
FcBool
|
||||
FcNameUnparseCharSet (FcNameBuf *buf, const FcCharSet *c);
|
||||
FcNameUnparseCharSet (FcStrBuf *buf, const FcCharSet *c);
|
||||
|
||||
FcCharSet *
|
||||
FcNameParseCharSet (FcChar8 *string);
|
||||
|
@ -372,7 +370,7 @@ char *
|
|||
FcConfigSaveField (const char *field);
|
||||
|
||||
FcTest *
|
||||
FcTestCreate (FcQual qual, const char *field, FcOp compare, FcExpr *expr);
|
||||
FcTestCreate (FcQual qual, const FcChar8 *field, FcOp compare, FcExpr *expr);
|
||||
|
||||
void
|
||||
FcTestDestroy (FcTest *test);
|
||||
|
@ -434,10 +432,10 @@ FcBool
|
|||
FcNameBool (FcChar8 *v, FcBool *result);
|
||||
|
||||
FcBool
|
||||
FcNameBufChar (FcNameBuf *buf, FcChar8 c);
|
||||
FcStrBufChar (FcStrBuf *buf, FcChar8 c);
|
||||
|
||||
FcBool
|
||||
FcNameBufString (FcNameBuf *buf, const FcChar8 *s);
|
||||
FcStrBufString (FcStrBuf *buf, const FcChar8 *s);
|
||||
|
||||
/* fcpat.c */
|
||||
void
|
||||
|
@ -459,4 +457,22 @@ FcStrPlus (const FcChar8 *s1, const FcChar8 *s2);
|
|||
void
|
||||
FcStrFree (FcChar8 *s);
|
||||
|
||||
void
|
||||
FcStrBufInit (FcStrBuf *buf, FcChar8 *init, int size);
|
||||
|
||||
void
|
||||
FcStrBufDestroy (FcStrBuf *buf);
|
||||
|
||||
FcChar8 *
|
||||
FcStrBufDone (FcStrBuf *buf);
|
||||
|
||||
FcBool
|
||||
FcStrBufChar (FcStrBuf *buf, FcChar8 c);
|
||||
|
||||
FcBool
|
||||
FcStrBufString (FcStrBuf *buf, const FcChar8 *s);
|
||||
|
||||
FcBool
|
||||
FcStrBufData (FcStrBuf *buf, const FcChar8 *s, int len);
|
||||
|
||||
#endif /* _FC_INT_H_ */
|
||||
|
|
98
src/fcname.c
98
src/fcname.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $XFree86: xc/lib/Fc/xftname.c,v 1.10 2001/03/30 18:50:18 keithp Exp $
|
||||
* $XFree86: xc/lib/fontconfig/src/fcname.c,v 1.2 2002/02/15 06:01:28 keithp Exp $
|
||||
*
|
||||
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
|
||||
*
|
||||
|
@ -418,86 +418,8 @@ bail1:
|
|||
bail0:
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
FcNameBufInit (FcNameBuf *buf, FcChar8 *init, int size)
|
||||
{
|
||||
buf->buf = init;
|
||||
buf->allocated = FcFalse;
|
||||
buf->failed = FcFalse;
|
||||
buf->len = 0;
|
||||
buf->size = size;
|
||||
}
|
||||
|
||||
static void
|
||||
FcNameBufDestroy (FcNameBuf *buf)
|
||||
{
|
||||
if (buf->allocated)
|
||||
free (buf->buf);
|
||||
}
|
||||
|
||||
static FcChar8 *
|
||||
FcNameBufDone (FcNameBuf *buf)
|
||||
{
|
||||
FcChar8 *ret;
|
||||
|
||||
ret = malloc (buf->len + 1);
|
||||
if (ret)
|
||||
{
|
||||
memcpy (ret, buf->buf, buf->len);
|
||||
ret[buf->len] = '\0';
|
||||
}
|
||||
FcNameBufDestroy (buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
FcBool
|
||||
FcNameBufChar (FcNameBuf *buf, FcChar8 c)
|
||||
{
|
||||
if (buf->len == buf->size)
|
||||
{
|
||||
FcChar8 *new;
|
||||
int size;
|
||||
|
||||
if (buf->allocated)
|
||||
{
|
||||
size = buf->size * 2;
|
||||
new = realloc (buf->buf, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
size = buf->size + 1024;
|
||||
new = malloc (size);
|
||||
if (new)
|
||||
{
|
||||
buf->allocated = FcTrue;
|
||||
memcpy (new, buf->buf, buf->len);
|
||||
}
|
||||
}
|
||||
if (!new)
|
||||
{
|
||||
buf->failed = FcTrue;
|
||||
return FcFalse;
|
||||
}
|
||||
buf->size = size;
|
||||
buf->buf = new;
|
||||
}
|
||||
buf->buf[buf->len++] = c;
|
||||
return FcTrue;
|
||||
}
|
||||
|
||||
FcBool
|
||||
FcNameBufString (FcNameBuf *buf, const FcChar8 *s)
|
||||
{
|
||||
FcChar8 c;
|
||||
while ((c = *s++))
|
||||
if (!FcNameBufChar (buf, c))
|
||||
return FcFalse;
|
||||
return FcTrue;
|
||||
}
|
||||
|
||||
static FcBool
|
||||
FcNameUnparseString (FcNameBuf *buf,
|
||||
FcNameUnparseString (FcStrBuf *buf,
|
||||
const FcChar8 *string,
|
||||
const FcChar8 *escape)
|
||||
{
|
||||
|
@ -506,17 +428,17 @@ FcNameUnparseString (FcNameBuf *buf,
|
|||
{
|
||||
if (escape && strchr ((char *) escape, (char) c))
|
||||
{
|
||||
if (!FcNameBufChar (buf, escape[0]))
|
||||
if (!FcStrBufChar (buf, escape[0]))
|
||||
return FcFalse;
|
||||
}
|
||||
if (!FcNameBufChar (buf, c))
|
||||
if (!FcStrBufChar (buf, c))
|
||||
return FcFalse;
|
||||
}
|
||||
return FcTrue;
|
||||
}
|
||||
|
||||
static FcBool
|
||||
FcNameUnparseValue (FcNameBuf *buf,
|
||||
FcNameUnparseValue (FcStrBuf *buf,
|
||||
FcValue v,
|
||||
FcChar8 *escape)
|
||||
{
|
||||
|
@ -546,7 +468,7 @@ FcNameUnparseValue (FcNameBuf *buf,
|
|||
}
|
||||
|
||||
static FcBool
|
||||
FcNameUnparseValueList (FcNameBuf *buf,
|
||||
FcNameUnparseValueList (FcStrBuf *buf,
|
||||
FcValueList *v,
|
||||
FcChar8 *escape)
|
||||
{
|
||||
|
@ -567,14 +489,14 @@ FcNameUnparseValueList (FcNameBuf *buf,
|
|||
FcChar8 *
|
||||
FcNameUnparse (FcPattern *pat)
|
||||
{
|
||||
FcNameBuf buf;
|
||||
FcStrBuf buf;
|
||||
FcChar8 buf_static[8192];
|
||||
int i;
|
||||
FcPatternElt *e;
|
||||
const FcObjectTypeList *l;
|
||||
const FcObjectType *o;
|
||||
|
||||
FcNameBufInit (&buf, buf_static, sizeof (buf_static));
|
||||
FcStrBufInit (&buf, buf_static, sizeof (buf_static));
|
||||
e = FcPatternFind (pat, FC_FAMILY, FcFalse);
|
||||
if (e)
|
||||
{
|
||||
|
@ -614,8 +536,8 @@ FcNameUnparse (FcPattern *pat)
|
|||
}
|
||||
}
|
||||
}
|
||||
return FcNameBufDone (&buf);
|
||||
return FcStrBufDone (&buf);
|
||||
bail0:
|
||||
FcNameBufDestroy (&buf);
|
||||
FcStrBufDestroy (&buf);
|
||||
return 0;
|
||||
}
|
||||
|
|
92
src/fcstr.c
92
src/fcstr.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $XFree86: $
|
||||
* $XFree86: xc/lib/fontconfig/src/fcstr.c,v 1.2 2002/02/15 06:01:28 keithp Exp $
|
||||
*
|
||||
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
|
||||
*
|
||||
|
@ -186,3 +186,93 @@ FcUtf8Len (FcChar8 *string,
|
|||
*wchar = 1;
|
||||
return FcTrue;
|
||||
}
|
||||
|
||||
void
|
||||
FcStrBufInit (FcStrBuf *buf, FcChar8 *init, int size)
|
||||
{
|
||||
buf->buf = init;
|
||||
buf->allocated = FcFalse;
|
||||
buf->failed = FcFalse;
|
||||
buf->len = 0;
|
||||
buf->size = size;
|
||||
}
|
||||
|
||||
void
|
||||
FcStrBufDestroy (FcStrBuf *buf)
|
||||
{
|
||||
if (buf->allocated)
|
||||
{
|
||||
free (buf->buf);
|
||||
FcStrBufInit (buf, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
FcChar8 *
|
||||
FcStrBufDone (FcStrBuf *buf)
|
||||
{
|
||||
FcChar8 *ret;
|
||||
|
||||
ret = malloc (buf->len + 1);
|
||||
if (ret)
|
||||
{
|
||||
memcpy (ret, buf->buf, buf->len);
|
||||
ret[buf->len] = '\0';
|
||||
}
|
||||
FcStrBufDestroy (buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
FcBool
|
||||
FcStrBufChar (FcStrBuf *buf, FcChar8 c)
|
||||
{
|
||||
if (buf->len == buf->size)
|
||||
{
|
||||
FcChar8 *new;
|
||||
int size;
|
||||
|
||||
if (buf->allocated)
|
||||
{
|
||||
size = buf->size * 2;
|
||||
new = realloc (buf->buf, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
size = buf->size + 1024;
|
||||
new = malloc (size);
|
||||
if (new)
|
||||
{
|
||||
buf->allocated = FcTrue;
|
||||
memcpy (new, buf->buf, buf->len);
|
||||
}
|
||||
}
|
||||
if (!new)
|
||||
{
|
||||
buf->failed = FcTrue;
|
||||
return FcFalse;
|
||||
}
|
||||
buf->size = size;
|
||||
buf->buf = new;
|
||||
}
|
||||
buf->buf[buf->len++] = c;
|
||||
return FcTrue;
|
||||
}
|
||||
|
||||
FcBool
|
||||
FcStrBufString (FcStrBuf *buf, const FcChar8 *s)
|
||||
{
|
||||
FcChar8 c;
|
||||
while ((c = *s++))
|
||||
if (!FcStrBufChar (buf, c))
|
||||
return FcFalse;
|
||||
return FcTrue;
|
||||
}
|
||||
|
||||
FcBool
|
||||
FcStrBufData (FcStrBuf *buf, const FcChar8 *s, int len)
|
||||
{
|
||||
while (len-- > 0)
|
||||
if (!FcStrBufChar (buf, *s++))
|
||||
return FcFalse;
|
||||
return FcTrue;
|
||||
}
|
||||
|
||||
|
|
1920
src/fcxml.c
1920
src/fcxml.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue