fontconfig library: build fixes and compiler warning fixes
This commit is contained in:
parent
3be03bed39
commit
ccb3e93b27
|
@ -1,7 +1,7 @@
|
||||||
INCLUDES=$(FREETYPE2INCLUDES) $(LIBXML2INCLUDES) -I..
|
INCLUDES=$(FREETYPE2INCLUDES) $(LIBXML2INCLUDES) -I..
|
||||||
|
|
||||||
LOCAL_LIBRARIES=FontconfigClientLibs
|
LOCAL_LIBRARIES=FontconfigClientLibs
|
||||||
DEPLIBS=FontconfigDepLibs
|
DEPLIBS=FontconfigClientDepLibs
|
||||||
|
|
||||||
SRCS=fc-cache.c
|
SRCS=fc-cache.c
|
||||||
OBJS=fc-cache.o
|
OBJS=fc-cache.o
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
INCLUDES=$(FREETYPE2INCLUDES) $(LIBXML2INCLUDES) -I..
|
INCLUDES=$(FREETYPE2INCLUDES) $(LIBXML2INCLUDES) -I..
|
||||||
|
|
||||||
LOCAL_LIBRARIES=FontconfigClientLibs
|
LOCAL_LIBRARIES=FontconfigClientLibs
|
||||||
DEPLIBS=FontconfigDepLibs
|
DEPLIBS=FontconfigClientDepLibs
|
||||||
|
|
||||||
SRCS=fc-list.c
|
SRCS=fc-list.c
|
||||||
OBJS=fc-list.o
|
OBJS=fc-list.o
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <fontconfig/fontconfig.h>
|
#include <fontconfig/fontconfig.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#else
|
#else
|
||||||
|
@ -47,7 +48,7 @@ extern int optind, opterr, optopt;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void usage (char *program)
|
static void usage (char *program)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "usage: %s [-vV?] [--verbose] [--version] [--help] [dirs]\n",
|
fprintf (stderr, "usage: %s [-vV?] [--verbose] [--version] [--help] [dirs]\n",
|
||||||
program);
|
program);
|
||||||
|
@ -63,8 +64,6 @@ void usage (char *program)
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
|
||||||
FcFontSet *set;
|
|
||||||
int verbose = 0;
|
int verbose = 0;
|
||||||
int i;
|
int i;
|
||||||
FcObjectSet *os = FcObjectSetBuild (FC_FAMILY, FC_LANG, 0);
|
FcObjectSet *os = FcObjectSetBuild (FC_FAMILY, FC_LANG, 0);
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#ifndef _FCFREETYPE_H_
|
#ifndef _FCFREETYPE_H_
|
||||||
#define _FCFREETYPE_H_
|
#define _FCFREETYPE_H_
|
||||||
|
#include <freetype/freetype.h>
|
||||||
|
|
||||||
FT_UInt
|
FT_UInt
|
||||||
FcFreeTypeCharIndex (FT_Face face, FcChar32 ucs4);
|
FcFreeTypeCharIndex (FT_Face face, FcChar32 ucs4);
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
__v__.u.d = va_arg (va, double); \
|
__v__.u.d = va_arg (va, double); \
|
||||||
break; \
|
break; \
|
||||||
case FcTypeString: \
|
case FcTypeString: \
|
||||||
__v__.u.s = va_arg (va, char *); \
|
__v__.u.s = va_arg (va, FcChar8 *); \
|
||||||
break; \
|
break; \
|
||||||
case FcTypeBool: \
|
case FcTypeBool: \
|
||||||
__v__.u.b = va_arg (va, FcBool); \
|
__v__.u.b = va_arg (va, FcBool); \
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include <libxml/parser.h>
|
#include <libxml/parser.h>
|
||||||
|
|
||||||
xmlDocPtr
|
xmlDocPtr
|
||||||
FcConfigLoad (const char *file);
|
FcConfigLoad (const FcChar8 *file);
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcConfigParse (FcConfig *config,
|
FcConfigParse (FcConfig *config,
|
||||||
|
|
|
@ -168,7 +168,7 @@ typedef struct _FcObjectType {
|
||||||
} FcObjectType;
|
} FcObjectType;
|
||||||
|
|
||||||
typedef struct _FcConstant {
|
typedef struct _FcConstant {
|
||||||
const char *name;
|
const FcChar8 *name;
|
||||||
const char *object;
|
const char *object;
|
||||||
int value;
|
int value;
|
||||||
} FcConstant;
|
} FcConstant;
|
||||||
|
@ -242,8 +242,8 @@ FcBool
|
||||||
FcBlanksIsMember (FcBlanks *b, FcChar32 ucs4);
|
FcBlanksIsMember (FcBlanks *b, FcChar32 ucs4);
|
||||||
|
|
||||||
/* fccfg.c */
|
/* fccfg.c */
|
||||||
char *
|
FcChar8 *
|
||||||
FcConfigFilename (const char *url);
|
FcConfigFilename (const FcChar8 *url);
|
||||||
|
|
||||||
FcConfig *
|
FcConfig *
|
||||||
FcConfigCreate (void);
|
FcConfigCreate (void);
|
||||||
|
@ -260,13 +260,13 @@ FcConfigGetCurrent (void);
|
||||||
FcBool
|
FcBool
|
||||||
FcConfigBuildFonts (FcConfig *config);
|
FcConfigBuildFonts (FcConfig *config);
|
||||||
|
|
||||||
char **
|
FcChar8 **
|
||||||
FcConfigGetDirs (FcConfig *config);
|
FcConfigGetDirs (FcConfig *config);
|
||||||
|
|
||||||
char **
|
FcChar8 **
|
||||||
FcConfigGetConfigFiles (FcConfig *config);
|
FcConfigGetConfigFiles (FcConfig *config);
|
||||||
|
|
||||||
char *
|
FcChar8 *
|
||||||
FcConfigGetCache (FcConfig *config);
|
FcConfigGetCache (FcConfig *config);
|
||||||
|
|
||||||
FcBlanks *
|
FcBlanks *
|
||||||
|
@ -278,11 +278,11 @@ FcConfigGetFonts (FcConfig *config,
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcConfigAppFontAddFile (FcConfig *config,
|
FcConfigAppFontAddFile (FcConfig *config,
|
||||||
const char *file);
|
const FcChar8 *file);
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcConfigAppFontAddDir (FcConfig *config,
|
FcConfigAppFontAddDir (FcConfig *config,
|
||||||
const char *dir);
|
const FcChar8 *dir);
|
||||||
|
|
||||||
void
|
void
|
||||||
FcConfigAppFontClear (FcConfig *config);
|
FcConfigAppFontClear (FcConfig *config);
|
||||||
|
@ -329,12 +329,6 @@ FcCharSetIntersectCount (const FcCharSet *a, const FcCharSet *b);
|
||||||
FcChar32
|
FcChar32
|
||||||
FcCharSetSubtractCount (const FcCharSet *a, const FcCharSet *b);
|
FcCharSetSubtractCount (const FcCharSet *a, const FcCharSet *b);
|
||||||
|
|
||||||
#ifndef FONTCONFIG_NO_FREETYPE
|
|
||||||
#include <freetype/freetype.h>
|
|
||||||
FT_UInt
|
|
||||||
FcFreeTypeCharIndex (FT_Face face, FcChar32 ucs4);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* fcdbg.c */
|
/* fcdbg.c */
|
||||||
void
|
void
|
||||||
FcPatternPrint (FcPattern *p);
|
FcPatternPrint (FcPattern *p);
|
||||||
|
@ -345,18 +339,25 @@ FcDefaultSubstitute (FcPattern *pattern);
|
||||||
|
|
||||||
/* fcdir.c */
|
/* fcdir.c */
|
||||||
FcBool
|
FcBool
|
||||||
FcDirScan (FcFontSet *set,
|
FcFileScan (FcFontSet *set,
|
||||||
FcFileCache *cache,
|
FcFileCache *cache,
|
||||||
FcBlanks *blanks,
|
FcBlanks *blanks,
|
||||||
const char *dir,
|
const FcChar8 *file,
|
||||||
FcBool force);
|
FcBool force);
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcDirSave (FcFontSet *set, const char *dir);
|
FcDirScan (FcFontSet *set,
|
||||||
|
FcFileCache *cache,
|
||||||
|
FcBlanks *blanks,
|
||||||
|
const FcChar8 *dir,
|
||||||
|
FcBool force);
|
||||||
|
|
||||||
|
FcBool
|
||||||
|
FcDirSave (FcFontSet *set, const FcChar8 *dir);
|
||||||
|
|
||||||
/* fcfreetype.c */
|
/* fcfreetype.c */
|
||||||
FcPattern *
|
FcPattern *
|
||||||
FcFreeTypeQuery (const char *file, int id, FcBlanks *blanks, int *count);
|
FcFreeTypeQuery (const FcChar8 *file, int id, FcBlanks *blanks, int *count);
|
||||||
|
|
||||||
/* fcfs.c */
|
/* fcfs.c */
|
||||||
|
|
||||||
|
@ -443,13 +444,13 @@ FcBool
|
||||||
FcNameUnregisterConstants (const FcConstant *consts, int nconsts);
|
FcNameUnregisterConstants (const FcConstant *consts, int nconsts);
|
||||||
|
|
||||||
const FcConstant *
|
const FcConstant *
|
||||||
FcNameGetConstant (char *string);
|
FcNameGetConstant (FcChar8 *string);
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcNameConstant (char *string, int *result);
|
FcNameConstant (FcChar8 *string, int *result);
|
||||||
|
|
||||||
FcPattern *
|
FcPattern *
|
||||||
FcNameParse (const char *name);
|
FcNameParse (const FcChar8 *name);
|
||||||
|
|
||||||
FcChar8 *
|
FcChar8 *
|
||||||
FcNameUnparse (FcPattern *pat);
|
FcNameUnparse (FcPattern *pat);
|
||||||
|
@ -486,7 +487,7 @@ FcBool
|
||||||
FcPatternAddDouble (FcPattern *p, const char *object, double d);
|
FcPatternAddDouble (FcPattern *p, const char *object, double d);
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcPatternAddString (FcPattern *p, const char *object, const char *s);
|
FcPatternAddString (FcPattern *p, const char *object, const FcChar8 *s);
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcPatternAddMatrix (FcPattern *p, const char *object, const FcMatrix *s);
|
FcPatternAddMatrix (FcPattern *p, const char *object, const FcMatrix *s);
|
||||||
|
@ -504,7 +505,7 @@ FcResult
|
||||||
FcPatternGetDouble (FcPattern *p, const char *object, int n, double *d);
|
FcPatternGetDouble (FcPattern *p, const char *object, int n, double *d);
|
||||||
|
|
||||||
FcResult
|
FcResult
|
||||||
FcPatternGetString (FcPattern *p, const char *object, int n, char **const s);
|
FcPatternGetString (FcPattern *p, const char *object, int n, FcChar8 const** s);
|
||||||
|
|
||||||
FcResult
|
FcResult
|
||||||
FcPatternGetMatrix (FcPattern *p, const char *object, int n, FcMatrix **s);
|
FcPatternGetMatrix (FcPattern *p, const char *object, int n, FcMatrix **s);
|
||||||
|
@ -523,13 +524,13 @@ FcPatternBuild (FcPattern *orig, ...);
|
||||||
|
|
||||||
/* fcstr.c */
|
/* fcstr.c */
|
||||||
|
|
||||||
char *
|
FcChar8 *
|
||||||
FcStrCopy (const char *s);
|
FcStrCopy (const FcChar8 *s);
|
||||||
|
|
||||||
#define FcToLower(c) (('A' <= (c) && (c) <= 'Z') ? (c) - 'A' + 'a' : (c))
|
#define FcToLower(c) (('A' <= (c) && (c) <= 'Z') ? (c) - 'A' + 'a' : (c))
|
||||||
|
|
||||||
int
|
int
|
||||||
FcStrCmpIgnoreCase (const char *s1, const char *s2);
|
FcStrCmpIgnoreCase (const FcChar8 *s1, const FcChar8 *s2);
|
||||||
|
|
||||||
int
|
int
|
||||||
FcUtf8ToUcs4 (FcChar8 *src_orig,
|
FcUtf8ToUcs4 (FcChar8 *src_orig,
|
||||||
|
@ -544,7 +545,7 @@ FcUtf8Len (FcChar8 *string,
|
||||||
|
|
||||||
/* fcxml.c */
|
/* fcxml.c */
|
||||||
FcBool
|
FcBool
|
||||||
FcConfigParseAndLoad (FcConfig *config, const char *file, FcBool complain);
|
FcConfigParseAndLoad (FcConfig *config, const FcChar8 *file, FcBool complain);
|
||||||
|
|
||||||
_FCFUNCPROTOEND
|
_FCFUNCPROTOEND
|
||||||
|
|
||||||
|
|
166
src/fccache.c
166
src/fccache.c
|
@ -25,24 +25,24 @@
|
||||||
#include "fcint.h"
|
#include "fcint.h"
|
||||||
|
|
||||||
static unsigned int
|
static unsigned int
|
||||||
FcFileCacheHash (const char *string)
|
FcFileCacheHash (const FcChar8 *string)
|
||||||
{
|
{
|
||||||
unsigned int h = 0;
|
unsigned int h = 0;
|
||||||
char c;
|
FcChar8 c;
|
||||||
|
|
||||||
while ((c = *string++))
|
while ((c = *string++))
|
||||||
h = (h << 1) ^ c;
|
h = (h << 1) ^ c;
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
FcChar8 *
|
||||||
FcFileCacheFind (FcFileCache *cache,
|
FcFileCacheFind (FcFileCache *cache,
|
||||||
const char *file,
|
const FcChar8 *file,
|
||||||
int id,
|
int id,
|
||||||
int *count)
|
int *count)
|
||||||
{
|
{
|
||||||
unsigned int hash;
|
unsigned int hash;
|
||||||
const char *match;
|
const FcChar8 *match;
|
||||||
FcFileCacheEnt *c, *name;
|
FcFileCacheEnt *c, *name;
|
||||||
int maxid;
|
int maxid;
|
||||||
struct stat statb;
|
struct stat statb;
|
||||||
|
@ -60,7 +60,7 @@ FcFileCacheFind (FcFileCache *cache,
|
||||||
maxid = c->id;
|
maxid = c->id;
|
||||||
if (c->id == id)
|
if (c->id == id)
|
||||||
{
|
{
|
||||||
if (stat (file, &statb) < 0)
|
if (stat ((char *) file, &statb) < 0)
|
||||||
{
|
{
|
||||||
if (FcDebug () & FC_DBG_CACHE)
|
if (FcDebug () & FC_DBG_CACHE)
|
||||||
printf (" file missing\n");
|
printf (" file missing\n");
|
||||||
|
@ -94,11 +94,14 @@ FcFileCacheFind (FcFileCache *cache,
|
||||||
* "file_name" id time "font_name" \n
|
* "file_name" id time "font_name" \n
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static FcBool
|
static FcChar8 *
|
||||||
FcFileCacheReadString (FILE *f, char *dest, int len)
|
FcFileCacheReadString (FILE *f, FcChar8 *dest, int len)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
FcBool escape;
|
FcBool escape;
|
||||||
|
FcChar8 *d;
|
||||||
|
int size;
|
||||||
|
int i;
|
||||||
|
|
||||||
while ((c = getc (f)) != EOF)
|
while ((c = getc (f)) != EOF)
|
||||||
if (c == '"')
|
if (c == '"')
|
||||||
|
@ -108,6 +111,9 @@ FcFileCacheReadString (FILE *f, char *dest, int len)
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
|
|
||||||
|
size = len;
|
||||||
|
i = 0;
|
||||||
|
d = dest;
|
||||||
escape = FcFalse;
|
escape = FcFalse;
|
||||||
while ((c = getc (f)) != EOF)
|
while ((c = getc (f)) != EOF)
|
||||||
{
|
{
|
||||||
|
@ -115,19 +121,32 @@ FcFileCacheReadString (FILE *f, char *dest, int len)
|
||||||
{
|
{
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '"':
|
case '"':
|
||||||
*dest++ = '\0';
|
c = '\0';
|
||||||
return FcTrue;
|
break;
|
||||||
case '\\':
|
case '\\':
|
||||||
escape = FcTrue;
|
escape = FcTrue;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (--len <= 1)
|
if (i == size)
|
||||||
return FcFalse;
|
{
|
||||||
*dest++ = c;
|
FcChar8 *new = malloc (size * 2);
|
||||||
|
if (!new)
|
||||||
|
break;
|
||||||
|
memcpy (new, d, size);
|
||||||
|
size *= 2;
|
||||||
|
if (d != dest)
|
||||||
|
free (d);
|
||||||
|
d = new;
|
||||||
|
}
|
||||||
|
d[i++] = c;
|
||||||
|
if (c == '\0')
|
||||||
|
return d;
|
||||||
escape = FcFalse;
|
escape = FcFalse;
|
||||||
}
|
}
|
||||||
return FcFalse;
|
if (d != dest)
|
||||||
|
free (d);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static FcBool
|
static FcBool
|
||||||
|
@ -183,10 +202,10 @@ FcFileCacheReadTime (FILE *f, time_t *dest)
|
||||||
|
|
||||||
static FcBool
|
static FcBool
|
||||||
FcFileCacheAdd (FcFileCache *cache,
|
FcFileCacheAdd (FcFileCache *cache,
|
||||||
const char *file,
|
const FcChar8 *file,
|
||||||
int id,
|
int id,
|
||||||
time_t time,
|
time_t time,
|
||||||
const char *name,
|
const FcChar8 *name,
|
||||||
FcBool replace)
|
FcBool replace)
|
||||||
{
|
{
|
||||||
FcFileCacheEnt *c;
|
FcFileCacheEnt *c;
|
||||||
|
@ -220,16 +239,16 @@ FcFileCacheAdd (FcFileCache *cache,
|
||||||
}
|
}
|
||||||
|
|
||||||
c = malloc (sizeof (FcFileCacheEnt) +
|
c = malloc (sizeof (FcFileCacheEnt) +
|
||||||
strlen (file) + 1 +
|
strlen ((char *) file) + 1 +
|
||||||
strlen (name) + 1);
|
strlen ((char *) name) + 1);
|
||||||
if (!c)
|
if (!c)
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
c->next = *prev;
|
c->next = *prev;
|
||||||
*prev = c;
|
*prev = c;
|
||||||
c->hash = hash;
|
c->hash = hash;
|
||||||
c->file = (char *) (c + 1);
|
c->file = (FcChar8 *) (c + 1);
|
||||||
c->id = id;
|
c->id = id;
|
||||||
c->name = c->file + strlen (file) + 1;
|
c->name = c->file + strlen ((char *) file) + 1;
|
||||||
strcpy (c->file, file);
|
strcpy (c->file, file);
|
||||||
c->time = time;
|
c->time = time;
|
||||||
c->referenced = replace;
|
c->referenced = replace;
|
||||||
|
@ -274,42 +293,54 @@ FcFileCacheDestroy (FcFileCache *cache)
|
||||||
|
|
||||||
void
|
void
|
||||||
FcFileCacheLoad (FcFileCache *cache,
|
FcFileCacheLoad (FcFileCache *cache,
|
||||||
const char *cache_file)
|
const FcChar8 *cache_file)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char file[8192];
|
FcChar8 file_buf[8192], *file;
|
||||||
int id;
|
int id;
|
||||||
time_t time;
|
time_t time;
|
||||||
char name[8192];
|
FcChar8 name_buf[8192], *name;
|
||||||
|
|
||||||
f = fopen (cache_file, "r");
|
f = fopen ((char *) cache_file, "r");
|
||||||
if (!f)
|
if (!f)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cache->updated = FcFalse;
|
cache->updated = FcFalse;
|
||||||
while (FcFileCacheReadString (f, file, sizeof (file)) &&
|
file = 0;
|
||||||
|
name = 0;
|
||||||
|
while ((file = FcFileCacheReadString (f, file_buf, sizeof (file_buf))) &&
|
||||||
FcFileCacheReadInt (f, &id) &&
|
FcFileCacheReadInt (f, &id) &&
|
||||||
FcFileCacheReadTime (f, &time) &&
|
FcFileCacheReadTime (f, &time) &&
|
||||||
FcFileCacheReadString (f, name, sizeof (name)))
|
(name = FcFileCacheReadString (f, name_buf, sizeof (name_buf))))
|
||||||
{
|
{
|
||||||
(void) FcFileCacheAdd (cache, file, id, time, name, FcFalse);
|
(void) FcFileCacheAdd (cache, file, id, time, name, FcFalse);
|
||||||
|
if (file != file_buf)
|
||||||
|
free (file);
|
||||||
|
if (name != name_buf)
|
||||||
|
free (name);
|
||||||
|
file = 0;
|
||||||
|
name = 0;
|
||||||
}
|
}
|
||||||
|
if (file && file != file_buf)
|
||||||
|
free (file);
|
||||||
|
if (name && name != name_buf)
|
||||||
|
free (name);
|
||||||
fclose (f);
|
fclose (f);
|
||||||
}
|
}
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcFileCacheUpdate (FcFileCache *cache,
|
FcFileCacheUpdate (FcFileCache *cache,
|
||||||
const char *file,
|
const FcChar8 *file,
|
||||||
int id,
|
int id,
|
||||||
const char *name)
|
const FcChar8 *name)
|
||||||
{
|
{
|
||||||
const char *match;
|
const FcChar8 *match;
|
||||||
struct stat statb;
|
struct stat statb;
|
||||||
FcBool ret;
|
FcBool ret;
|
||||||
|
|
||||||
match = file;
|
match = file;
|
||||||
|
|
||||||
if (stat (file, &statb) < 0)
|
if (stat ((char *) file, &statb) < 0)
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
ret = FcFileCacheAdd (cache, match, id,
|
ret = FcFileCacheAdd (cache, match, id,
|
||||||
statb.st_mtime, name, FcTrue);
|
statb.st_mtime, name, FcTrue);
|
||||||
|
@ -319,7 +350,7 @@ FcFileCacheUpdate (FcFileCache *cache,
|
||||||
}
|
}
|
||||||
|
|
||||||
static FcBool
|
static FcBool
|
||||||
FcFileCacheWriteString (FILE *f, char *string)
|
FcFileCacheWriteString (FILE *f, const FcChar8 *string)
|
||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
|
@ -382,10 +413,10 @@ FcFileCacheWriteTime (FILE *f, time_t t)
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcFileCacheSave (FcFileCache *cache,
|
FcFileCacheSave (FcFileCache *cache,
|
||||||
const char *cache_file)
|
const FcChar8 *cache_file)
|
||||||
{
|
{
|
||||||
char *lck;
|
FcChar8 *lck;
|
||||||
char *tmp;
|
FcChar8 *tmp;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
int h;
|
int h;
|
||||||
FcFileCacheEnt *c;
|
FcFileCacheEnt *c;
|
||||||
|
@ -393,19 +424,19 @@ FcFileCacheSave (FcFileCache *cache,
|
||||||
if (!cache->updated && cache->referenced == cache->entries)
|
if (!cache->updated && cache->referenced == cache->entries)
|
||||||
return FcTrue;
|
return FcTrue;
|
||||||
|
|
||||||
lck = malloc (strlen (cache_file)*2 + 4);
|
lck = malloc (strlen ((char *) cache_file)*2 + 4);
|
||||||
if (!lck)
|
if (!lck)
|
||||||
goto bail0;
|
goto bail0;
|
||||||
tmp = lck + strlen (cache_file) + 2;
|
tmp = lck + strlen ((char *) cache_file) + 2;
|
||||||
strcpy (lck, cache_file);
|
strcpy ((char *) lck, (char *) cache_file);
|
||||||
strcat (lck, "L");
|
strcat ((char *) lck, "L");
|
||||||
strcpy (tmp, cache_file);
|
strcpy ((char *) tmp, (char *) cache_file);
|
||||||
strcat (tmp, "T");
|
strcat ((char *) tmp, "T");
|
||||||
if (link (lck, cache_file) < 0 && errno != ENOENT)
|
if (link ((char *) lck, (char *) cache_file) < 0 && errno != ENOENT)
|
||||||
goto bail1;
|
goto bail1;
|
||||||
if (access (tmp, F_OK) == 0)
|
if (access ((char *) tmp, F_OK) == 0)
|
||||||
goto bail2;
|
goto bail2;
|
||||||
f = fopen (tmp, "w");
|
f = fopen ((char *) tmp, "w");
|
||||||
if (!f)
|
if (!f)
|
||||||
goto bail2;
|
goto bail2;
|
||||||
|
|
||||||
|
@ -437,19 +468,19 @@ FcFileCacheSave (FcFileCache *cache,
|
||||||
if (fclose (f) == EOF)
|
if (fclose (f) == EOF)
|
||||||
goto bail3;
|
goto bail3;
|
||||||
|
|
||||||
if (rename (tmp, cache_file) < 0)
|
if (rename ((char *) tmp, (char *) cache_file) < 0)
|
||||||
goto bail3;
|
goto bail3;
|
||||||
|
|
||||||
unlink (lck);
|
unlink ((char *) lck);
|
||||||
cache->updated = FcFalse;
|
cache->updated = FcFalse;
|
||||||
return FcTrue;
|
return FcTrue;
|
||||||
|
|
||||||
bail4:
|
bail4:
|
||||||
fclose (f);
|
fclose (f);
|
||||||
bail3:
|
bail3:
|
||||||
unlink (tmp);
|
unlink ((char *) tmp);
|
||||||
bail2:
|
bail2:
|
||||||
unlink (lck);
|
unlink ((char *) lck);
|
||||||
bail1:
|
bail1:
|
||||||
free (lck);
|
free (lck);
|
||||||
bail0:
|
bail0:
|
||||||
|
@ -457,15 +488,15 @@ bail0:
|
||||||
}
|
}
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcFileCacheReadDir (FcFontSet *set, const char *cache_file)
|
FcFileCacheReadDir (FcFontSet *set, const FcChar8 *cache_file)
|
||||||
{
|
{
|
||||||
FcPattern *font;
|
FcPattern *font;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char *path;
|
FcChar8 *path;
|
||||||
char *base;
|
FcChar8 *base;
|
||||||
char file[8192];
|
FcChar8 file_buf[8192], *file;
|
||||||
int id;
|
int id;
|
||||||
char name[8192];
|
FcChar8 name_buf[8192], *name;
|
||||||
FcBool ret = FcFalse;
|
FcBool ret = FcFalse;
|
||||||
|
|
||||||
if (FcDebug () & FC_DBG_CACHE)
|
if (FcDebug () & FC_DBG_CACHE)
|
||||||
|
@ -473,7 +504,7 @@ FcFileCacheReadDir (FcFontSet *set, const char *cache_file)
|
||||||
printf ("FcFileCacheReadDir cache_file \"%s\"\n", cache_file);
|
printf ("FcFileCacheReadDir cache_file \"%s\"\n", cache_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
f = fopen (cache_file, "r");
|
f = fopen ((char *) cache_file, "r");
|
||||||
if (!f)
|
if (!f)
|
||||||
{
|
{
|
||||||
if (FcDebug () & FC_DBG_CACHE)
|
if (FcDebug () & FC_DBG_CACHE)
|
||||||
|
@ -483,7 +514,7 @@ FcFileCacheReadDir (FcFontSet *set, const char *cache_file)
|
||||||
goto bail0;
|
goto bail0;
|
||||||
}
|
}
|
||||||
|
|
||||||
base = strrchr (cache_file, '/');
|
base = (FcChar8 *) strrchr ((char *) cache_file, '/');
|
||||||
if (!base)
|
if (!base)
|
||||||
goto bail1;
|
goto bail1;
|
||||||
base++;
|
base++;
|
||||||
|
@ -493,9 +524,11 @@ FcFileCacheReadDir (FcFontSet *set, const char *cache_file)
|
||||||
memcpy (path, cache_file, base - cache_file);
|
memcpy (path, cache_file, base - cache_file);
|
||||||
base = path + (base - cache_file);
|
base = path + (base - cache_file);
|
||||||
|
|
||||||
while (FcFileCacheReadString (f, file, sizeof (file)) &&
|
file = 0;
|
||||||
|
name = 0;
|
||||||
|
while ((file = FcFileCacheReadString (f, file_buf, sizeof (file_buf))) &&
|
||||||
FcFileCacheReadInt (f, &id) &&
|
FcFileCacheReadInt (f, &id) &&
|
||||||
FcFileCacheReadString (f, name, sizeof (name)))
|
(name = FcFileCacheReadString (f, name_buf, sizeof (name_buf))))
|
||||||
{
|
{
|
||||||
font = FcNameParse (name);
|
font = FcNameParse (name);
|
||||||
if (font)
|
if (font)
|
||||||
|
@ -509,6 +542,11 @@ FcFileCacheReadDir (FcFontSet *set, const char *cache_file)
|
||||||
if (!FcFontSetAdd (set, font))
|
if (!FcFontSetAdd (set, font))
|
||||||
goto bail2;
|
goto bail2;
|
||||||
}
|
}
|
||||||
|
if (file != file_buf)
|
||||||
|
free (file);
|
||||||
|
if (name != name_buf)
|
||||||
|
free (name);
|
||||||
|
file = name = 0;
|
||||||
}
|
}
|
||||||
if (FcDebug () & FC_DBG_CACHE)
|
if (FcDebug () & FC_DBG_CACHE)
|
||||||
{
|
{
|
||||||
|
@ -518,6 +556,10 @@ FcFileCacheReadDir (FcFontSet *set, const char *cache_file)
|
||||||
ret = FcTrue;
|
ret = FcTrue;
|
||||||
bail2:
|
bail2:
|
||||||
free (path);
|
free (path);
|
||||||
|
if (file && file != file_buf)
|
||||||
|
free (file);
|
||||||
|
if (name && name != name_buf)
|
||||||
|
free (name);
|
||||||
bail1:
|
bail1:
|
||||||
fclose (f);
|
fclose (f);
|
||||||
bail0:
|
bail0:
|
||||||
|
@ -525,12 +567,12 @@ bail0:
|
||||||
}
|
}
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcFileCacheWriteDir (FcFontSet *set, const char *cache_file)
|
FcFileCacheWriteDir (FcFontSet *set, const FcChar8 *cache_file)
|
||||||
{
|
{
|
||||||
FcPattern *font;
|
FcPattern *font;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char *name;
|
FcChar8 *name;
|
||||||
char *file, *base;
|
const FcChar8 *file, *base;
|
||||||
int n;
|
int n;
|
||||||
int id;
|
int id;
|
||||||
FcBool ret;
|
FcBool ret;
|
||||||
|
@ -538,7 +580,7 @@ FcFileCacheWriteDir (FcFontSet *set, const char *cache_file)
|
||||||
if (FcDebug () & FC_DBG_CACHE)
|
if (FcDebug () & FC_DBG_CACHE)
|
||||||
printf ("FcFileCacheWriteDir cache_file \"%s\"\n", cache_file);
|
printf ("FcFileCacheWriteDir cache_file \"%s\"\n", cache_file);
|
||||||
|
|
||||||
f = fopen (cache_file, "w");
|
f = fopen ((char *) cache_file, "w");
|
||||||
if (!f)
|
if (!f)
|
||||||
{
|
{
|
||||||
if (FcDebug () & FC_DBG_CACHE)
|
if (FcDebug () & FC_DBG_CACHE)
|
||||||
|
@ -550,7 +592,7 @@ FcFileCacheWriteDir (FcFontSet *set, const char *cache_file)
|
||||||
font = set->fonts[n];
|
font = set->fonts[n];
|
||||||
if (FcPatternGetString (font, FC_FILE, 0, &file) != FcResultMatch)
|
if (FcPatternGetString (font, FC_FILE, 0, &file) != FcResultMatch)
|
||||||
goto bail1;
|
goto bail1;
|
||||||
base = strrchr (file, '/');
|
base = (FcChar8 *) strrchr ((char *) file, '/');
|
||||||
if (base)
|
if (base)
|
||||||
base = base + 1;
|
base = base + 1;
|
||||||
else
|
else
|
||||||
|
@ -587,6 +629,6 @@ FcFileCacheWriteDir (FcFontSet *set, const char *cache_file)
|
||||||
bail1:
|
bail1:
|
||||||
fclose (f);
|
fclose (f);
|
||||||
bail0:
|
bail0:
|
||||||
unlink (cache_file);
|
unlink ((char *) cache_file);
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
}
|
}
|
||||||
|
|
126
src/fccfg.c
126
src/fccfg.c
|
@ -50,7 +50,7 @@ FcConfigCreate (void)
|
||||||
config->configFiles[0] = 0;
|
config->configFiles[0] = 0;
|
||||||
|
|
||||||
config->cache = 0;
|
config->cache = 0;
|
||||||
if (!FcConfigSetCache (config, "~/" FC_USER_CACHE_FILE))
|
if (!FcConfigSetCache (config, (FcChar8 *) ("~/" FC_USER_CACHE_FILE)))
|
||||||
goto bail3;
|
goto bail3;
|
||||||
|
|
||||||
config->blanks = 0;
|
config->blanks = 0;
|
||||||
|
@ -88,9 +88,9 @@ FcSubstDestroy (FcSubst *s)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
FcConfigDestroyStrings (char **strings)
|
FcConfigDestroyStrings (FcChar8 **strings)
|
||||||
{
|
{
|
||||||
char **s;
|
FcChar8 **s;
|
||||||
|
|
||||||
for (s = strings; s && *s; s++)
|
for (s = strings; s && *s; s++)
|
||||||
free (*s);
|
free (*s);
|
||||||
|
@ -99,20 +99,20 @@ FcConfigDestroyStrings (char **strings)
|
||||||
}
|
}
|
||||||
|
|
||||||
static FcBool
|
static FcBool
|
||||||
FcConfigAddString (char ***strings, char *string)
|
FcConfigAddString (FcChar8 ***strings, FcChar8 *string)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
char **s;
|
FcChar8 **s;
|
||||||
|
|
||||||
n = 0;
|
n = 0;
|
||||||
for (s = *strings; s && *s; s++)
|
for (s = *strings; s && *s; s++)
|
||||||
n++;
|
n++;
|
||||||
s = malloc ((n + 2) * sizeof (char *));
|
s = malloc ((n + 2) * sizeof (FcChar8 *));
|
||||||
if (!s)
|
if (!s)
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
s[n] = string;
|
s[n] = string;
|
||||||
s[n+1] = 0;
|
s[n+1] = 0;
|
||||||
memcpy (s, *strings, n * sizeof (char *));
|
memcpy (s, *strings, n * sizeof (FcChar8 *));
|
||||||
free (*strings);
|
free (*strings);
|
||||||
*strings = s;
|
*strings = s;
|
||||||
return FcTrue;
|
return FcTrue;
|
||||||
|
@ -145,7 +145,7 @@ FcConfigBuildFonts (FcConfig *config)
|
||||||
{
|
{
|
||||||
FcFontSet *fonts;
|
FcFontSet *fonts;
|
||||||
FcFileCache *cache;
|
FcFileCache *cache;
|
||||||
char **d;
|
FcChar8 **d;
|
||||||
|
|
||||||
fonts = FcFontSetCreate ();
|
fonts = FcFontSetCreate ();
|
||||||
if (!fonts)
|
if (!fonts)
|
||||||
|
@ -200,25 +200,25 @@ FcConfigGetCurrent (void)
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcConfigAddDir (FcConfig *config,
|
FcConfigAddDir (FcConfig *config,
|
||||||
const char *d)
|
const FcChar8 *d)
|
||||||
{
|
{
|
||||||
char *dir;
|
FcChar8 *dir;
|
||||||
char *h;
|
FcChar8 *h;
|
||||||
|
|
||||||
if (*d == '~')
|
if (*d == '~')
|
||||||
{
|
{
|
||||||
h = getenv ("HOME");
|
h = (FcChar8 *) getenv ("HOME");
|
||||||
if (!h)
|
if (!h)
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
dir = (char *) malloc (strlen (h) + strlen (d));
|
dir = (FcChar8 *) malloc (strlen ((char *) h) + strlen ((char *) d));
|
||||||
if (!dir)
|
if (!dir)
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
strcpy (dir, h);
|
strcpy ((char *) dir, (char *) h);
|
||||||
strcat (dir, d+1);
|
strcat ((char *) dir, (char *) d+1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dir = (char *) malloc (strlen (d) + 1);
|
dir = (FcChar8 *) malloc (strlen ((char *) d) + 1);
|
||||||
if (!dir)
|
if (!dir)
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
strcpy (dir, d);
|
strcpy (dir, d);
|
||||||
|
@ -231,7 +231,7 @@ FcConfigAddDir (FcConfig *config,
|
||||||
return FcTrue;
|
return FcTrue;
|
||||||
}
|
}
|
||||||
|
|
||||||
char **
|
FcChar8 **
|
||||||
FcConfigGetDirs (FcConfig *config)
|
FcConfigGetDirs (FcConfig *config)
|
||||||
{
|
{
|
||||||
if (!config)
|
if (!config)
|
||||||
|
@ -245,9 +245,9 @@ FcConfigGetDirs (FcConfig *config)
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcConfigAddConfigFile (FcConfig *config,
|
FcConfigAddConfigFile (FcConfig *config,
|
||||||
const char *f)
|
const FcChar8 *f)
|
||||||
{
|
{
|
||||||
char *file;
|
FcChar8 *file;
|
||||||
file = FcConfigFilename (f);
|
file = FcConfigFilename (f);
|
||||||
if (!file)
|
if (!file)
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
|
@ -259,7 +259,7 @@ FcConfigAddConfigFile (FcConfig *config,
|
||||||
return FcTrue;
|
return FcTrue;
|
||||||
}
|
}
|
||||||
|
|
||||||
char **
|
FcChar8 **
|
||||||
FcConfigGetConfigFiles (FcConfig *config)
|
FcConfigGetConfigFiles (FcConfig *config)
|
||||||
{
|
{
|
||||||
if (!config)
|
if (!config)
|
||||||
|
@ -273,21 +273,21 @@ FcConfigGetConfigFiles (FcConfig *config)
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcConfigSetCache (FcConfig *config,
|
FcConfigSetCache (FcConfig *config,
|
||||||
const char *c)
|
const FcChar8 *c)
|
||||||
{
|
{
|
||||||
char *new;
|
FcChar8 *new;
|
||||||
char *h;
|
FcChar8 *h;
|
||||||
|
|
||||||
if (*c == '~')
|
if (*c == '~')
|
||||||
{
|
{
|
||||||
h = getenv ("HOME");
|
h = (FcChar8 *) getenv ("HOME");
|
||||||
if (!h)
|
if (!h)
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
new = (char *) malloc (strlen (h) + strlen (c));
|
new = (FcChar8 *) malloc (strlen ((char *) h) + strlen ((char *) c));
|
||||||
if (!new)
|
if (!new)
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
strcpy (new, h);
|
strcpy ((char *) new, (char *) h);
|
||||||
strcat (new, c+1);
|
strcat ((char *) new, (char *) c+1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -299,7 +299,7 @@ FcConfigSetCache (FcConfig *config,
|
||||||
return FcTrue;
|
return FcTrue;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
FcChar8 *
|
||||||
FcConfigGetCache (FcConfig *config)
|
FcConfigGetCache (FcConfig *config)
|
||||||
{
|
{
|
||||||
if (!config)
|
if (!config)
|
||||||
|
@ -545,7 +545,6 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
|
||||||
FcValue v, vl, vr;
|
FcValue v, vl, vr;
|
||||||
FcResult r;
|
FcResult r;
|
||||||
FcMatrix *m;
|
FcMatrix *m;
|
||||||
FcChar8 *s;
|
|
||||||
|
|
||||||
switch (e->op) {
|
switch (e->op) {
|
||||||
case FcOpInteger:
|
case FcOpInteger:
|
||||||
|
@ -1070,7 +1069,7 @@ FcConfigSubstitute (FcConfig *config,
|
||||||
* Locate any test associated with this field
|
* Locate any test associated with this field
|
||||||
*/
|
*/
|
||||||
for (t = s->test, i = 0; t; t = t->next, i++)
|
for (t = s->test, i = 0; t; t = t->next, i++)
|
||||||
if (!FcStrCmpIgnoreCase (t->field, e->field))
|
if (!FcStrCmpIgnoreCase ((FcChar8 *) t->field, (FcChar8 *) e->field))
|
||||||
break;
|
break;
|
||||||
switch (e->op) {
|
switch (e->op) {
|
||||||
case FcOpAssign:
|
case FcOpAssign:
|
||||||
|
@ -1087,6 +1086,10 @@ FcConfigSubstitute (FcConfig *config,
|
||||||
* Append the new list of values after the current value
|
* Append the new list of values after the current value
|
||||||
*/
|
*/
|
||||||
FcConfigAdd (&st[i].elt->values, thisValue, FcTrue, l);
|
FcConfigAdd (&st[i].elt->values, thisValue, FcTrue, l);
|
||||||
|
/*
|
||||||
|
* Delete the marked value
|
||||||
|
*/
|
||||||
|
FcConfigDel (&st[i].elt->values, thisValue);
|
||||||
/*
|
/*
|
||||||
* Adjust any pointers into the value list to ensure
|
* Adjust any pointers into the value list to ensure
|
||||||
* future edits occur at the same place
|
* future edits occur at the same place
|
||||||
|
@ -1096,10 +1099,6 @@ FcConfigSubstitute (FcConfig *config,
|
||||||
if (st[i].value == thisValue)
|
if (st[i].value == thisValue)
|
||||||
st[i].value = nextValue;
|
st[i].value = nextValue;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* Delete the marked value
|
|
||||||
*/
|
|
||||||
FcConfigDel (&st[i].elt->values, thisValue);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* fall through ... */
|
/* fall through ... */
|
||||||
|
@ -1179,41 +1178,41 @@ FcConfigSubstitute (FcConfig *config,
|
||||||
#define FONTCONFIG_FILE "fonts.conf"
|
#define FONTCONFIG_FILE "fonts.conf"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char *
|
static FcChar8 *
|
||||||
FcConfigFileExists (const char *dir, const char *file)
|
FcConfigFileExists (const FcChar8 *dir, const FcChar8 *file)
|
||||||
{
|
{
|
||||||
char *path;
|
FcChar8 *path;
|
||||||
|
|
||||||
if (!dir)
|
if (!dir)
|
||||||
dir = "";
|
dir = (FcChar8 *) "";
|
||||||
path = malloc (strlen (dir) + 1 + strlen (file) + 1);
|
path = malloc (strlen ((char *) dir) + 1 + strlen ((char *) file) + 1);
|
||||||
if (!path)
|
if (!path)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
strcpy (path, dir);
|
strcpy (path, dir);
|
||||||
/* make sure there's a single separating / */
|
/* make sure there's a single separating / */
|
||||||
if ((!path[0] || path[strlen(path)-1] != '/') && file[0] != '/')
|
if ((!path[0] || path[strlen((char *) path)-1] != '/') && file[0] != '/')
|
||||||
strcat (path, "/");
|
strcat ((char *) path, "/");
|
||||||
strcat (path, file);
|
strcat ((char *) path, (char *) file);
|
||||||
|
|
||||||
if (access (path, R_OK) == 0)
|
if (access ((char *) path, R_OK) == 0)
|
||||||
return path;
|
return path;
|
||||||
|
|
||||||
free (path);
|
free (path);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char **
|
static FcChar8 **
|
||||||
FcConfigGetPath (void)
|
FcConfigGetPath (void)
|
||||||
{
|
{
|
||||||
char **path;
|
FcChar8 **path;
|
||||||
char *env, *e, *colon;
|
FcChar8 *env, *e, *colon;
|
||||||
char *dir;
|
FcChar8 *dir;
|
||||||
int npath;
|
int npath;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
npath = 2; /* default dir + null */
|
npath = 2; /* default dir + null */
|
||||||
env = getenv ("FONTCONFIG_PATH");
|
env = (FcChar8 *) getenv ("FONTCONFIG_PATH");
|
||||||
if (env)
|
if (env)
|
||||||
{
|
{
|
||||||
e = env;
|
e = env;
|
||||||
|
@ -1222,7 +1221,7 @@ FcConfigGetPath (void)
|
||||||
if (*e++ == ':')
|
if (*e++ == ':')
|
||||||
npath++;
|
npath++;
|
||||||
}
|
}
|
||||||
path = calloc (npath, sizeof (char *));
|
path = calloc (npath, sizeof (FcChar8 *));
|
||||||
if (!path)
|
if (!path)
|
||||||
goto bail0;
|
goto bail0;
|
||||||
i = 0;
|
i = 0;
|
||||||
|
@ -1232,9 +1231,9 @@ FcConfigGetPath (void)
|
||||||
e = env;
|
e = env;
|
||||||
while (*e)
|
while (*e)
|
||||||
{
|
{
|
||||||
colon = strchr (e, ':');
|
colon = (FcChar8 *) strchr ((char *) e, ':');
|
||||||
if (!colon)
|
if (!colon)
|
||||||
colon = e + strlen (e);
|
colon = e + strlen ((char *) e);
|
||||||
path[i] = malloc (colon - e + 1);
|
path[i] = malloc (colon - e + 1);
|
||||||
if (!path[i])
|
if (!path[i])
|
||||||
goto bail1;
|
goto bail1;
|
||||||
|
@ -1248,8 +1247,8 @@ FcConfigGetPath (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dir = FONTCONFIG_PATH;
|
dir = (FcChar8 *) FONTCONFIG_PATH;
|
||||||
path[i] = malloc (strlen (dir) + 1);
|
path[i] = malloc (strlen ((char *) dir) + 1);
|
||||||
if (!path[i])
|
if (!path[i])
|
||||||
goto bail1;
|
goto bail1;
|
||||||
strcpy (path[i], dir);
|
strcpy (path[i], dir);
|
||||||
|
@ -1264,29 +1263,30 @@ bail0:
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
FcConfigFreePath (char **path)
|
FcConfigFreePath (FcChar8 **path)
|
||||||
{
|
{
|
||||||
char **p;
|
FcChar8 **p;
|
||||||
|
|
||||||
for (p = path; *p; p++)
|
for (p = path; *p; p++)
|
||||||
free (*p);
|
free (*p);
|
||||||
free (path);
|
free (path);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
FcChar8 *
|
||||||
FcConfigFilename (const char *url)
|
FcConfigFilename (const FcChar8 *url)
|
||||||
{
|
{
|
||||||
char *file, *dir, **path, **p;
|
FcChar8 *file, *dir, **path, **p;
|
||||||
|
|
||||||
if (!url || !*url)
|
if (!url || !*url)
|
||||||
{
|
{
|
||||||
url = getenv ("FONTCONFIG_FILE");
|
url = (FcChar8 *) getenv ("FONTCONFIG_FILE");
|
||||||
if (!url)
|
if (!url)
|
||||||
url = FONTCONFIG_FILE;
|
url = (FcChar8 *) FONTCONFIG_FILE;
|
||||||
}
|
}
|
||||||
|
file = 0;
|
||||||
switch (*url) {
|
switch (*url) {
|
||||||
case '~':
|
case '~':
|
||||||
dir = getenv ("HOME");
|
dir = (FcChar8 *) getenv ("HOME");
|
||||||
if (dir)
|
if (dir)
|
||||||
file = FcConfigFileExists (dir, url + 1);
|
file = FcConfigFileExists (dir, url + 1);
|
||||||
else
|
else
|
||||||
|
@ -1317,7 +1317,7 @@ FcConfigFilename (const char *url)
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcConfigAppFontAddFile (FcConfig *config,
|
FcConfigAppFontAddFile (FcConfig *config,
|
||||||
const char *file)
|
const FcChar8 *file)
|
||||||
{
|
{
|
||||||
FcFontSet *set;
|
FcFontSet *set;
|
||||||
|
|
||||||
|
@ -1341,7 +1341,7 @@ FcConfigAppFontAddFile (FcConfig *config,
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcConfigAppFontAddDir (FcConfig *config,
|
FcConfigAppFontAddDir (FcConfig *config,
|
||||||
const char *dir)
|
const FcChar8 *dir)
|
||||||
{
|
{
|
||||||
FcFontSet *set;
|
FcFontSet *set;
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,7 @@ FcCharSetFindLeaf (const FcCharSet *fcs, FcChar32 ucs4)
|
||||||
int l;
|
int l;
|
||||||
const FcCharNode *prev;
|
const FcCharNode *prev;
|
||||||
FcCharNode node;
|
FcCharNode node;
|
||||||
FcChar8 i;
|
FcChar32 i;
|
||||||
|
|
||||||
prev = &fcs->node;
|
prev = &fcs->node;
|
||||||
l = fcs->levels;
|
l = fcs->levels;
|
||||||
|
@ -169,7 +169,7 @@ FcCharSetFindLeafCreate (FcCharSet *fcs, FcChar32 ucs4)
|
||||||
{
|
{
|
||||||
int l;
|
int l;
|
||||||
FcCharNode *prev, node;
|
FcCharNode *prev, node;
|
||||||
FcChar8 i;
|
FcChar32 i;
|
||||||
|
|
||||||
if (!FcCharSetCheckLevel (fcs, ucs4))
|
if (!FcCharSetCheckLevel (fcs, ucs4))
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
|
@ -242,7 +242,7 @@ FcCharSetIterLeaf (FcCharNode node, int level, FcChar32 *ucs4)
|
||||||
int shift = ((level - 1) << 3);
|
int shift = ((level - 1) << 3);
|
||||||
FcChar32 inc = 1 << shift;
|
FcChar32 inc = 1 << shift;
|
||||||
FcChar32 mask = ~(inc - 1);
|
FcChar32 mask = ~(inc - 1);
|
||||||
FcChar8 byte = (*ucs4 >> shift) & 0xff;
|
FcChar32 byte = (*ucs4 >> shift) & 0xff;
|
||||||
FcCharLeaf *leaf;
|
FcCharLeaf *leaf;
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
|
@ -254,7 +254,7 @@ FcCharSetIterLeaf (FcCharNode node, int level, FcChar32 *ucs4)
|
||||||
break;
|
break;
|
||||||
/* step to next branch, resetting lower indices */
|
/* step to next branch, resetting lower indices */
|
||||||
*ucs4 = (*ucs4 & mask) + inc;
|
*ucs4 = (*ucs4 & mask) + inc;
|
||||||
byte++;
|
byte = (byte + 1) & 0xff;
|
||||||
if (byte == 0)
|
if (byte == 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -567,7 +567,7 @@ FcCharSetSubtractCount (const FcCharSet *a, const FcCharSet *b)
|
||||||
* it's not exactly human readable output. As a special case, 0 is encoded as a space
|
* it's not exactly human readable output. As a special case, 0 is encoded as a space
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static FcChar8 charToValue[256] = {
|
static unsigned char charToValue[256] = {
|
||||||
/* "" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
/* "" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
/* "\b" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
/* "\b" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
/* "\020" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
/* "\020" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
|
@ -621,7 +621,7 @@ FcCharSetParseValue (FcChar8 *string, FcChar32 *value)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
FcChar32 v;
|
FcChar32 v;
|
||||||
FcChar8 c;
|
FcChar32 c;
|
||||||
|
|
||||||
if (*string == ' ')
|
if (*string == ' ')
|
||||||
{
|
{
|
||||||
|
@ -633,7 +633,7 @@ FcCharSetParseValue (FcChar8 *string, FcChar32 *value)
|
||||||
v = 0;
|
v = 0;
|
||||||
for (i = 0; i < 5; i++)
|
for (i = 0; i < 5; i++)
|
||||||
{
|
{
|
||||||
if (!(c = *string++))
|
if (!(c = (FcChar32) (unsigned char) *string++))
|
||||||
return 0;
|
return 0;
|
||||||
c = charToValue[c];
|
c = charToValue[c];
|
||||||
if (c == 0xff)
|
if (c == 0xff)
|
||||||
|
@ -809,7 +809,7 @@ FcNameUnparseCharSet (FcNameBuf *buf, const FcCharSet *c)
|
||||||
|
|
||||||
typedef struct _FcCharEnt {
|
typedef struct _FcCharEnt {
|
||||||
FcChar16 bmp;
|
FcChar16 bmp;
|
||||||
FcChar8 encode;
|
unsigned char encode;
|
||||||
} FcCharEnt;
|
} FcCharEnt;
|
||||||
|
|
||||||
typedef struct _FcCharMap {
|
typedef struct _FcCharMap {
|
||||||
|
@ -960,6 +960,7 @@ FcFreeTypeCheckGlyph (FT_Face face, FcChar32 ucs4,
|
||||||
return FcTrue;
|
return FcTrue;
|
||||||
/* fall through ... */
|
/* fall through ... */
|
||||||
default:
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
}
|
}
|
||||||
|
|
42
src/fcdir.c
42
src/fcdir.c
|
@ -34,11 +34,11 @@ FcBool
|
||||||
FcFileScan (FcFontSet *set,
|
FcFileScan (FcFontSet *set,
|
||||||
FcFileCache *cache,
|
FcFileCache *cache,
|
||||||
FcBlanks *blanks,
|
FcBlanks *blanks,
|
||||||
const char *file,
|
const FcChar8 *file,
|
||||||
FcBool force)
|
FcBool force)
|
||||||
{
|
{
|
||||||
int id;
|
int id;
|
||||||
char *name;
|
FcChar8 *name;
|
||||||
FcPattern *font;
|
FcPattern *font;
|
||||||
FcBool ret = FcTrue;
|
FcBool ret = FcTrue;
|
||||||
int count;
|
int count;
|
||||||
|
@ -88,7 +88,7 @@ FcFileScan (FcFontSet *set,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* negative cache files not containing fonts */
|
/* negative cache files not containing fonts */
|
||||||
FcFileCacheUpdate (cache, file, id, FC_INVALID_FONT_FILE);
|
FcFileCacheUpdate (cache, file, id, (FcChar8 *) FC_INVALID_FONT_FILE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,25 +110,25 @@ FcBool
|
||||||
FcDirScan (FcFontSet *set,
|
FcDirScan (FcFontSet *set,
|
||||||
FcFileCache *cache,
|
FcFileCache *cache,
|
||||||
FcBlanks *blanks,
|
FcBlanks *blanks,
|
||||||
const char *dir,
|
const FcChar8 *dir,
|
||||||
FcBool force)
|
FcBool force)
|
||||||
{
|
{
|
||||||
DIR *d;
|
DIR *d;
|
||||||
struct dirent *e;
|
struct dirent *e;
|
||||||
char *file;
|
FcChar8 *file;
|
||||||
char *base;
|
FcChar8 *base;
|
||||||
FcBool ret = FcTrue;
|
FcBool ret = FcTrue;
|
||||||
|
|
||||||
file = (char *) malloc (strlen (dir) + 1 + 256 + 1);
|
file = (FcChar8 *) malloc (strlen ((char *) dir) + 1 + 256 + 1);
|
||||||
if (!file)
|
if (!file)
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
|
|
||||||
strcpy (file, dir);
|
strcpy ((char *) file, (char *) dir);
|
||||||
strcat (file, "/");
|
strcat ((char *) file, "/");
|
||||||
base = file + strlen (file);
|
base = file + strlen ((char *) file);
|
||||||
if (!force)
|
if (!force)
|
||||||
{
|
{
|
||||||
strcpy (base, FC_DIR_CACHE_FILE);
|
strcpy ((char *) base, FC_DIR_CACHE_FILE);
|
||||||
|
|
||||||
if (FcFileCacheReadDir (set, file))
|
if (FcFileCacheReadDir (set, file))
|
||||||
{
|
{
|
||||||
|
@ -137,7 +137,7 @@ FcDirScan (FcFontSet *set,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
d = opendir (dir);
|
d = opendir ((char *) dir);
|
||||||
if (!d)
|
if (!d)
|
||||||
{
|
{
|
||||||
free (file);
|
free (file);
|
||||||
|
@ -147,7 +147,7 @@ FcDirScan (FcFontSet *set,
|
||||||
{
|
{
|
||||||
if (e->d_name[0] != '.')
|
if (e->d_name[0] != '.')
|
||||||
{
|
{
|
||||||
strcpy (base, e->d_name);
|
strcpy ((char *) base, (char *) e->d_name);
|
||||||
FcFileScan (set, cache, blanks, file, force);
|
FcFileScan (set, cache, blanks, file, force);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,20 +157,20 @@ FcDirScan (FcFontSet *set,
|
||||||
}
|
}
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcDirSave (FcFontSet *set, const char *dir)
|
FcDirSave (FcFontSet *set, const FcChar8 *dir)
|
||||||
{
|
{
|
||||||
char *file;
|
FcChar8 *file;
|
||||||
char *base;
|
FcChar8 *base;
|
||||||
FcBool ret;
|
FcBool ret;
|
||||||
|
|
||||||
file = (char *) malloc (strlen (dir) + 1 + 256 + 1);
|
file = (FcChar8 *) malloc (strlen ((char *) dir) + 1 + 256 + 1);
|
||||||
if (!file)
|
if (!file)
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
|
|
||||||
strcpy (file, dir);
|
strcpy ((char *) file, (char *) dir);
|
||||||
strcat (file, "/");
|
strcat ((char *) file, "/");
|
||||||
base = file + strlen (file);
|
base = file + strlen ((char *) file);
|
||||||
strcpy (base, FC_DIR_CACHE_FILE);
|
strcpy ((char *) base, FC_DIR_CACHE_FILE);
|
||||||
ret = FcFileCacheWriteDir (set, file);
|
ret = FcFileCacheWriteDir (set, file);
|
||||||
free (file);
|
free (file);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -33,51 +33,51 @@
|
||||||
|
|
||||||
static const struct {
|
static const struct {
|
||||||
int bit;
|
int bit;
|
||||||
char *name;
|
FcChar8 *name;
|
||||||
} FcCodePageRange[] = {
|
} FcCodePageRange[] = {
|
||||||
{ 0, FC_LANG_LATIN_1 },
|
{ 0, (FcChar8 *) FC_LANG_LATIN_1 },
|
||||||
{ 1, FC_LANG_LATIN_2_EASTERN_EUROPE },
|
{ 1, (FcChar8 *) FC_LANG_LATIN_2_EASTERN_EUROPE },
|
||||||
{ 2, FC_LANG_CYRILLIC },
|
{ 2, (FcChar8 *) FC_LANG_CYRILLIC },
|
||||||
{ 3, FC_LANG_GREEK },
|
{ 3, (FcChar8 *) FC_LANG_GREEK },
|
||||||
{ 4, FC_LANG_TURKISH },
|
{ 4, (FcChar8 *) FC_LANG_TURKISH },
|
||||||
{ 5, FC_LANG_HEBREW },
|
{ 5, (FcChar8 *) FC_LANG_HEBREW },
|
||||||
{ 6, FC_LANG_ARABIC },
|
{ 6, (FcChar8 *) FC_LANG_ARABIC },
|
||||||
{ 7, FC_LANG_WINDOWS_BALTIC },
|
{ 7, (FcChar8 *) FC_LANG_WINDOWS_BALTIC },
|
||||||
{ 8, FC_LANG_VIETNAMESE },
|
{ 8, (FcChar8 *) FC_LANG_VIETNAMESE },
|
||||||
/* 9-15 reserved for Alternate ANSI */
|
/* 9-15 reserved for Alternate ANSI */
|
||||||
{ 16, FC_LANG_THAI },
|
{ 16, (FcChar8 *) FC_LANG_THAI },
|
||||||
{ 17, FC_LANG_JAPANESE },
|
{ 17, (FcChar8 *) FC_LANG_JAPANESE },
|
||||||
{ 18, FC_LANG_SIMPLIFIED_CHINESE },
|
{ 18, (FcChar8 *) FC_LANG_SIMPLIFIED_CHINESE },
|
||||||
{ 19, FC_LANG_KOREAN_WANSUNG },
|
{ 19, (FcChar8 *) FC_LANG_KOREAN_WANSUNG },
|
||||||
{ 20, FC_LANG_TRADITIONAL_CHINESE },
|
{ 20, (FcChar8 *) FC_LANG_TRADITIONAL_CHINESE },
|
||||||
{ 21, FC_LANG_KOREAN_JOHAB },
|
{ 21, (FcChar8 *) FC_LANG_KOREAN_JOHAB },
|
||||||
/* 22-28 reserved for Alternate ANSI & OEM */
|
/* 22-28 reserved for Alternate ANSI & OEM */
|
||||||
{ 29, FC_LANG_MACINTOSH },
|
{ 29, (FcChar8 *) FC_LANG_MACINTOSH },
|
||||||
{ 30, FC_LANG_OEM },
|
{ 30, (FcChar8 *) FC_LANG_OEM },
|
||||||
{ 31, FC_LANG_SYMBOL },
|
{ 31, (FcChar8 *) FC_LANG_SYMBOL },
|
||||||
/* 32-47 reserved for OEM */
|
/* 32-47 reserved for OEM */
|
||||||
{ 48, FC_LANG_IBM_GREEK },
|
{ 48, (FcChar8 *) FC_LANG_IBM_GREEK },
|
||||||
{ 49, FC_LANG_MSDOS_RUSSIAN },
|
{ 49, (FcChar8 *) FC_LANG_MSDOS_RUSSIAN },
|
||||||
{ 50, FC_LANG_MSDOS_NORDIC },
|
{ 50, (FcChar8 *) FC_LANG_MSDOS_NORDIC },
|
||||||
{ 51, FC_LANG_ARABIC_864 },
|
{ 51, (FcChar8 *) FC_LANG_ARABIC_864 },
|
||||||
{ 52, FC_LANG_MSDOS_CANADIAN_FRENCH },
|
{ 52, (FcChar8 *) FC_LANG_MSDOS_CANADIAN_FRENCH },
|
||||||
{ 53, FC_LANG_HEBREW_862 },
|
{ 53, (FcChar8 *) FC_LANG_HEBREW_862 },
|
||||||
{ 54, FC_LANG_MSDOS_ICELANDIC },
|
{ 54, (FcChar8 *) FC_LANG_MSDOS_ICELANDIC },
|
||||||
{ 55, FC_LANG_MSDOS_PORTUGUESE },
|
{ 55, (FcChar8 *) FC_LANG_MSDOS_PORTUGUESE },
|
||||||
{ 56, FC_LANG_IBM_TURKISH },
|
{ 56, (FcChar8 *) FC_LANG_IBM_TURKISH },
|
||||||
{ 57, FC_LANG_IBM_CYRILLIC },
|
{ 57, (FcChar8 *) FC_LANG_IBM_CYRILLIC },
|
||||||
{ 58, FC_LANG_LATIN_2 },
|
{ 58, (FcChar8 *) FC_LANG_LATIN_2 },
|
||||||
{ 59, FC_LANG_MSDOS_BALTIC },
|
{ 59, (FcChar8 *) FC_LANG_MSDOS_BALTIC },
|
||||||
{ 60, FC_LANG_GREEK_437_G },
|
{ 60, (FcChar8 *) FC_LANG_GREEK_437_G },
|
||||||
{ 61, FC_LANG_ARABIC_ASMO_708 },
|
{ 61, (FcChar8 *) FC_LANG_ARABIC_ASMO_708 },
|
||||||
{ 62, FC_LANG_WE_LATIN_1 },
|
{ 62, (FcChar8 *) FC_LANG_WE_LATIN_1 },
|
||||||
{ 63, FC_LANG_US },
|
{ 63, (FcChar8 *) FC_LANG_US },
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NUM_CODE_PAGE_RANGE (sizeof FcCodePageRange / sizeof FcCodePageRange[0])
|
#define NUM_CODE_PAGE_RANGE (sizeof FcCodePageRange / sizeof FcCodePageRange[0])
|
||||||
|
|
||||||
FcPattern *
|
FcPattern *
|
||||||
FcFreeTypeQuery (const char *file,
|
FcFreeTypeQuery (const FcChar8 *file,
|
||||||
int id,
|
int id,
|
||||||
FcBlanks *blanks,
|
FcBlanks *blanks,
|
||||||
int *count)
|
int *count)
|
||||||
|
@ -89,13 +89,13 @@ FcFreeTypeQuery (const char *file,
|
||||||
int i;
|
int i;
|
||||||
FcCharSet *cs;
|
FcCharSet *cs;
|
||||||
FT_Library ftLibrary;
|
FT_Library ftLibrary;
|
||||||
const char *family;
|
const FcChar8 *family;
|
||||||
TT_OS2 *os2;
|
TT_OS2 *os2;
|
||||||
|
|
||||||
if (FT_Init_FreeType (&ftLibrary))
|
if (FT_Init_FreeType (&ftLibrary))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (FT_New_Face (ftLibrary, file, id, &face))
|
if (FT_New_Face (ftLibrary, (char *) file, id, &face))
|
||||||
goto bail;
|
goto bail;
|
||||||
|
|
||||||
*count = face->num_faces;
|
*count = face->num_faces;
|
||||||
|
@ -127,10 +127,10 @@ FcFreeTypeQuery (const char *file,
|
||||||
if (!FcPatternAddInteger (pat, FC_WEIGHT, weight))
|
if (!FcPatternAddInteger (pat, FC_WEIGHT, weight))
|
||||||
goto bail1;
|
goto bail1;
|
||||||
|
|
||||||
family = face->family_name;
|
family = (FcChar8 *) face->family_name;
|
||||||
if (!family)
|
if (!family)
|
||||||
{
|
{
|
||||||
family = strrchr (file, '/');
|
family = (FcChar8 *) strrchr ((char *) file, '/');
|
||||||
if (family)
|
if (family)
|
||||||
family++;
|
family++;
|
||||||
else
|
else
|
||||||
|
@ -141,7 +141,7 @@ FcFreeTypeQuery (const char *file,
|
||||||
|
|
||||||
if (face->style_name)
|
if (face->style_name)
|
||||||
{
|
{
|
||||||
if (!FcPatternAddString (pat, FC_STYLE, face->style_name))
|
if (!FcPatternAddString (pat, FC_STYLE, (FcChar8 *) face->style_name))
|
||||||
goto bail1;
|
goto bail1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ FcFreeTypeQuery (const char *file,
|
||||||
if (!FcPatternAddInteger (pat, FC_INDEX, id))
|
if (!FcPatternAddInteger (pat, FC_INDEX, id))
|
||||||
goto bail1;
|
goto bail1;
|
||||||
|
|
||||||
if (!FcPatternAddString (pat, FC_SOURCE, "FreeType"))
|
if (!FcPatternAddString (pat, FC_SOURCE, (FcChar8 *) "FreeType"))
|
||||||
goto bail1;
|
goto bail1;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -48,7 +48,7 @@ FcInitFallbackConfig (void)
|
||||||
config = FcConfigCreate ();
|
config = FcConfigCreate ();
|
||||||
if (!config)
|
if (!config)
|
||||||
goto bail0;
|
goto bail0;
|
||||||
if (!FcConfigAddDir (config, FC_FALLBACK_FONTS))
|
if (!FcConfigAddDir (config, (FcChar8 *) FC_FALLBACK_FONTS))
|
||||||
goto bail1;
|
goto bail1;
|
||||||
FcConfigSetCurrent (config);
|
FcConfigSetCurrent (config);
|
||||||
return FcTrue;
|
return FcTrue;
|
||||||
|
|
66
src/fcint.h
66
src/fcint.h
|
@ -114,12 +114,12 @@ typedef struct _FcExpr {
|
||||||
union {
|
union {
|
||||||
int ival;
|
int ival;
|
||||||
double dval;
|
double dval;
|
||||||
char *sval;
|
FcChar8 *sval;
|
||||||
FcMatrix *mval;
|
FcMatrix *mval;
|
||||||
FcBool bval;
|
FcBool bval;
|
||||||
FcCharSet *cval;
|
FcCharSet *cval;
|
||||||
char *field;
|
char *field;
|
||||||
char *constant;
|
FcChar8 *constant;
|
||||||
struct {
|
struct {
|
||||||
struct _FcExpr *left, *right;
|
struct _FcExpr *left, *right;
|
||||||
} tree;
|
} tree;
|
||||||
|
@ -186,10 +186,10 @@ typedef struct _FcNameBuf {
|
||||||
typedef struct _FcFileCacheEnt {
|
typedef struct _FcFileCacheEnt {
|
||||||
struct _FcFileCacheEnt *next;
|
struct _FcFileCacheEnt *next;
|
||||||
unsigned int hash;
|
unsigned int hash;
|
||||||
char *file;
|
FcChar8 *file;
|
||||||
int id;
|
int id;
|
||||||
time_t time;
|
time_t time;
|
||||||
char *name;
|
FcChar8 *name;
|
||||||
FcBool referenced;
|
FcBool referenced;
|
||||||
} FcFileCacheEnt;
|
} FcFileCacheEnt;
|
||||||
|
|
||||||
|
@ -214,8 +214,8 @@ struct _FcConfig {
|
||||||
* cache file must be consulted before the directories are scanned,
|
* cache file must be consulted before the directories are scanned,
|
||||||
* and those directives may occur in any order
|
* and those directives may occur in any order
|
||||||
*/
|
*/
|
||||||
char **dirs; /* directories containing fonts */
|
FcChar8 **dirs; /* directories containing fonts */
|
||||||
char *cache; /* name of per-user cache file */
|
FcChar8 *cache; /* name of per-user cache file */
|
||||||
/*
|
/*
|
||||||
* Set of allowed blank chars -- used to
|
* Set of allowed blank chars -- used to
|
||||||
* trim fonts of bogus glyphs
|
* trim fonts of bogus glyphs
|
||||||
|
@ -225,7 +225,7 @@ struct _FcConfig {
|
||||||
* Names of all of the configuration files used
|
* Names of all of the configuration files used
|
||||||
* to create this configuration
|
* to create this configuration
|
||||||
*/
|
*/
|
||||||
char **configFiles; /* config files loaded */
|
FcChar8 **configFiles; /* config files loaded */
|
||||||
/*
|
/*
|
||||||
* Substitution instructions for patterns and fonts;
|
* Substitution instructions for patterns and fonts;
|
||||||
* maxObjects is used to allocate appropriate intermediate storage
|
* maxObjects is used to allocate appropriate intermediate storage
|
||||||
|
@ -250,9 +250,9 @@ struct _FcConfig {
|
||||||
FcFileCache *
|
FcFileCache *
|
||||||
FcFileCacheCreate (void);
|
FcFileCacheCreate (void);
|
||||||
|
|
||||||
char *
|
FcChar8 *
|
||||||
FcFileCacheFind (FcFileCache *cache,
|
FcFileCacheFind (FcFileCache *cache,
|
||||||
const char *file,
|
const FcChar8 *file,
|
||||||
int id,
|
int id,
|
||||||
int *count);
|
int *count);
|
||||||
|
|
||||||
|
@ -261,37 +261,37 @@ FcFileCacheDestroy (FcFileCache *cache);
|
||||||
|
|
||||||
void
|
void
|
||||||
FcFileCacheLoad (FcFileCache *cache,
|
FcFileCacheLoad (FcFileCache *cache,
|
||||||
const char *cache_file);
|
const FcChar8 *cache_file);
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcFileCacheUpdate (FcFileCache *cache,
|
FcFileCacheUpdate (FcFileCache *cache,
|
||||||
const char *file,
|
const FcChar8 *file,
|
||||||
int id,
|
int id,
|
||||||
const char *name);
|
const FcChar8 *name);
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcFileCacheSave (FcFileCache *cache,
|
FcFileCacheSave (FcFileCache *cache,
|
||||||
const char *cache_file);
|
const FcChar8 *cache_file);
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcFileCacheReadDir (FcFontSet *set, const char *cache_file);
|
FcFileCacheReadDir (FcFontSet *set, const FcChar8 *cache_file);
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcFileCacheWriteDir (FcFontSet *set, const char *cache_file);
|
FcFileCacheWriteDir (FcFontSet *set, const FcChar8 *cache_file);
|
||||||
|
|
||||||
/* fccfg.c */
|
/* fccfg.c */
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcConfigAddDir (FcConfig *config,
|
FcConfigAddDir (FcConfig *config,
|
||||||
const char *d);
|
const FcChar8 *d);
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcConfigAddConfigFile (FcConfig *config,
|
FcConfigAddConfigFile (FcConfig *config,
|
||||||
const char *f);
|
const FcChar8 *f);
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcConfigSetCache (FcConfig *config,
|
FcConfigSetCache (FcConfig *config,
|
||||||
const char *c);
|
const FcChar8 *c);
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcConfigAddBlank (FcConfig *config,
|
FcConfigAddBlank (FcConfig *config,
|
||||||
|
@ -352,22 +352,6 @@ int
|
||||||
FcDebug (void);
|
FcDebug (void);
|
||||||
|
|
||||||
/* fcdir.c */
|
/* fcdir.c */
|
||||||
FcBool
|
|
||||||
FcFileScan (FcFontSet *set,
|
|
||||||
FcFileCache *cache,
|
|
||||||
FcBlanks *blanks,
|
|
||||||
const char *file,
|
|
||||||
FcBool force);
|
|
||||||
|
|
||||||
FcBool
|
|
||||||
FcDirScan (FcFontSet *set,
|
|
||||||
FcFileCache *cache,
|
|
||||||
FcBlanks *blanks,
|
|
||||||
const char *dir,
|
|
||||||
FcBool force);
|
|
||||||
|
|
||||||
FcBool
|
|
||||||
FcDirSave (FcFontSet *set, const char *dir);
|
|
||||||
|
|
||||||
/* fcfont.c */
|
/* fcfont.c */
|
||||||
int
|
int
|
||||||
|
@ -400,7 +384,7 @@ FcExpr *
|
||||||
FcExprCreateDouble (double d);
|
FcExprCreateDouble (double d);
|
||||||
|
|
||||||
FcExpr *
|
FcExpr *
|
||||||
FcExprCreateString (const char *s);
|
FcExprCreateString (const FcChar8 *s);
|
||||||
|
|
||||||
FcExpr *
|
FcExpr *
|
||||||
FcExprCreateMatrix (const FcMatrix *m);
|
FcExprCreateMatrix (const FcMatrix *m);
|
||||||
|
@ -415,7 +399,7 @@ FcExpr *
|
||||||
FcExprCreateField (const char *field);
|
FcExprCreateField (const char *field);
|
||||||
|
|
||||||
FcExpr *
|
FcExpr *
|
||||||
FcExprCreateConst (const char *constant);
|
FcExprCreateConst (const FcChar8 *constant);
|
||||||
|
|
||||||
FcExpr *
|
FcExpr *
|
||||||
FcExprCreateOp (FcExpr *left, FcOp op, FcExpr *right);
|
FcExprCreateOp (FcExpr *left, FcOp op, FcExpr *right);
|
||||||
|
@ -445,11 +429,9 @@ FcMemFree (int kind, int size);
|
||||||
/* fcmatch.c */
|
/* fcmatch.c */
|
||||||
|
|
||||||
/* fcname.c */
|
/* fcname.c */
|
||||||
FcBool
|
|
||||||
FcNameConstant (char *string, int *result);
|
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcNameBool (char *v, FcBool *result);
|
FcNameBool (FcChar8 *v, FcBool *result);
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcNameBufChar (FcNameBuf *buf, FcChar8 c);
|
FcNameBufChar (FcNameBuf *buf, FcChar8 c);
|
||||||
|
@ -471,10 +453,10 @@ void
|
||||||
FcMatrixFree (FcMatrix *mat);
|
FcMatrixFree (FcMatrix *mat);
|
||||||
|
|
||||||
/* fcstr.c */
|
/* fcstr.c */
|
||||||
char *
|
FcChar8 *
|
||||||
FcStrPlus (const char *s1, const char *s2);
|
FcStrPlus (const FcChar8 *s1, const FcChar8 *s2);
|
||||||
|
|
||||||
void
|
void
|
||||||
FcStrFree (char *s);
|
FcStrFree (FcChar8 *s);
|
||||||
|
|
||||||
#endif /* _FC_INT_H_ */
|
#endif /* _FC_INT_H_ */
|
||||||
|
|
|
@ -134,7 +134,8 @@ FcCompareValueList (const char *object,
|
||||||
|
|
||||||
for (i = 0; i < NUM_MATCHER; i++)
|
for (i = 0; i < NUM_MATCHER; i++)
|
||||||
{
|
{
|
||||||
if (!FcStrCmpIgnoreCase (_FcMatchers[i].object, object))
|
if (!FcStrCmpIgnoreCase ((FcChar8 *) _FcMatchers[i].object,
|
||||||
|
(FcChar8 *) object))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i == NUM_MATCHER)
|
if (i == NUM_MATCHER)
|
||||||
|
@ -202,8 +203,8 @@ FcCompare (FcPattern *pat,
|
||||||
{
|
{
|
||||||
for (i2 = 0; i2 < fnt->num; i2++)
|
for (i2 = 0; i2 < fnt->num; i2++)
|
||||||
{
|
{
|
||||||
if (!FcStrCmpIgnoreCase (pat->elts[i1].object,
|
if (!FcStrCmpIgnoreCase ((FcChar8 *) pat->elts[i1].object,
|
||||||
fnt->elts[i2].object))
|
(FcChar8 *) fnt->elts[i2].object))
|
||||||
{
|
{
|
||||||
if (!FcCompareValueList (pat->elts[i1].object,
|
if (!FcCompareValueList (pat->elts[i1].object,
|
||||||
pat->elts[i1].values,
|
pat->elts[i1].values,
|
||||||
|
|
86
src/fcname.c
86
src/fcname.c
|
@ -120,7 +120,7 @@ FcNameGetObjectType (const char *object)
|
||||||
for (i = 0; i < l->ntypes; i++)
|
for (i = 0; i < l->ntypes; i++)
|
||||||
{
|
{
|
||||||
t = &l->types[i];
|
t = &l->types[i];
|
||||||
if (!FcStrCmpIgnoreCase (object, t->object))
|
if (!FcStrCmpIgnoreCase ((FcChar8 *) object, (FcChar8 *) t->object))
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,24 +128,24 @@ FcNameGetObjectType (const char *object)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const FcConstant _FcBaseConstants[] = {
|
static const FcConstant _FcBaseConstants[] = {
|
||||||
{ "light", "weight", FC_WEIGHT_LIGHT, },
|
{ (FcChar8 *) "light", "weight", FC_WEIGHT_LIGHT, },
|
||||||
{ "medium", "weight", FC_WEIGHT_MEDIUM, },
|
{ (FcChar8 *) "medium", "weight", FC_WEIGHT_MEDIUM, },
|
||||||
{ "demibold", "weight", FC_WEIGHT_DEMIBOLD, },
|
{ (FcChar8 *) "demibold", "weight", FC_WEIGHT_DEMIBOLD, },
|
||||||
{ "bold", "weight", FC_WEIGHT_BOLD, },
|
{ (FcChar8 *) "bold", "weight", FC_WEIGHT_BOLD, },
|
||||||
{ "black", "weight", FC_WEIGHT_BLACK, },
|
{ (FcChar8 *) "black", "weight", FC_WEIGHT_BLACK, },
|
||||||
|
|
||||||
{ "roman", "slant", FC_SLANT_ROMAN, },
|
{ (FcChar8 *) "roman", "slant", FC_SLANT_ROMAN, },
|
||||||
{ "italic", "slant", FC_SLANT_ITALIC, },
|
{ (FcChar8 *) "italic", "slant", FC_SLANT_ITALIC, },
|
||||||
{ "oblique", "slant", FC_SLANT_OBLIQUE, },
|
{ (FcChar8 *) "oblique", "slant", FC_SLANT_OBLIQUE, },
|
||||||
|
|
||||||
{ "proportional", "spacing", FC_PROPORTIONAL, },
|
{ (FcChar8 *) "proportional", "spacing", FC_PROPORTIONAL, },
|
||||||
{ "mono", "spacing", FC_MONO, },
|
{ (FcChar8 *) "mono", "spacing", FC_MONO, },
|
||||||
{ "charcell", "spacing", FC_CHARCELL, },
|
{ (FcChar8 *) "charcell", "spacing", FC_CHARCELL, },
|
||||||
|
|
||||||
{ "rgb", "rgba", FC_RGBA_RGB, },
|
{ (FcChar8 *) "rgb", "rgba", FC_RGBA_RGB, },
|
||||||
{ "bgr", "rgba", FC_RGBA_BGR, },
|
{ (FcChar8 *) "bgr", "rgba", FC_RGBA_BGR, },
|
||||||
{ "vrgb", "rgba", FC_RGBA_VRGB },
|
{ (FcChar8 *) "vrgb", "rgba", FC_RGBA_VRGB },
|
||||||
{ "vbgr", "rgba", FC_RGBA_VBGR },
|
{ (FcChar8 *) "vbgr", "rgba", FC_RGBA_VBGR },
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NUM_FC_CONSTANTS (sizeof _FcBaseConstants/sizeof _FcBaseConstants[0])
|
#define NUM_FC_CONSTANTS (sizeof _FcBaseConstants/sizeof _FcBaseConstants[0])
|
||||||
|
@ -201,7 +201,7 @@ FcNameUnregisterConstants (const FcConstant *consts, int nconsts)
|
||||||
}
|
}
|
||||||
|
|
||||||
const FcConstant *
|
const FcConstant *
|
||||||
FcNameGetConstant (char *string)
|
FcNameGetConstant (FcChar8 *string)
|
||||||
{
|
{
|
||||||
const FcConstantList *l;
|
const FcConstantList *l;
|
||||||
int i;
|
int i;
|
||||||
|
@ -216,7 +216,7 @@ FcNameGetConstant (char *string)
|
||||||
}
|
}
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcNameConstant (char *string, int *result)
|
FcNameConstant (FcChar8 *string, int *result)
|
||||||
{
|
{
|
||||||
const FcConstant *c;
|
const FcConstant *c;
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ FcNameConstant (char *string, int *result)
|
||||||
}
|
}
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcNameBool (char *v, FcBool *result)
|
FcNameBool (FcChar8 *v, FcBool *result)
|
||||||
{
|
{
|
||||||
char c0, c1;
|
char c0, c1;
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ FcNameBool (char *v, FcBool *result)
|
||||||
}
|
}
|
||||||
|
|
||||||
static FcValue
|
static FcValue
|
||||||
FcNameConvert (FcType type, char *string, FcMatrix *m)
|
FcNameConvert (FcType type, FcChar8 *string, FcMatrix *m)
|
||||||
{
|
{
|
||||||
FcValue v;
|
FcValue v;
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ FcNameConvert (FcType type, char *string, FcMatrix *m)
|
||||||
switch (v.type) {
|
switch (v.type) {
|
||||||
case FcTypeInteger:
|
case FcTypeInteger:
|
||||||
if (!FcNameConstant (string, &v.u.i))
|
if (!FcNameConstant (string, &v.u.i))
|
||||||
v.u.i = atoi (string);
|
v.u.i = atoi ((char *) string);
|
||||||
break;
|
break;
|
||||||
case FcTypeString:
|
case FcTypeString:
|
||||||
v.u.s = string;
|
v.u.s = string;
|
||||||
|
@ -284,11 +284,11 @@ FcNameConvert (FcType type, char *string, FcMatrix *m)
|
||||||
v.u.b = FcFalse;
|
v.u.b = FcFalse;
|
||||||
break;
|
break;
|
||||||
case FcTypeDouble:
|
case FcTypeDouble:
|
||||||
v.u.d = strtod (string, 0);
|
v.u.d = strtod ((char *) string, 0);
|
||||||
break;
|
break;
|
||||||
case FcTypeMatrix:
|
case FcTypeMatrix:
|
||||||
v.u.m = m;
|
v.u.m = m;
|
||||||
sscanf (string, "%lg %lg %lg %lg", &m->xx, &m->xy, &m->yx, &m->yy);
|
sscanf ((char *) string, "%lg %lg %lg %lg", &m->xx, &m->xy, &m->yx, &m->yy);
|
||||||
break;
|
break;
|
||||||
case FcTypeCharSet:
|
case FcTypeCharSet:
|
||||||
v.u.c = FcNameParseCharSet (string);
|
v.u.c = FcNameParseCharSet (string);
|
||||||
|
@ -299,10 +299,10 @@ FcNameConvert (FcType type, char *string, FcMatrix *m)
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const FcChar8 *
|
||||||
FcNameFindNext (const char *cur, const char *delim, char *save, char *last)
|
FcNameFindNext (const FcChar8 *cur, const char *delim, FcChar8 *save, FcChar8 *last)
|
||||||
{
|
{
|
||||||
char c;
|
FcChar8 c;
|
||||||
|
|
||||||
while ((c = *cur))
|
while ((c = *cur))
|
||||||
{
|
{
|
||||||
|
@ -325,19 +325,19 @@ FcNameFindNext (const char *cur, const char *delim, char *save, char *last)
|
||||||
}
|
}
|
||||||
|
|
||||||
FcPattern *
|
FcPattern *
|
||||||
FcNameParse (const char *name)
|
FcNameParse (const FcChar8 *name)
|
||||||
{
|
{
|
||||||
char *save;
|
FcChar8 *save;
|
||||||
FcPattern *pat;
|
FcPattern *pat;
|
||||||
double d;
|
double d;
|
||||||
char *e;
|
FcChar8 *e;
|
||||||
char delim;
|
FcChar8 delim;
|
||||||
FcValue v;
|
FcValue v;
|
||||||
FcMatrix m;
|
FcMatrix m;
|
||||||
const FcObjectType *t;
|
const FcObjectType *t;
|
||||||
const FcConstant *c;
|
const FcConstant *c;
|
||||||
|
|
||||||
save = malloc (strlen (name) + 1);
|
save = malloc (strlen ((char *) name) + 1);
|
||||||
if (!save)
|
if (!save)
|
||||||
goto bail0;
|
goto bail0;
|
||||||
pat = FcPatternCreate ();
|
pat = FcPatternCreate ();
|
||||||
|
@ -360,7 +360,7 @@ FcNameParse (const char *name)
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
name = FcNameFindNext (name, "-,:", save, &delim);
|
name = FcNameFindNext (name, "-,:", save, &delim);
|
||||||
d = strtod (save, &e);
|
d = strtod ((char *) save, (char **) &e);
|
||||||
if (e != save)
|
if (e != save)
|
||||||
{
|
{
|
||||||
if (!FcPatternAddDouble (pat, FC_SIZE, d))
|
if (!FcPatternAddDouble (pat, FC_SIZE, d))
|
||||||
|
@ -377,7 +377,7 @@ FcNameParse (const char *name)
|
||||||
{
|
{
|
||||||
if (delim == '=' || delim == '_')
|
if (delim == '=' || delim == '_')
|
||||||
{
|
{
|
||||||
t = FcNameGetObjectType (save);
|
t = FcNameGetObjectType ((char *) save);
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
name = FcNameFindNext (name, ":,", save, &delim);
|
name = FcNameFindNext (name, ":,", save, &delim);
|
||||||
|
@ -534,7 +534,7 @@ FcNameUnparseValue (FcNameBuf *buf,
|
||||||
case FcTypeString:
|
case FcTypeString:
|
||||||
return FcNameUnparseString (buf, v.u.s, escape);
|
return FcNameUnparseString (buf, v.u.s, escape);
|
||||||
case FcTypeBool:
|
case FcTypeBool:
|
||||||
return FcNameUnparseString (buf, v.u.b ? "True" : "False", 0);
|
return FcNameUnparseString (buf, v.u.b ? (FcChar8 *) "True" : (FcChar8 *) "False", 0);
|
||||||
case FcTypeMatrix:
|
case FcTypeMatrix:
|
||||||
sprintf ((char *) temp, "%g %g %g %g",
|
sprintf ((char *) temp, "%g %g %g %g",
|
||||||
v.u.m->xx, v.u.m->xy, v.u.m->yx, v.u.m->yy);
|
v.u.m->xx, v.u.m->xy, v.u.m->yx, v.u.m->yy);
|
||||||
|
@ -548,14 +548,14 @@ FcNameUnparseValue (FcNameBuf *buf,
|
||||||
static FcBool
|
static FcBool
|
||||||
FcNameUnparseValueList (FcNameBuf *buf,
|
FcNameUnparseValueList (FcNameBuf *buf,
|
||||||
FcValueList *v,
|
FcValueList *v,
|
||||||
char *escape)
|
FcChar8 *escape)
|
||||||
{
|
{
|
||||||
while (v)
|
while (v)
|
||||||
{
|
{
|
||||||
if (!FcNameUnparseValue (buf, v->value, escape))
|
if (!FcNameUnparseValue (buf, v->value, escape))
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
if ((v = v->next))
|
if ((v = v->next))
|
||||||
if (!FcNameUnparseString (buf, ",", 0))
|
if (!FcNameUnparseString (buf, (FcChar8 *) ",", 0))
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
}
|
}
|
||||||
return FcTrue;
|
return FcTrue;
|
||||||
|
@ -578,15 +578,15 @@ FcNameUnparse (FcPattern *pat)
|
||||||
e = FcPatternFind (pat, FC_FAMILY, FcFalse);
|
e = FcPatternFind (pat, FC_FAMILY, FcFalse);
|
||||||
if (e)
|
if (e)
|
||||||
{
|
{
|
||||||
if (!FcNameUnparseValueList (&buf, e->values, FC_ESCAPE_FIXED))
|
if (!FcNameUnparseValueList (&buf, e->values, (FcChar8 *) FC_ESCAPE_FIXED))
|
||||||
goto bail0;
|
goto bail0;
|
||||||
}
|
}
|
||||||
e = FcPatternFind (pat, FC_SIZE, FcFalse);
|
e = FcPatternFind (pat, FC_SIZE, FcFalse);
|
||||||
if (e)
|
if (e)
|
||||||
{
|
{
|
||||||
if (!FcNameUnparseString (&buf, "-", 0))
|
if (!FcNameUnparseString (&buf, (FcChar8 *) "-", 0))
|
||||||
goto bail0;
|
goto bail0;
|
||||||
if (!FcNameUnparseValueList (&buf, e->values, FC_ESCAPE_FIXED))
|
if (!FcNameUnparseValueList (&buf, e->values, (FcChar8 *) FC_ESCAPE_FIXED))
|
||||||
goto bail0;
|
goto bail0;
|
||||||
}
|
}
|
||||||
for (l = _FcObjectTypes; l; l = l->next)
|
for (l = _FcObjectTypes; l; l = l->next)
|
||||||
|
@ -602,14 +602,14 @@ FcNameUnparse (FcPattern *pat)
|
||||||
e = FcPatternFind (pat, o->object, FcFalse);
|
e = FcPatternFind (pat, o->object, FcFalse);
|
||||||
if (e)
|
if (e)
|
||||||
{
|
{
|
||||||
if (!FcNameUnparseString (&buf, ":", 0))
|
if (!FcNameUnparseString (&buf, (FcChar8 *) ":", 0))
|
||||||
goto bail0;
|
goto bail0;
|
||||||
if (!FcNameUnparseString (&buf, o->object, FC_ESCAPE_VARIABLE))
|
if (!FcNameUnparseString (&buf, (FcChar8 *) o->object, (FcChar8 *) FC_ESCAPE_VARIABLE))
|
||||||
goto bail0;
|
goto bail0;
|
||||||
if (!FcNameUnparseString (&buf, "=", 0))
|
if (!FcNameUnparseString (&buf, (FcChar8 *) "=", 0))
|
||||||
goto bail0;
|
goto bail0;
|
||||||
if (!FcNameUnparseValueList (&buf, e->values,
|
if (!FcNameUnparseValueList (&buf, e->values,
|
||||||
FC_ESCAPE_VARIABLE))
|
(FcChar8 *) FC_ESCAPE_VARIABLE))
|
||||||
goto bail0;
|
goto bail0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
10
src/fcpat.c
10
src/fcpat.c
|
@ -139,7 +139,7 @@ FcPatternFind (FcPattern *p, const char *object, FcBool insert)
|
||||||
/* match existing */
|
/* match existing */
|
||||||
for (i = 0; i < p->num; i++)
|
for (i = 0; i < p->num; i++)
|
||||||
{
|
{
|
||||||
if (!FcStrCmpIgnoreCase (object, p->elts[i].object))
|
if (!FcStrCmpIgnoreCase ((FcChar8 *) object, (FcChar8 *) p->elts[i].object))
|
||||||
return &p->elts[i];
|
return &p->elts[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,12 +278,12 @@ FcPatternAddDouble (FcPattern *p, const char *object, double d)
|
||||||
|
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcPatternAddString (FcPattern *p, const char *object, const char *s)
|
FcPatternAddString (FcPattern *p, const char *object, const FcChar8 *s)
|
||||||
{
|
{
|
||||||
FcValue v;
|
FcValue v;
|
||||||
|
|
||||||
v.type = FcTypeString;
|
v.type = FcTypeString;
|
||||||
v.u.s = (char *) s;
|
v.u.s = s;
|
||||||
return FcPatternAdd (p, object, v, FcTrue);
|
return FcPatternAdd (p, object, v, FcTrue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,7 +384,7 @@ FcPatternGetDouble (FcPattern *p, const char *object, int id, double *d)
|
||||||
}
|
}
|
||||||
|
|
||||||
FcResult
|
FcResult
|
||||||
FcPatternGetString (FcPattern *p, const char *object, int id, char ** s)
|
FcPatternGetString (FcPattern *p, const char *object, int id, FcChar8 const ** s)
|
||||||
{
|
{
|
||||||
FcValue v;
|
FcValue v;
|
||||||
FcResult r;
|
FcResult r;
|
||||||
|
@ -394,7 +394,7 @@ FcPatternGetString (FcPattern *p, const char *object, int id, char ** s)
|
||||||
return r;
|
return r;
|
||||||
if (v.type != FcTypeString)
|
if (v.type != FcTypeString)
|
||||||
return FcResultTypeMismatch;
|
return FcResultTypeMismatch;
|
||||||
*s = (char *) v.u.s;
|
*s = v.u.s;
|
||||||
return FcResultMatch;
|
return FcResultMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
32
src/fcstr.c
32
src/fcstr.c
|
@ -27,46 +27,46 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "fcint.h"
|
#include "fcint.h"
|
||||||
|
|
||||||
char *
|
FcChar8 *
|
||||||
FcStrCopy (const char *s)
|
FcStrCopy (const FcChar8 *s)
|
||||||
{
|
{
|
||||||
char *r;
|
FcChar8 *r;
|
||||||
|
|
||||||
if (!s)
|
if (!s)
|
||||||
return 0;
|
return 0;
|
||||||
r = (char *) malloc (strlen (s) + 1);
|
r = (FcChar8 *) malloc (strlen ((char *) s) + 1);
|
||||||
if (!r)
|
if (!r)
|
||||||
return 0;
|
return 0;
|
||||||
FcMemAlloc (FC_MEM_STRING, strlen (s) + 1);
|
FcMemAlloc (FC_MEM_STRING, strlen ((char *) s) + 1);
|
||||||
strcpy (r, s);
|
strcpy ((char *) r, (char *) s);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
FcChar8 *
|
||||||
FcStrPlus (const char *s1, const char *s2)
|
FcStrPlus (const FcChar8 *s1, const FcChar8 *s2)
|
||||||
{
|
{
|
||||||
int l = strlen (s1) + strlen (s2) + 1;
|
int l = strlen ((char *)s1) + strlen ((char *) s2) + 1;
|
||||||
char *s = malloc (l);
|
FcChar8 *s = malloc (l);
|
||||||
|
|
||||||
if (!s)
|
if (!s)
|
||||||
return 0;
|
return 0;
|
||||||
FcMemAlloc (FC_MEM_STRING, l);
|
FcMemAlloc (FC_MEM_STRING, l);
|
||||||
strcpy (s, s1);
|
strcpy ((char *) s, (char *) s1);
|
||||||
strcat (s, s2);
|
strcat ((char *) s, (char *) s2);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FcStrFree (char *s)
|
FcStrFree (FcChar8 *s)
|
||||||
{
|
{
|
||||||
FcMemFree (FC_MEM_STRING, strlen (s) + 1);
|
FcMemFree (FC_MEM_STRING, strlen ((char *) s) + 1);
|
||||||
free (s);
|
free (s);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
FcStrCmpIgnoreCase (const char *s1, const char *s2)
|
FcStrCmpIgnoreCase (const FcChar8 *s1, const FcChar8 *s2)
|
||||||
{
|
{
|
||||||
char c1, c2;
|
FcChar8 c1, c2;
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
|
135
src/fcxml.c
135
src/fcxml.c
|
@ -29,25 +29,25 @@ static xmlParserInputPtr
|
||||||
FcEntityLoader (const char *url, const char *id, xmlParserCtxtPtr ctxt)
|
FcEntityLoader (const char *url, const char *id, xmlParserCtxtPtr ctxt)
|
||||||
{
|
{
|
||||||
xmlParserInputPtr ret;
|
xmlParserInputPtr ret;
|
||||||
char *file;
|
FcChar8 *file;
|
||||||
|
|
||||||
file = FcConfigFilename (url);
|
file = FcConfigFilename ((FcChar8 *) url);
|
||||||
if (!file)
|
if (!file)
|
||||||
return 0;
|
return 0;
|
||||||
ret = xmlNewInputFromFile (ctxt, file);
|
ret = xmlNewInputFromFile (ctxt, (char *) file);
|
||||||
free (file);
|
free (file);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
xmlDocPtr
|
xmlDocPtr
|
||||||
FcConfigLoad (const char *file)
|
FcConfigLoad (const FcChar8 *file)
|
||||||
{
|
{
|
||||||
xmlDocPtr doc;
|
xmlDocPtr doc;
|
||||||
xmlExternalEntityLoader previous;
|
xmlExternalEntityLoader previous;
|
||||||
|
|
||||||
previous = xmlGetExternalEntityLoader ();
|
previous = xmlGetExternalEntityLoader ();
|
||||||
xmlSetExternalEntityLoader (FcEntityLoader);
|
xmlSetExternalEntityLoader (FcEntityLoader);
|
||||||
doc = xmlParseFile (file);
|
doc = xmlParseFile ((char *) file);
|
||||||
xmlSetExternalEntityLoader (previous);
|
xmlSetExternalEntityLoader (previous);
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ FcTestCreate (FcQual qual, const char *field, FcOp compare, FcExpr *expr)
|
||||||
{
|
{
|
||||||
test->next = 0;
|
test->next = 0;
|
||||||
test->qual = qual;
|
test->qual = qual;
|
||||||
test->field = FcStrCopy (field);
|
test->field = (char *) FcStrCopy ((FcChar8 *) field);
|
||||||
test->op = compare;
|
test->op = compare;
|
||||||
test->expr = expr;
|
test->expr = expr;
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ FcExprCreateDouble (double d)
|
||||||
}
|
}
|
||||||
|
|
||||||
FcExpr *
|
FcExpr *
|
||||||
FcExprCreateString (const char *s)
|
FcExprCreateString (const FcChar8 *s)
|
||||||
{
|
{
|
||||||
FcExpr *e = (FcExpr *) malloc (sizeof (FcExpr));
|
FcExpr *e = (FcExpr *) malloc (sizeof (FcExpr));
|
||||||
|
|
||||||
|
@ -170,13 +170,13 @@ FcExprCreateField (const char *field)
|
||||||
if (e)
|
if (e)
|
||||||
{
|
{
|
||||||
e->op = FcOpField;
|
e->op = FcOpField;
|
||||||
e->u.field = FcStrCopy (field);
|
e->u.field = (char *) FcStrCopy ((FcChar8 *) field);
|
||||||
}
|
}
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
FcExpr *
|
FcExpr *
|
||||||
FcExprCreateConst (const char *constant)
|
FcExprCreateConst (const FcChar8 *constant)
|
||||||
{
|
{
|
||||||
FcExpr *e = (FcExpr *) malloc (sizeof (FcExpr));
|
FcExpr *e = (FcExpr *) malloc (sizeof (FcExpr));
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ FcExprDestroy (FcExpr *e)
|
||||||
case FcOpBool:
|
case FcOpBool:
|
||||||
break;
|
break;
|
||||||
case FcOpField:
|
case FcOpField:
|
||||||
FcStrFree (e->u.field);
|
FcStrFree ((FcChar8 *) e->u.field);
|
||||||
break;
|
break;
|
||||||
case FcOpConst:
|
case FcOpConst:
|
||||||
FcStrFree (e->u.constant);
|
FcStrFree (e->u.constant);
|
||||||
|
@ -289,7 +289,7 @@ FcEditDestroy (FcEdit *e)
|
||||||
char *
|
char *
|
||||||
FcConfigSaveField (const char *field)
|
FcConfigSaveField (const char *field)
|
||||||
{
|
{
|
||||||
return FcStrCopy (field);
|
return (char *) FcStrCopy ((FcChar8 *) field);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -304,11 +304,11 @@ FcConfigParseError (char *fmt, ...)
|
||||||
va_end (args);
|
va_end (args);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static xmlChar *
|
||||||
FcConfigContent (xmlDocPtr doc,
|
FcConfigContent (xmlDocPtr doc,
|
||||||
xmlNodePtr node)
|
xmlNodePtr node)
|
||||||
{
|
{
|
||||||
char *content;
|
xmlChar *content;
|
||||||
|
|
||||||
content = xmlNodeListGetString (doc, node->children, 1);
|
content = xmlNodeListGetString (doc, node->children, 1);
|
||||||
if (!content)
|
if (!content)
|
||||||
|
@ -320,11 +320,11 @@ FcConfigContent (xmlDocPtr doc,
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static xmlChar *
|
||||||
FcConfigAttr (xmlDocPtr doc,
|
FcConfigAttr (xmlDocPtr doc,
|
||||||
xmlAttrPtr attr)
|
xmlAttrPtr attr)
|
||||||
{
|
{
|
||||||
char *content;
|
xmlChar *content;
|
||||||
|
|
||||||
content = xmlNodeListGetString (doc, attr->children, 1);
|
content = xmlNodeListGetString (doc, attr->children, 1);
|
||||||
if (!content)
|
if (!content)
|
||||||
|
@ -374,7 +374,7 @@ static struct {
|
||||||
#define NUM_OPS (sizeof fcOps / sizeof fcOps[0])
|
#define NUM_OPS (sizeof fcOps / sizeof fcOps[0])
|
||||||
|
|
||||||
static FcOp
|
static FcOp
|
||||||
FcConfigLexOp (const char *op)
|
FcConfigLexOp (const xmlChar *op)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -384,7 +384,7 @@ FcConfigLexOp (const char *op)
|
||||||
}
|
}
|
||||||
|
|
||||||
static FcBool
|
static FcBool
|
||||||
FcConfigLexBool (const char *bool)
|
FcConfigLexBool (const xmlChar *bool)
|
||||||
{
|
{
|
||||||
if (*bool == 't' || *bool == 'T')
|
if (*bool == 't' || *bool == 'T')
|
||||||
return FcTrue;
|
return FcTrue;
|
||||||
|
@ -400,11 +400,11 @@ FcConfigParseDir (FcConfig *config,
|
||||||
xmlDocPtr doc,
|
xmlDocPtr doc,
|
||||||
xmlNodePtr dir)
|
xmlNodePtr dir)
|
||||||
{
|
{
|
||||||
char *content = FcConfigContent (doc, dir);
|
xmlChar *content = FcConfigContent (doc, dir);
|
||||||
|
|
||||||
if (!content)
|
if (!content)
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
return FcConfigAddDir (config, content);
|
return FcConfigAddDir (config, (FcChar8 *) content);
|
||||||
}
|
}
|
||||||
|
|
||||||
static FcBool
|
static FcBool
|
||||||
|
@ -412,11 +412,11 @@ FcConfigParseCache (FcConfig *config,
|
||||||
xmlDocPtr doc,
|
xmlDocPtr doc,
|
||||||
xmlNodePtr dir)
|
xmlNodePtr dir)
|
||||||
{
|
{
|
||||||
char *content = FcConfigContent (doc, dir);
|
xmlChar *content = FcConfigContent (doc, dir);
|
||||||
|
|
||||||
if (!content)
|
if (!content)
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
return FcConfigSetCache (config, content);
|
return FcConfigSetCache (config, (FcChar8 *) content);
|
||||||
}
|
}
|
||||||
|
|
||||||
static FcBool
|
static FcBool
|
||||||
|
@ -424,7 +424,7 @@ FcConfigParseInclude (FcConfig *config,
|
||||||
xmlDocPtr doc,
|
xmlDocPtr doc,
|
||||||
xmlNodePtr inc)
|
xmlNodePtr inc)
|
||||||
{
|
{
|
||||||
char *content = FcConfigContent (doc, inc);
|
xmlChar *content = FcConfigContent (doc, inc);
|
||||||
xmlAttr *attr;
|
xmlAttr *attr;
|
||||||
FcBool complain = FcTrue;
|
FcBool complain = FcTrue;
|
||||||
|
|
||||||
|
@ -438,7 +438,7 @@ FcConfigParseInclude (FcConfig *config,
|
||||||
if (!strcmp (attr->name, "ignore_missing"))
|
if (!strcmp (attr->name, "ignore_missing"))
|
||||||
complain = !FcConfigLexBool (FcConfigAttr (doc, attr));
|
complain = !FcConfigLexBool (FcConfigAttr (doc, attr));
|
||||||
}
|
}
|
||||||
return FcConfigParseAndLoad (config, content, complain);
|
return FcConfigParseAndLoad (config, (FcChar8 *) content, complain);
|
||||||
}
|
}
|
||||||
|
|
||||||
static FcBool
|
static FcBool
|
||||||
|
@ -455,7 +455,7 @@ FcConfigParseBlank (FcConfig *config,
|
||||||
continue;
|
continue;
|
||||||
if (!strcmp (node->name, "int"))
|
if (!strcmp (node->name, "int"))
|
||||||
{
|
{
|
||||||
ucs4 = (FcChar32) strtol (FcConfigContent (doc, node), 0, 0);
|
ucs4 = (FcChar32) strtol ((char *) FcConfigContent (doc, node), 0, 0);
|
||||||
if (!config->blanks)
|
if (!config->blanks)
|
||||||
{
|
{
|
||||||
config->blanks = FcBlanksCreate ();
|
config->blanks = FcBlanksCreate ();
|
||||||
|
@ -500,7 +500,7 @@ FcConfigParseMatrix (xmlDocPtr doc,
|
||||||
static FcMatrix m;
|
static FcMatrix m;
|
||||||
enum { m_xx, m_xy, m_yx, m_yy, m_done } matrix_state = m_xx;
|
enum { m_xx, m_xy, m_yx, m_yy, m_done } matrix_state = m_xx;
|
||||||
double v;
|
double v;
|
||||||
char *text;
|
xmlChar *text;
|
||||||
|
|
||||||
FcMatrixInit (&m);
|
FcMatrixInit (&m);
|
||||||
|
|
||||||
|
@ -513,7 +513,7 @@ FcConfigParseMatrix (xmlDocPtr doc,
|
||||||
text = FcConfigContent (doc, node);
|
text = FcConfigContent (doc, node);
|
||||||
if (!text)
|
if (!text)
|
||||||
continue;
|
continue;
|
||||||
v = strtod (text, 0);
|
v = strtod ((char *) text, 0);
|
||||||
switch (matrix_state) {
|
switch (matrix_state) {
|
||||||
case m_xx: m.xx = v; break;
|
case m_xx: m.xx = v; break;
|
||||||
case m_xy: m.xy = v; break;
|
case m_xy: m.xy = v; break;
|
||||||
|
@ -537,13 +537,13 @@ FcConfigParseExpr (xmlDocPtr doc,
|
||||||
|
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case FcOpInteger:
|
case FcOpInteger:
|
||||||
l = FcExprCreateInteger (strtol (FcConfigContent (doc, expr), 0, 0));
|
l = FcExprCreateInteger (strtol ((char *) FcConfigContent (doc, expr), 0, 0));
|
||||||
break;
|
break;
|
||||||
case FcOpDouble:
|
case FcOpDouble:
|
||||||
l = FcExprCreateDouble (strtod (FcConfigContent (doc, expr), 0));
|
l = FcExprCreateDouble (strtod ((char *) FcConfigContent (doc, expr), 0));
|
||||||
break;
|
break;
|
||||||
case FcOpString:
|
case FcOpString:
|
||||||
l = FcExprCreateString (FcConfigContent (doc, expr));
|
l = FcExprCreateString ((FcChar8 *) FcConfigContent (doc, expr));
|
||||||
break;
|
break;
|
||||||
case FcOpMatrix:
|
case FcOpMatrix:
|
||||||
l = FcExprCreateMatrix (FcConfigParseMatrix (doc, expr));
|
l = FcExprCreateMatrix (FcConfigParseMatrix (doc, expr));
|
||||||
|
@ -555,10 +555,10 @@ FcConfigParseExpr (xmlDocPtr doc,
|
||||||
/* not sure what to do here yet */
|
/* not sure what to do here yet */
|
||||||
break;
|
break;
|
||||||
case FcOpField:
|
case FcOpField:
|
||||||
l = FcExprCreateField (FcConfigContent (doc, expr));
|
l = FcExprCreateField ((char *) FcConfigContent (doc, expr));
|
||||||
break;
|
break;
|
||||||
case FcOpConst:
|
case FcOpConst:
|
||||||
l = FcExprCreateConst (FcConfigContent (doc, expr));
|
l = FcExprCreateConst ((FcChar8 *) FcConfigContent (doc, expr));
|
||||||
break;
|
break;
|
||||||
case FcOpQuest:
|
case FcOpQuest:
|
||||||
for (node = expr->children; node; node = node->next)
|
for (node = expr->children; node; node = node->next)
|
||||||
|
@ -657,7 +657,7 @@ FcConfigParseTest (xmlDocPtr doc,
|
||||||
xmlAttrPtr attr;
|
xmlAttrPtr attr;
|
||||||
FcQual qual = FcQualAny;
|
FcQual qual = FcQualAny;
|
||||||
FcOp op = FcOpEqual;
|
FcOp op = FcOpEqual;
|
||||||
char *field = 0;
|
xmlChar *field = 0;
|
||||||
FcExpr *expr = 0;
|
FcExpr *expr = 0;
|
||||||
|
|
||||||
for (attr = test->properties; attr; attr = attr->next)
|
for (attr = test->properties; attr; attr = attr->next)
|
||||||
|
@ -666,26 +666,26 @@ FcConfigParseTest (xmlDocPtr doc,
|
||||||
continue;
|
continue;
|
||||||
if (!strcmp (attr->name, "qual"))
|
if (!strcmp (attr->name, "qual"))
|
||||||
{
|
{
|
||||||
char *qual_name = FcConfigAttr (doc, attr);
|
xmlChar *qual_name = FcConfigAttr (doc, attr);
|
||||||
if (!qual_name)
|
if (!qual_name)
|
||||||
;
|
;
|
||||||
else if (!strcmp (qual_name, "any"))
|
else if (!FcStrCmpIgnoreCase ((FcChar8 *) qual_name, (FcChar8 *) "any"))
|
||||||
qual = FcQualAny;
|
qual = FcQualAny;
|
||||||
else if (!strcmp (qual_name, "all"))
|
else if (!FcStrCmpIgnoreCase ((FcChar8 *) qual_name, (FcChar8 *) "all"))
|
||||||
qual = FcQualAll;
|
qual = FcQualAll;
|
||||||
}
|
}
|
||||||
else if (!strcmp (attr->name, "name"))
|
else if (!FcStrCmpIgnoreCase ((FcChar8 *) attr->name, (FcChar8 *) "name"))
|
||||||
{
|
{
|
||||||
field = FcConfigAttr (doc, attr);
|
field = FcConfigAttr (doc, attr);
|
||||||
}
|
}
|
||||||
else if (!strcmp (attr->name, "compare"))
|
else if (!FcStrCmpIgnoreCase ((FcChar8 *) attr->name, (FcChar8 *) "compare"))
|
||||||
{
|
{
|
||||||
char *compare = FcConfigAttr (doc, attr);
|
xmlChar *compare = FcConfigAttr (doc, attr);
|
||||||
|
|
||||||
if (!compare || (op = FcConfigLexOp (compare)) == FcOpInvalid)
|
if (!compare || (op = FcConfigLexOp (compare)) == FcOpInvalid)
|
||||||
{
|
{
|
||||||
FcConfigParseError ("Invalid comparison %s",
|
FcConfigParseError ("Invalid comparison %s",
|
||||||
compare ? compare : "<missing>");
|
compare ? (char *) compare : "<missing>");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -709,7 +709,7 @@ FcConfigParseTest (xmlDocPtr doc,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FcTestCreate (qual, field, op, expr);
|
return FcTestCreate (qual, (char *) field, op, expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static FcExpr *
|
static FcExpr *
|
||||||
|
@ -753,7 +753,7 @@ FcConfigParseEdit (xmlDocPtr doc,
|
||||||
xmlNodePtr edit)
|
xmlNodePtr edit)
|
||||||
{
|
{
|
||||||
xmlAttrPtr attr;
|
xmlAttrPtr attr;
|
||||||
char *name = 0;
|
xmlChar *name = 0;
|
||||||
FcOp mode = FcOpAssign;
|
FcOp mode = FcOpAssign;
|
||||||
FcExpr *e;
|
FcExpr *e;
|
||||||
FcEdit *ed;
|
FcEdit *ed;
|
||||||
|
@ -762,15 +762,15 @@ FcConfigParseEdit (xmlDocPtr doc,
|
||||||
{
|
{
|
||||||
if (attr->type != XML_ATTRIBUTE_NODE)
|
if (attr->type != XML_ATTRIBUTE_NODE)
|
||||||
continue;
|
continue;
|
||||||
if (!strcmp (attr->name, "name"))
|
if (!FcStrCmpIgnoreCase ((FcChar8 *) attr->name, (FcChar8 *) "name"))
|
||||||
name = FcConfigAttr (doc, attr);
|
name = FcConfigAttr (doc, attr);
|
||||||
else if (!strcmp (attr->name, "mode"))
|
else if (!FcStrCmpIgnoreCase ((FcChar8 *) attr->name, (FcChar8 *) "mode"))
|
||||||
mode = FcConfigLexOp (FcConfigAttr (doc, attr));
|
mode = FcConfigLexOp (FcConfigAttr (doc, attr));
|
||||||
}
|
}
|
||||||
|
|
||||||
e = FcConfigParseExprList (doc, edit->children);
|
e = FcConfigParseExprList (doc, edit->children);
|
||||||
|
|
||||||
ed = FcEditCreate (name, mode, e);
|
ed = FcEditCreate ((char *) name, mode, e);
|
||||||
if (!ed)
|
if (!ed)
|
||||||
FcExprDestroy (e);
|
FcExprDestroy (e);
|
||||||
return ed;
|
return ed;
|
||||||
|
@ -785,14 +785,14 @@ FcConfigParseMatch (FcConfig *config,
|
||||||
xmlAttrPtr attr;
|
xmlAttrPtr attr;
|
||||||
FcTest *tests = 0, **prevTest = &tests, *test;
|
FcTest *tests = 0, **prevTest = &tests, *test;
|
||||||
FcEdit *edits = 0, **prevEdit = &edits, *edit;
|
FcEdit *edits = 0, **prevEdit = &edits, *edit;
|
||||||
FcMatchKind kind;
|
FcMatchKind kind = FcMatchPattern;
|
||||||
FcBool found_kind = FcFalse;
|
FcBool found_kind = FcFalse;
|
||||||
|
|
||||||
for (node = match->children; node; node = node->next)
|
for (node = match->children; node; node = node->next)
|
||||||
{
|
{
|
||||||
if (node->type != XML_ELEMENT_NODE)
|
if (node->type != XML_ELEMENT_NODE)
|
||||||
continue;
|
continue;
|
||||||
if (!strcmp (node->name, "test"))
|
if (!FcStrCmpIgnoreCase ((FcChar8 *) node->name, (FcChar8 *) "test"))
|
||||||
{
|
{
|
||||||
test = FcConfigParseTest (doc, node);
|
test = FcConfigParseTest (doc, node);
|
||||||
if (!test)
|
if (!test)
|
||||||
|
@ -800,7 +800,7 @@ FcConfigParseMatch (FcConfig *config,
|
||||||
*prevTest = test;
|
*prevTest = test;
|
||||||
prevTest = &test->next;
|
prevTest = &test->next;
|
||||||
}
|
}
|
||||||
else if (!strcmp (node->name, "edit"))
|
else if (!FcStrCmpIgnoreCase ((FcChar8 *) node->name, (FcChar8 *) "edit"))
|
||||||
{
|
{
|
||||||
edit = FcConfigParseEdit (doc, node);
|
edit = FcConfigParseEdit (doc, node);
|
||||||
if (!edit)
|
if (!edit)
|
||||||
|
@ -814,20 +814,20 @@ FcConfigParseMatch (FcConfig *config,
|
||||||
{
|
{
|
||||||
if (attr->type != XML_ATTRIBUTE_NODE)
|
if (attr->type != XML_ATTRIBUTE_NODE)
|
||||||
continue;
|
continue;
|
||||||
if (!strcmp (attr->name, "target"))
|
if (!FcStrCmpIgnoreCase ((FcChar8 *) attr->name, (FcChar8 *) "target"))
|
||||||
{
|
{
|
||||||
char *target = FcConfigAttr (doc, attr);
|
xmlChar *target = FcConfigAttr (doc, attr);
|
||||||
if (!target)
|
if (!target)
|
||||||
{
|
{
|
||||||
FcConfigParseError ("Missing match target");
|
FcConfigParseError ("Missing match target");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (!strcmp (target, "pattern"))
|
else if (!FcStrCmpIgnoreCase ((FcChar8 *) target, (FcChar8 *) "pattern"))
|
||||||
{
|
{
|
||||||
kind = FcMatchPattern;
|
kind = FcMatchPattern;
|
||||||
found_kind = FcTrue;
|
found_kind = FcTrue;
|
||||||
}
|
}
|
||||||
else if (!strcmp (target, "font"))
|
else if (!FcStrCmpIgnoreCase ((FcChar8 *) target, (FcChar8 *) "font"))
|
||||||
{
|
{
|
||||||
kind = FcMatchFont;
|
kind = FcMatchFont;
|
||||||
found_kind = FcTrue;
|
found_kind = FcTrue;
|
||||||
|
@ -858,9 +858,10 @@ FcConfigParseFamilies (xmlDocPtr doc,
|
||||||
return 0;
|
return 0;
|
||||||
next = FcConfigParseFamilies (doc, family->next);
|
next = FcConfigParseFamilies (doc, family->next);
|
||||||
|
|
||||||
if (family->type == XML_ELEMENT_NODE && !strcmp (family->name, "family"))
|
if (family->type == XML_ELEMENT_NODE &&
|
||||||
|
!FcStrCmpIgnoreCase ((FcChar8 *) family->name, (FcChar8 *) "family"))
|
||||||
{
|
{
|
||||||
this = FcExprCreateString (FcConfigContent (doc, family));
|
this = FcExprCreateString ((FcChar8 *) FcConfigContent (doc, family));
|
||||||
if (!this)
|
if (!this)
|
||||||
goto bail;
|
goto bail;
|
||||||
if (next)
|
if (next)
|
||||||
|
@ -893,7 +894,7 @@ FcConfigParseAlias (FcConfig *config,
|
||||||
{
|
{
|
||||||
xmlNodePtr node;
|
xmlNodePtr node;
|
||||||
FcExpr *prefer = 0, *accept = 0, *def = 0;
|
FcExpr *prefer = 0, *accept = 0, *def = 0;
|
||||||
FcExpr *family;
|
FcExpr *family = 0;
|
||||||
FcEdit *edit = 0, *next;
|
FcEdit *edit = 0, *next;
|
||||||
FcTest *test;
|
FcTest *test;
|
||||||
|
|
||||||
|
@ -901,15 +902,17 @@ FcConfigParseAlias (FcConfig *config,
|
||||||
{
|
{
|
||||||
if (node->type != XML_ELEMENT_NODE)
|
if (node->type != XML_ELEMENT_NODE)
|
||||||
continue;
|
continue;
|
||||||
if (!strcmp (node->name, "family"))
|
if (!FcStrCmpIgnoreCase ((FcChar8 *) node->name, (FcChar8 *) "family"))
|
||||||
family = FcExprCreateString (FcConfigContent (doc, node));
|
family = FcExprCreateString ((FcChar8 *) FcConfigContent (doc, node));
|
||||||
else if (!strcmp (node->name, "prefer"))
|
else if (!FcStrCmpIgnoreCase ((FcChar8 *) node->name, (FcChar8 *) "prefer"))
|
||||||
prefer = FcConfigParseFamilies (doc, node->children);
|
prefer = FcConfigParseFamilies (doc, node->children);
|
||||||
else if (!strcmp (node->name, "accept"))
|
else if (!FcStrCmpIgnoreCase ((FcChar8 *) node->name, (FcChar8 *) "accept"))
|
||||||
accept = FcConfigParseFamilies (doc, node->children);
|
accept = FcConfigParseFamilies (doc, node->children);
|
||||||
else if (!strcmp (node->name, "default"))
|
else if (!FcStrCmpIgnoreCase ((FcChar8 *) node->name, (FcChar8 *) "default"))
|
||||||
def = FcConfigParseFamilies (doc, node->children);
|
def = FcConfigParseFamilies (doc, node->children);
|
||||||
}
|
}
|
||||||
|
if (!family)
|
||||||
|
return FcFalse;
|
||||||
|
|
||||||
if (prefer)
|
if (prefer)
|
||||||
{
|
{
|
||||||
|
@ -962,32 +965,32 @@ FcConfigParse (FcConfig *config,
|
||||||
{
|
{
|
||||||
if (node->type != XML_ELEMENT_NODE)
|
if (node->type != XML_ELEMENT_NODE)
|
||||||
continue;
|
continue;
|
||||||
if (!strcmp (node->name, "dir"))
|
if (!FcStrCmpIgnoreCase ((FcChar8 *) node->name, (FcChar8 *) "dir"))
|
||||||
{
|
{
|
||||||
if (!FcConfigParseDir (config, doc, node))
|
if (!FcConfigParseDir (config, doc, node))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (!strcmp (node->name, "cache"))
|
else if (!FcStrCmpIgnoreCase ((FcChar8 *) node->name, (FcChar8 *) "cache"))
|
||||||
{
|
{
|
||||||
if (!FcConfigParseCache (config, doc, node))
|
if (!FcConfigParseCache (config, doc, node))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (!strcmp (node->name, "include"))
|
else if (!FcStrCmpIgnoreCase ((FcChar8 *) node->name, (FcChar8 *) "include"))
|
||||||
{
|
{
|
||||||
if (!FcConfigParseInclude (config, doc, node))
|
if (!FcConfigParseInclude (config, doc, node))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (!strcmp (node->name, "config"))
|
else if (!FcStrCmpIgnoreCase ((FcChar8 *) node->name, (FcChar8 *) "config"))
|
||||||
{
|
{
|
||||||
if (!FcConfigParseConfig (config, doc, node))
|
if (!FcConfigParseConfig (config, doc, node))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (!strcmp (node->name, "match"))
|
else if (!FcStrCmpIgnoreCase ((FcChar8 *) node->name, (FcChar8 *) "match"))
|
||||||
{
|
{
|
||||||
if (!FcConfigParseMatch (config, doc, node))
|
if (!FcConfigParseMatch (config, doc, node))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (!strcmp (node->name, "alias"))
|
else if (!FcStrCmpIgnoreCase ((FcChar8 *) node->name, (FcChar8 *) "alias"))
|
||||||
{
|
{
|
||||||
if (!FcConfigParseAlias (config, doc, node))
|
if (!FcConfigParseAlias (config, doc, node))
|
||||||
break;
|
break;
|
||||||
|
@ -1005,7 +1008,7 @@ FcConfigParse (FcConfig *config,
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcConfigParseAndLoad (FcConfig *config,
|
FcConfigParseAndLoad (FcConfig *config,
|
||||||
const char *file,
|
const FcChar8 *file,
|
||||||
FcBool complain)
|
FcBool complain)
|
||||||
{
|
{
|
||||||
xmlDocPtr doc;
|
xmlDocPtr doc;
|
||||||
|
|
Loading…
Reference in New Issue