Various config changes plus a couple of optimizations from Owen

This commit is contained in:
Keith Packard 2002-08-19 19:32:05 +00:00
parent 5d43e79919
commit fa244f3d88
24 changed files with 159 additions and 277 deletions

View File

@ -1,3 +1,22 @@
Mon Aug 19 11:57:27 PDT 2002
+ Fix autoconf files to pass FONTCONFIG_PATH on
compile line so that ${prefix} gets substituted
correctly.
+ Use getc_unlocked/putc_unlocked on systems that
provide them to avoid damage done to stdio by posix
+ Eliminate FC_PATTERN and FcTypePattern in favor of
an extended api for FcConfigSubstitute which takes
both the font and the pattern.
+ Add 'sans serif' alias for 'sans-serif' as some apps
can't handle hyphens in family names
+ Eliminate pretense of support for libxml2
+ Comment origins of Han orthographies
Tue Jul 30 18:37:09 PDT 2002 keithp Tue Jul 30 18:37:09 PDT 2002 keithp
+ Add binding property to edit element so that strong + Add binding property to edit element so that strong

View File

@ -97,12 +97,6 @@
/* Define to 1 if you have the `vprintf' function. */ /* Define to 1 if you have the `vprintf' function. */
#undef HAVE_VPRINTF #undef HAVE_VPRINTF
/* Use libxml2 library for xml parsing */
#undef HAVE_XML2
/* Define to 1 if you have the `xmlInitParser' function. */
#undef HAVE_XMLINITPARSER
/* Define to 1 if you have the `XML_ParserCreate' function. */ /* Define to 1 if you have the `XML_ParserCreate' function. */
#undef HAVE_XML_PARSERCREATE #undef HAVE_XML_PARSERCREATE
@ -142,6 +136,3 @@
/* Define to `int' if <sys/types.h> does not define. */ /* Define to `int' if <sys/types.h> does not define. */
#undef pid_t #undef pid_t
/* Define to the directory containing font configuration files */
#undef FONTCONFIG_PATH

View File

@ -1,5 +1,5 @@
# #
# $XFree86: xc/lib/fontconfig/config/Makedefs.in,v 1.2 2002/05/21 17:48:15 keithp Exp $ # $XFree86: xc/lib/fontconfig/config/Makedefs.in,v 1.3 2002/08/01 15:57:26 keithp Exp $
# #
# Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. # Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
# #
@ -32,19 +32,12 @@ bindir=@bindir@
datadir=@datadir@ datadir=@datadir@
includedir=@includedir@ includedir=@includedir@
sysconfdir=@sysconfdir@ sysconfdir=@sysconfdir@
confdir=@confdir@
CDEBUGFLAGS=@CFLAGS@
CPPFLAGS=@CPPFLAGS@
DEFS=@DEFS@
DSO_LDOPTS=@DSO_LDOPTS@ DSO_LDOPTS=@DSO_LDOPTS@
DSO_CFLAGS=@DSO_CFLAGS@ DSO_CFLAGS=@DSO_CFLAGS@
DSO_PIC_CFLAGS=@DSO_PIC_CFLAGS@ DSO_PIC_CFLAGS=@DSO_PIC_CFLAGS@
INCLUDES=-I$(TOPDIR) -I$(srcdir)
CFLAGS=$(CDEBUGFLAGS) $(INCLUDES) $(DEFS) $(CPPFLAGS)
INSTALL=@INSTALL@ INSTALL=@INSTALL@
INSTALL_PROGRAM=@INSTALL_PROGRAM@ INSTALL_PROGRAM=@INSTALL_PROGRAM@
INSTALL_SCRIPT=@INSTALL_SCRIPT@ INSTALL_SCRIPT=@INSTALL_SCRIPT@
@ -52,10 +45,6 @@ INSTALL_DATA=@INSTALL_DATA@
MKSHLIB=@MKSHLIB@ MKSHLIB=@MKSHLIB@
LN_S=@LN_S@ LN_S=@LN_S@
X_FONT_DIR=@X_FONT_DIR@
FC_DEFAULT_FONTS=@FC_DEFAULT_FONTS@
FONTCONFIG_PATH=@FONTCONFIG_PATH@
# shared libraries # shared libraries
LIBDIR=$(libdir) LIBDIR=$(libdir)
# programs # programs
@ -65,6 +54,16 @@ CONFDIR=@CONFDIR@
# include files # include files
INCLUDEDIR=$(includedir)/fontconfig INCLUDEDIR=$(includedir)/fontconfig
X_FONT_DIR=@X_FONT_DIR@
FC_DEFAULT_FONTS=@FC_DEFAULT_FONTS@
FCPATH_DEF=-DFONTCONFIG_PATH=\"$(CONFDIR)\"
CDEBUGFLAGS=@CFLAGS@
INCLUDES=-I$(TOPDIR) -I$(srcdir) @CPPFLAGS@
CFLAGS=$(CDEBUGFLAGS) @DEFS@ $(FCPATH_DEF) $(INCLUDES)
LIBBASE=libfontconfig.so LIBBASE=libfontconfig.so
LIBFILE=$(LIBBASE).@PACKAGE_MAJOR@.@PACKAGE_MINOR@ LIBFILE=$(LIBBASE).@PACKAGE_MAJOR@.@PACKAGE_MINOR@
LIBMAJOR=$(LIBBASE).@PACKAGE_MAJOR@ LIBMAJOR=$(LIBBASE).@PACKAGE_MAJOR@

View File

@ -1,5 +1,5 @@
dnl dnl
dnl $XFree86: xc/lib/fontconfig/configure.in,v 1.6 2002/06/07 17:55:41 keithp Exp $ dnl $XFree86: xc/lib/fontconfig/configure.in,v 1.7 2002/08/01 15:57:25 keithp Exp $
dnl dnl
dnl Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. dnl Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
dnl dnl
@ -23,6 +23,7 @@ dnl PERFORMANCE OF THIS SOFTWARE.
dnl dnl
# Process this file with autoconf to produce a configure script. # Process this file with autoconf to produce a configure script.
AC_INIT(fontconfig, 1.0.1, fonts@xfree86.org) AC_INIT(fontconfig, 1.0.1, fonts@xfree86.org)
AC_CONFIG_AUX_DIR(config) AC_CONFIG_AUX_DIR(config)
AC_CONFIG_HEADER(config.h) AC_CONFIG_HEADER(config.h)
@ -30,13 +31,11 @@ AC_CONFIG_HEADER(config.h)
AC_ARG_WITH(freetype_includes, [ --with-freetype-includes=DIR Use FreeType includes in DIR], freetype_includes=$withval, freetype_includes=yes) AC_ARG_WITH(freetype_includes, [ --with-freetype-includes=DIR Use FreeType includes in DIR], freetype_includes=$withval, freetype_includes=yes)
AC_ARG_WITH(freetype_lib, [ --with-freetype-lib=DIR Use FreeType library in DIR], freetype_lib=$withval, freetype_lib=yes) AC_ARG_WITH(freetype_lib, [ --with-freetype-lib=DIR Use FreeType library in DIR], freetype_lib=$withval, freetype_lib=yes)
AC_ARG_WITH(freetype_config, [ --with-freetype-config=PROG Use FreeType configuration program PROG], freetype_config=$withval, freetype_config=yes) AC_ARG_WITH(freetype_config, [ --with-freetype-config=PROG Use FreeType configuration program PROG], freetype_config=$withval, freetype_config=yes)
AC_ARG_WITH(expat, [ --with-expat=DIR Use Expat in DIR instead of xml2], expat=$withval, expat=maybe) AC_ARG_WITH(expat, [ --with-expat=DIR Use Expat in DIR], expat=$withval, expat=yes)
AC_ARG_WITH(expat_includes, [ --with-expat-includes=DIR Use Expat includes in DIR], expat_includes=$withval, expat_includes=yes) AC_ARG_WITH(expat_includes, [ --with-expat-includes=DIR Use Expat includes in DIR], expat_includes=$withval, expat_includes=yes)
AC_ARG_WITH(expat_lib, [ --with-expat-lib=DIR Use Expat library in DIR], expat_lib=$withval, expat_lib=yes) AC_ARG_WITH(expat_lib, [ --with-expat-lib=DIR Use Expat library in DIR], expat_lib=$withval, expat_lib=yes)
AC_ARG_WITH(xml2, [ --with-xml2=DIR Use Libxml2 in DIR instead of expat], xml2=$withval, xml2=maybe)
AC_ARG_WITH(xml2_includes, [ --with-xml2-includes=DIR Use Libxml2 includes in DIR], xml2_includes=$withval, xml2_includes=yes)
AC_ARG_WITH(xml2_lib, [ --with-xml2-lib=DIR Use Libxml2 library in DIR], xml2_lib=$withval, xml2_lib=yes)
AC_ARG_WITH(default_fonts, [ --with-default-fonts=DIR Use fonts from DIR when config is busted], defaultfonts="$withval", default_fonts=yes) AC_ARG_WITH(default_fonts, [ --with-default-fonts=DIR Use fonts from DIR when config is busted], defaultfonts="$withval", default_fonts=yes)
AC_ARG_WITH(confdir, [ --with-confdir=DIR Use DIR to store configuration files (default /etc/fonts)], confdir="$withval", confdir=yes)
# Checks for programs. # Checks for programs.
AC_PROG_CC AC_PROG_CC
@ -210,40 +209,22 @@ AC_SUBST(FC_DEFAULT_FONTS)
# Set CONFDIR and FONTCONFIG_PATH # Set CONFDIR and FONTCONFIG_PATH
# #
CONFDIR="$sysconfdir/fonts" case "$confdir" in
no|yes)
confdir=/etc/fonts
;;
*)
;;
esac
AC_SUBST(confdir)
CONFDIR='${confdir}'
AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR") AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR")
AC_SUBST(CONFDIR) AC_SUBST(CONFDIR)
FONTCONFIG_PATH="$CONFDIR"
AC_DEFINE_UNQUOTED(FONTCONFIG_PATH, "$CONFDIR")
AC_SUBST(FONTCONFIG_PATH)
# #
# Check expat/libxml2 configuration # Check expat configuration
# #
case "$expat" in
maybe)
;;
no)
xml2=yes
;;
*)
xml2=no
;;
esac
case "$xml2" in
maybe)
;;
no)
expat=yes
;;
*)
expat=no
;;
esac
case "$expat" in case "$expat" in
no) no)
;; ;;
@ -259,7 +240,7 @@ no)
case "$expat_lib" in case "$expat_lib" in
yes) yes)
case "$expat" in case "$expat" in
yes|maybe) yes)
expat_library="-lexpat" expat_library="-lexpat"
;; ;;
*) *)
@ -317,7 +298,6 @@ no)
HAVE_EXPAT=1 HAVE_EXPAT=1
AC_SUBST(HAVE_EXPAT) AC_SUBST(HAVE_EXPAT)
AC_DEFINE_UNQUOTED(HAVE_EXPAT,$HAVE_EXPAT) AC_DEFINE_UNQUOTED(HAVE_EXPAT,$HAVE_EXPAT)
xml2=no
;; ;;
esac esac
;; ;;
@ -325,71 +305,10 @@ no)
;; ;;
esac esac
case "$xml2" in
no)
;;
*)
case "$xml2_includes" in
yes|no)
xml2_include_path=""
;;
*)
xml2_include_path="-I$xml2_includes"
;;
esac
case "$xml2_lib" in
yes)
case "$xml2" in
yes|maybe)
xml2_library="-lxml2"
;;
*)
xml2_library="-L$xml2/lib -lxml2"
;;
esac
;;
no)
;;
*)
xml2_library="-L$xml2_lib -lxml2"
;;
esac
saved_CPPFLAGS="$CPPFLAGS" case "$expat" in
CPPFLAGS="$CPPFLAGS $xml2_include_path"
saved_LIBS="$LIBS"
LIBS="$LIBS $xml2_library"
AC_CHECK_HEADER(libxml/parser.h)
case "$ac_cv_header_libxml_parser_h" in
no) no)
CPPFLAGS="$saved_CPPFLAGS" AC_MSG_ERROR([cannot find expat library])
LIBS="$saved_LIBS"
xml2=no
;;
yes)
AC_CHECK_FUNCS(xmlInitParser)
case "$ac_cv_func_xmlInitParser" in
no)
CPPFLAGS="$saved_CPPFLAGS"
LIBS="$saved_LIBS"
xml2=no
;;
yes)
HAVE_XML2=1
AC_SUBST(HAVE_XML2)
AC_DEFINE_UNQUOTED(HAVE_XML2,$HAVE_XML2)
expat=no
;;
esac
;;
esac
;;
esac
case "$expat""$xml2" in
nono)
AC_MSG_ERROR([cannot find either libxml2 or expat])
;; ;;
esac esac

View File

@ -5,7 +5,7 @@ XCOMM $XFree86$
#include "../local.def" #include "../local.def"
#endif #endif
INCLUDES=$(FREETYPE2INCLUDES) $(LIBXML2INCLUDES) -I.. INCLUDES=$(FREETYPE2INCLUDES) -I..
LOCAL_LIBRARIES=FontconfigClientLibs LOCAL_LIBRARIES=FontconfigClientLibs
DEPLIBS=FontconfigClientDepLibs DEPLIBS=FontconfigClientDepLibs

View File

@ -1,11 +1,11 @@
XCOMM $XFree86: xc/lib/fontconfig/fc-lang/Imakefile,v 1.12 2002/08/06 18:59:59 keithp Exp $ XCOMM $XFree86: xc/lib/fontconfig/fc-lang/Imakefile,v 1.14 2002/08/08 00:10:49 keithp Exp $
#ifdef UseInstalled #ifdef UseInstalled
/* building outside the tree, use private defines */ /* building outside the tree, use private defines */
#include "../local.def" #include "../local.def"
#endif #endif
INCLUDES=$(FREETYPE2INCLUDES) $(LIBXML2INCLUDES) -I.. -I../src INCLUDES=$(FREETYPE2INCLUDES) -I.. -I../src
LOCAL_LIBRARIES=FontconfigClientLibs LOCAL_LIBRARIES=FontconfigClientLibs
DEPLIBS=FontconfigClientDepLibs DEPLIBS=FontconfigClientDepLibs

View File

@ -1,5 +1,5 @@
# #
# $XFree86: xc/lib/fontconfig/fc-lang/ja.orth,v 1.2 2002/07/06 23:59:15 keithp Exp $ # $XFree86: xc/lib/fontconfig/fc-lang/ja.orth,v 1.3 2002/07/13 20:33:05 keithp Exp $
# #
# Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. # Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
# #
@ -21,6 +21,8 @@
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE. # PERFORMANCE OF THIS SOFTWARE.
# #
# Coverage from JIS X 0208 (1990)
#
0x3000 # IDEOGRAPHIC SPACE 0x3000 # IDEOGRAPHIC SPACE
0x3001 # IDEOGRAPHIC COMMA 0x3001 # IDEOGRAPHIC COMMA
0x3002 # IDEOGRAPHIC FULL STOP 0x3002 # IDEOGRAPHIC FULL STOP

View File

@ -1,5 +1,5 @@
# #
# $XFree86: xc/lib/fontconfig/fc-lang/ko.orth,v 1.2 2002/07/06 23:59:16 keithp Exp $ # $XFree86: xc/lib/fontconfig/fc-lang/ko.orth,v 1.3 2002/07/12 21:05:59 keithp Exp $
# #
# Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. # Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
# #
@ -22,6 +22,9 @@
# PERFORMANCE OF THIS SOFTWARE. # PERFORMANCE OF THIS SOFTWARE.
# #
# Korean (KO) # Korean (KO)
#
# Coverage from KSC 5601-1992
#
#0x3000 # IDEOGRAPHIC SPACE #0x3000 # IDEOGRAPHIC SPACE
#0x3001 # IDEOGRAPHIC COMMA #0x3001 # IDEOGRAPHIC COMMA
#0x3002 # IDEOGRAPHIC FULL STOP #0x3002 # IDEOGRAPHIC FULL STOP

View File

@ -1,5 +1,5 @@
# #
# $XFree86$ # $XFree86: xc/lib/fontconfig/fc-lang/zh_cn.orth,v 1.2 2002/07/06 23:59:19 keithp Exp $
# #
# Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. # Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
# #
@ -22,6 +22,9 @@
# PERFORMANCE OF THIS SOFTWARE. # PERFORMANCE OF THIS SOFTWARE.
# #
# Chinese (simplified) (ZH-CN) # Chinese (simplified) (ZH-CN)
#
# Coverage computed from GB2312
#
0x02C7 # CARON (Mandarin Chinese third tone) 0x02C7 # CARON (Mandarin Chinese third tone)
0x02C9 # MODIFIER LETTER MACRON (Mandarin Chinese first tone) 0x02C9 # MODIFIER LETTER MACRON (Mandarin Chinese first tone)
0x4E00 # <CJK> 0x4E00 # <CJK>

View File

@ -1,5 +1,5 @@
# #
# $XFree86$ # $XFree86: xc/lib/fontconfig/fc-lang/zh_sg.orth,v 1.1 2002/07/08 07:31:51 keithp Exp $
# #
# Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. # Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
# #
@ -23,5 +23,5 @@
# #
# Chinese in Singapore (ZH-SG) # Chinese in Singapore (ZH-SG)
# #
# Just use GB2312 as for ZH-CH # Just use GB2312 as for ZH-CN
include zh_cn.orth include zh_cn.orth

View File

@ -5,7 +5,7 @@ XCOMM $XFree86$
#include "../local.def" #include "../local.def"
#endif #endif
INCLUDES=$(FREETYPE2INCLUDES) $(LIBXML2INCLUDES) -I.. INCLUDES=$(FREETYPE2INCLUDES) -I..
LOCAL_LIBRARIES=FontconfigClientLibs LOCAL_LIBRARIES=FontconfigClientLibs
DEPLIBS=FontconfigClientDepLibs DEPLIBS=FontconfigClientDepLibs

View File

@ -1,5 +1,5 @@
/* /*
* $XFree86: xc/lib/fontconfig/fontconfig/fcprivate.h,v 1.3 2002/05/31 23:21:24 keithp Exp $ * $XFree86: xc/lib/fontconfig/fontconfig/fcprivate.h,v 1.4 2002/08/11 18:10:41 keithp Exp $
* *
* Copyright Š 2001 Keith Packard, member of The XFree86 Project, Inc. * Copyright Š 2001 Keith Packard, member of The XFree86 Project, Inc.
* *
@ -73,8 +73,6 @@
case FcTypeFTFace: \ case FcTypeFTFace: \
__v__.u.f = va_arg (va, FT_Face); \ __v__.u.f = va_arg (va, FT_Face); \
break; \ break; \
case FcTypePattern: \
__v__.u.p = va_arg (va, FcPattern *); \
} \ } \
if (!FcPatternAdd (__p__, __o__, __v__, FcTrue)) \ if (!FcPatternAdd (__p__, __o__, __v__, FcTrue)) \
goto _FcPatternVapBuild_bail1; \ goto _FcPatternVapBuild_bail1; \

View File

@ -1,5 +1,5 @@
/* /*
* $XFree86: xc/lib/fontconfig/fontconfig/fontconfig.h,v 1.23 2002/07/28 10:50:58 keithp Exp $ * $XFree86: xc/lib/fontconfig/fontconfig/fontconfig.h,v 1.25 2002/08/11 18:10:41 keithp Exp $
* *
* Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
* *
@ -71,7 +71,6 @@ typedef int FcBool;
#define FC_SOURCE "source" /* String (X11, freetype) */ #define FC_SOURCE "source" /* String (X11, freetype) */
#define FC_CHARSET "charset" /* CharSet */ #define FC_CHARSET "charset" /* CharSet */
#define FC_LANG "lang" /* String OS/2 CodePageRange */ #define FC_LANG "lang" /* String OS/2 CodePageRange */
#define FC_PATTERN "pattern" /* FcPattern */
#define FC_DIR_CACHE_FILE "fonts.cache" #define FC_DIR_CACHE_FILE "fonts.cache"
#define FC_USER_CACHE_FILE ".fonts.cache" #define FC_USER_CACHE_FILE ".fonts.cache"
@ -110,8 +109,7 @@ typedef enum _FcType {
FcTypeBool, FcTypeBool,
FcTypeMatrix, FcTypeMatrix,
FcTypeCharSet, FcTypeCharSet,
FcTypeFTFace, FcTypeFTFace
FcTypePattern
} FcType; } FcType;
typedef struct _FcMatrix { typedef struct _FcMatrix {
@ -278,6 +276,12 @@ FcConfigAppFontAddDir (FcConfig *config,
void void
FcConfigAppFontClear (FcConfig *config); FcConfigAppFontClear (FcConfig *config);
FcBool
FcConfigSubstituteWithPat (FcConfig *config,
FcPattern *p,
FcPattern *p_pat,
FcMatchKind kind);
FcBool FcBool
FcConfigSubstitute (FcConfig *config, FcConfigSubstitute (FcConfig *config,
FcPattern *p, FcPattern *p,
@ -605,9 +609,6 @@ FcPatternAddCharSet (FcPattern *p, const char *object, const FcCharSet *c);
FcBool FcBool
FcPatternAddBool (FcPattern *p, const char *object, FcBool b); FcPatternAddBool (FcPattern *p, const char *object, FcBool b);
FcBool
FcPatternAddPattern (FcPattern *p, const char *object, const FcPattern *pp);
FcResult FcResult
FcPatternGetInteger (FcPattern *p, const char *object, int n, int *i); FcPatternGetInteger (FcPattern *p, const char *object, int n, int *i);
@ -626,9 +627,6 @@ FcPatternGetCharSet (FcPattern *p, const char *object, int n, FcCharSet **c);
FcResult FcResult
FcPatternGetBool (FcPattern *p, const char *object, int n, FcBool *b); FcPatternGetBool (FcPattern *p, const char *object, int n, FcBool *b);
FcResult
FcPatternGetPattern (FcPattern *p, const char *object, int n, FcPattern **pp);
FcPattern * FcPattern *
FcPatternVaBuild (FcPattern *orig, va_list va); FcPatternVaBuild (FcPattern *orig, va_list va);

View File

@ -45,6 +45,18 @@
</edit> </edit>
</match> </match>
<!--
Accept alternate 'sans serif' spelling, replacing it with 'sans-serif'
-->
<match target="pattern">
<test qual="any" name="family">
<string>sans serif</string>
</test>
<edit name="family" mode="assign">
<string>sans-serif</string>
</edit>
</match>
<!-- <!--
Accept deprecated 'sans' alias, replacing it with 'sans-serif' Accept deprecated 'sans' alias, replacing it with 'sans-serif'
--> -->

View File

@ -21,7 +21,7 @@ SOFONTCONFIGREV=1.0
#include <Threads.tmpl> #include <Threads.tmpl>
INCLUDES=$(FREETYPE2INCLUDES) $(LIBXML2INCLUDES) -I.. INCLUDES=$(FREETYPE2INCLUDES) -I..
DEFINES=-DFC_DEFAULT_FONTS='"$(FC_DEFAULT_FONTS)"' -DHAVE_EXPAT DEFINES=-DFC_DEFAULT_FONTS='"$(FC_DEFAULT_FONTS)"' -DHAVE_EXPAT

View File

@ -1,5 +1,5 @@
/* /*
* $XFree86: xc/lib/fontconfig/src/fccache.c,v 1.7 2002/05/21 17:06:22 keithp Exp $ * $XFree86: xc/lib/fontconfig/src/fccache.c,v 1.10 2002/08/06 19:00:43 keithp Exp $
* *
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
* *
@ -24,6 +24,21 @@
#include "fcint.h" #include "fcint.h"
/*
* POSIX has broken stdio so that getc must do thread-safe locking,
* this is a serious performance problem for applications doing large
* amounts of IO with getc (as is done here). If available, use
* the getc_unlocked varient instead.
*/
#if defined(getc_unlocked) || defined(_IO_getc_unlocked)
#define GETC(f) getc_unlocked(f)
#define PUTC(c,f) putc_unlocked(c,f)
#else
#define GETC(f) getc(f)
#define PUTC(c,f) putc(c,f)
#endif
#define FC_DBG_CACHE_REF 1024 #define FC_DBG_CACHE_REF 1024
static FcChar8 * static FcChar8 *
@ -35,7 +50,7 @@ FcCacheReadString (FILE *f, FcChar8 *dest, int len)
int size; int size;
int i; int i;
while ((c = getc (f)) != EOF) while ((c = GETC (f)) != EOF)
if (c == '"') if (c == '"')
break; break;
if (c == EOF) if (c == EOF)
@ -47,7 +62,7 @@ FcCacheReadString (FILE *f, FcChar8 *dest, int len)
i = 0; i = 0;
d = dest; d = dest;
escape = FcFalse; escape = FcFalse;
while ((c = getc (f)) != EOF) while ((c = GETC (f)) != EOF)
{ {
if (!escape) if (!escape)
{ {
@ -87,7 +102,7 @@ FcCacheReadUlong (FILE *f, unsigned long *dest)
unsigned long t; unsigned long t;
int c; int c;
while ((c = getc (f)) != EOF) while ((c = GETC (f)) != EOF)
{ {
if (!isspace (c)) if (!isspace (c))
break; break;
@ -102,7 +117,7 @@ FcCacheReadUlong (FILE *f, unsigned long *dest)
if (!isdigit (c)) if (!isdigit (c))
return FcFalse; return FcFalse;
t = t * 10 + (c - '0'); t = t * 10 + (c - '0');
c = getc (f); c = GETC (f);
} }
*dest = t; *dest = t;
return FcTrue; return FcTrue;
@ -141,11 +156,11 @@ FcCacheWriteChars (FILE *f, const FcChar8 *chars)
switch (c) { switch (c) {
case '"': case '"':
case '\\': case '\\':
if (putc ('\\', f) == EOF) if (PUTC ('\\', f) == EOF)
return FcFalse; return FcFalse;
/* fall through */ /* fall through */
default: default:
if (putc (c, f) == EOF) if (PUTC (c, f) == EOF)
return FcFalse; return FcFalse;
} }
} }
@ -156,11 +171,11 @@ static FcBool
FcCacheWriteString (FILE *f, const FcChar8 *string) FcCacheWriteString (FILE *f, const FcChar8 *string)
{ {
if (putc ('"', f) == EOF) if (PUTC ('"', f) == EOF)
return FcFalse; return FcFalse;
if (!FcCacheWriteChars (f, string)) if (!FcCacheWriteChars (f, string))
return FcFalse; return FcFalse;
if (putc ('"', f) == EOF) if (PUTC ('"', f) == EOF)
return FcFalse; return FcFalse;
return FcTrue; return FcTrue;
} }
@ -168,17 +183,17 @@ FcCacheWriteString (FILE *f, const FcChar8 *string)
static FcBool static FcBool
FcCacheWritePath (FILE *f, const FcChar8 *dir, const FcChar8 *file) FcCacheWritePath (FILE *f, const FcChar8 *dir, const FcChar8 *file)
{ {
if (putc ('"', f) == EOF) if (PUTC ('"', f) == EOF)
return FcFalse; return FcFalse;
if (dir) if (dir)
if (!FcCacheWriteChars (f, dir)) if (!FcCacheWriteChars (f, dir))
return FcFalse; return FcFalse;
if (dir && dir[strlen((const char *) dir) - 1] != '/') if (dir && dir[strlen((const char *) dir) - 1] != '/')
if (putc ('/', f) == EOF) if (PUTC ('/', f) == EOF)
return FcFalse; return FcFalse;
if (!FcCacheWriteChars (f, file)) if (!FcCacheWriteChars (f, file))
return FcFalse; return FcFalse;
if (putc ('"', f) == EOF) if (PUTC ('"', f) == EOF)
return FcFalse; return FcFalse;
return FcTrue; return FcTrue;
} }
@ -200,7 +215,7 @@ FcCacheWriteUlong (FILE *f, unsigned long t)
while (pow) while (pow)
{ {
digit = temp / pow; digit = temp / pow;
if (putc ((char) digit + '0', f) == EOF) if (PUTC ((char) digit + '0', f) == EOF)
return FcFalse; return FcFalse;
temp = temp - pow * digit; temp = temp - pow * digit;
pow = pow / 10; pow = pow / 10;
@ -767,19 +782,19 @@ FcGlobalCacheSave (FcGlobalCache *cache,
continue; continue;
if (!FcCacheWriteString (f, dir->info.file)) if (!FcCacheWriteString (f, dir->info.file))
goto bail4; goto bail4;
if (putc (' ', f) == EOF) if (PUTC (' ', f) == EOF)
goto bail4; goto bail4;
if (!FcCacheWriteInt (f, 0)) if (!FcCacheWriteInt (f, 0))
goto bail4; goto bail4;
if (putc (' ', f) == EOF) if (PUTC (' ', f) == EOF)
goto bail4; goto bail4;
if (!FcCacheWriteTime (f, dir->info.time)) if (!FcCacheWriteTime (f, dir->info.time))
goto bail4; goto bail4;
if (putc (' ', f) == EOF) if (PUTC (' ', f) == EOF)
goto bail4; goto bail4;
if (!FcCacheWriteString (f, (FcChar8 *) FC_FONT_FILE_DIR)) if (!FcCacheWriteString (f, (FcChar8 *) FC_FONT_FILE_DIR))
goto bail4; goto bail4;
if (putc ('\n', f) == EOF) if (PUTC ('\n', f) == EOF)
goto bail4; goto bail4;
for (file_hash = 0; file_hash < FC_GLOBAL_CACHE_FILE_HASH_SIZE; file_hash++) for (file_hash = 0; file_hash < FC_GLOBAL_CACHE_FILE_HASH_SIZE; file_hash++)
@ -790,19 +805,19 @@ FcGlobalCacheSave (FcGlobalCache *cache,
continue; continue;
if (!FcCacheWritePath (f, dir->info.file, file->info.file)) if (!FcCacheWritePath (f, dir->info.file, file->info.file))
goto bail4; goto bail4;
if (putc (' ', f) == EOF) if (PUTC (' ', f) == EOF)
goto bail4; goto bail4;
if (!FcCacheWriteInt (f, file->id < 0 ? 0 : file->id)) if (!FcCacheWriteInt (f, file->id < 0 ? 0 : file->id))
goto bail4; goto bail4;
if (putc (' ', f) == EOF) if (PUTC (' ', f) == EOF)
goto bail4; goto bail4;
if (!FcCacheWriteTime (f, file->info.time)) if (!FcCacheWriteTime (f, file->info.time))
goto bail4; goto bail4;
if (putc (' ', f) == EOF) if (PUTC (' ', f) == EOF)
goto bail4; goto bail4;
if (!FcCacheWriteString (f, file->name)) if (!FcCacheWriteString (f, file->name))
goto bail4; goto bail4;
if (putc ('\n', f) == EOF) if (PUTC ('\n', f) == EOF)
goto bail4; goto bail4;
} }
} }
@ -981,15 +996,15 @@ FcDirCacheWriteDir (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir)
base = FcFileBaseName (cache_file, dir); base = FcFileBaseName (cache_file, dir);
if (!FcCacheWriteString (f, base)) if (!FcCacheWriteString (f, base))
goto bail3; goto bail3;
if (putc (' ', f) == EOF) if (PUTC (' ', f) == EOF)
goto bail3; goto bail3;
if (!FcCacheWriteInt (f, 0)) if (!FcCacheWriteInt (f, 0))
goto bail3; goto bail3;
if (putc (' ', f) == EOF) if (PUTC (' ', f) == EOF)
goto bail3; goto bail3;
if (!FcCacheWriteString (f, FC_FONT_FILE_DIR)) if (!FcCacheWriteString (f, FC_FONT_FILE_DIR))
goto bail3; goto bail3;
if (putc ('\n', f) == EOF) if (PUTC ('\n', f) == EOF)
goto bail3; goto bail3;
} }
@ -1005,11 +1020,11 @@ FcDirCacheWriteDir (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir)
printf (" write file \"%s\"\n", base); printf (" write file \"%s\"\n", base);
if (!FcCacheWriteString (f, base)) if (!FcCacheWriteString (f, base))
goto bail3; goto bail3;
if (putc (' ', f) == EOF) if (PUTC (' ', f) == EOF)
goto bail3; goto bail3;
if (!FcCacheWriteInt (f, id)) if (!FcCacheWriteInt (f, id))
goto bail3; goto bail3;
if (putc (' ', f) == EOF) if (PUTC (' ', f) == EOF)
goto bail3; goto bail3;
name = FcNameUnparse (font); name = FcNameUnparse (font);
if (!name) if (!name)
@ -1018,7 +1033,7 @@ FcDirCacheWriteDir (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir)
free (name); free (name);
if (!ret) if (!ret)
goto bail3; goto bail3;
if (putc ('\n', f) == EOF) if (PUTC ('\n', f) == EOF)
goto bail3; goto bail3;
} }

View File

@ -1,5 +1,5 @@
/* /*
* $XFree86: xc/lib/fontconfig/src/fccfg.c,v 1.18 2002/07/31 01:36:37 keithp Exp $ * $XFree86: xc/lib/fontconfig/src/fccfg.c,v 1.19 2002/08/11 18:10:42 keithp Exp $
* *
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
* *
@ -592,18 +592,6 @@ FcConfigCompareValue (FcValue m,
break; break;
} }
break; break;
case FcTypePattern:
switch (op) {
case FcOpEqual:
ret = FcPatternEqual (m.u.p, v.u.p);
break;
case FcOpNotEqual:
ret = !FcPatternEqual (m.u.p, v.u.p);
break;
default:
break;
}
break;
} }
} }
else else
@ -1009,8 +997,9 @@ FcConfigPatternCanon (FcPattern *p,
} }
FcBool FcBool
FcConfigSubstitute (FcConfig *config, FcConfigSubstituteWithPat (FcConfig *config,
FcPattern *p, FcPattern *p,
FcPattern *p_pat,
FcMatchKind kind) FcMatchKind kind)
{ {
FcSubst *s; FcSubst *s;
@ -1019,7 +1008,6 @@ FcConfigSubstitute (FcConfig *config,
FcTest *t; FcTest *t;
FcEdit *e; FcEdit *e;
FcValueList *l; FcValueList *l;
FcPattern *p_pat = 0;
FcPattern *m; FcPattern *m;
if (!config) if (!config)
@ -1042,10 +1030,7 @@ FcConfigSubstitute (FcConfig *config,
if (kind == FcMatchPattern) if (kind == FcMatchPattern)
s = config->substPattern; s = config->substPattern;
else else
{
s = config->substFont; s = config->substFont;
(void) FcPatternGetPattern (p, FC_PATTERN, 0, &p_pat);
}
for (; s; s = s->next) for (; s; s = s->next)
{ {
/* /*
@ -1222,6 +1207,14 @@ FcConfigSubstitute (FcConfig *config,
return FcTrue; return FcTrue;
} }
FcBool
FcConfigSubstitute (FcConfig *config,
FcPattern *p,
FcMatchKind kind)
{
return FcConfigSubstituteWithPat (config, p, 0, kind);
}
#ifndef FONTCONFIG_PATH #ifndef FONTCONFIG_PATH
#define FONTCONFIG_PATH "/etc/fonts" #define FONTCONFIG_PATH "/etc/fonts"
#endif #endif

View File

@ -1,5 +1,5 @@
/* /*
* $XFree86: xc/lib/fontconfig/src/fcdbg.c,v 1.4 2002/06/19 20:08:22 keithp Exp $ * $XFree86: xc/lib/fontconfig/src/fcdbg.c,v 1.7 2002/08/11 18:10:42 keithp Exp $
* *
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
* *
@ -54,11 +54,6 @@ FcValuePrint (const FcValue v)
case FcTypeFTFace: case FcTypeFTFace:
printf (" face"); printf (" face");
break; break;
case FcTypePattern:
printf (" pattern {");
FcPatternPrint (v.u.p);
printf (" } ");
break;
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* $XFree86: xc/lib/fontconfig/src/fclist.c,v 1.7 2002/06/19 20:08:22 keithp Exp $ * $XFree86: xc/lib/fontconfig/src/fclist.c,v 1.8 2002/08/11 18:10:42 keithp Exp $
* *
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
* *
@ -247,8 +247,6 @@ FcListValueHash (FcValue v)
return FcCharSetCount (v.u.c); return FcCharSetCount (v.u.c);
case FcTypeFTFace: case FcTypeFTFace:
return (FcChar32) v.u.f; return (FcChar32) v.u.f;
case FcTypePattern:
return (FcChar32) v.u.p->num;
} }
return 0; return 0;
} }

View File

@ -1,5 +1,5 @@
/* /*
* $XFree86: xc/lib/fontconfig/src/fcmatch.c,v 1.16 2002/07/06 23:47:44 keithp Exp $ * $XFree86: xc/lib/fontconfig/src/fcmatch.c,v 1.17 2002/08/11 18:10:42 keithp Exp $
* *
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
* *
@ -402,8 +402,7 @@ FcFontRenderPrepare (FcConfig *config,
if (!fe) if (!fe)
FcPatternAdd (new, pe->object, pe->values->value, FcTrue); FcPatternAdd (new, pe->object, pe->values->value, FcTrue);
} }
FcPatternAddPattern (new, FC_PATTERN, pat); FcConfigSubstituteWithPat (config, new, pat, FcMatchFont);
FcConfigSubstitute (config, new, FcMatchFont);
return new; return new;
} }

View File

@ -1,5 +1,5 @@
/* /*
* $XFree86: xc/lib/fontconfig/src/fcname.c,v 1.10 2002/06/29 20:31:02 keithp Exp $ * $XFree86: xc/lib/fontconfig/src/fcname.c,v 1.11 2002/08/11 18:10:42 keithp Exp $
* *
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
* *
@ -472,8 +472,6 @@ FcNameUnparseValue (FcStrBuf *buf,
return FcNameUnparseCharSet (buf, v.u.c); return FcNameUnparseCharSet (buf, v.u.c);
case FcTypeFTFace: case FcTypeFTFace:
return FcTrue; return FcTrue;
case FcTypePattern:
return FcTrue;
} }
return FcFalse; return FcFalse;
} }

View File

@ -1,5 +1,5 @@
/* /*
* $XFree86: xc/lib/fontconfig/src/fcpat.c,v 1.12 2002/08/07 01:45:59 keithp Exp $ * $XFree86: xc/lib/fontconfig/src/fcpat.c,v 1.13 2002/08/11 18:10:42 keithp Exp $
* *
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
* *
@ -55,9 +55,6 @@ FcValueDestroy (FcValue v)
case FcTypeCharSet: case FcTypeCharSet:
FcCharSetDestroy ((FcCharSet *) v.u.c); FcCharSetDestroy ((FcCharSet *) v.u.c);
break; break;
case FcTypePattern:
FcPatternDestroy ((FcPattern *) v.u.p);
break;
default: default:
break; break;
} }
@ -82,9 +79,6 @@ FcValueSave (FcValue v)
if (!v.u.c) if (!v.u.c)
v.type = FcTypeVoid; v.type = FcTypeVoid;
break; break;
case FcTypePattern:
FcPatternReference ((FcPattern *) v.u.p);
break;
default: default:
break; break;
} }
@ -107,9 +101,6 @@ FcValueListDestroy (FcValueList *l)
case FcTypeCharSet: case FcTypeCharSet:
FcCharSetDestroy ((FcCharSet *) l->value.u.c); FcCharSetDestroy ((FcCharSet *) l->value.u.c);
break; break;
case FcTypePattern:
FcPatternDestroy ((FcPattern *) l->value.u.p);
break;
default: default:
break; break;
} }
@ -154,8 +145,6 @@ FcValueEqual (FcValue va, FcValue vb)
return FcCharSetEqual (va.u.c, vb.u.c); return FcCharSetEqual (va.u.c, vb.u.c);
case FcTypeFTFace: case FcTypeFTFace:
return va.u.f == vb.u.f; return va.u.f == vb.u.f;
case FcTypePattern:
return FcPatternEqual (va.u.p, vb.u.p);
} }
return FcFalse; return FcFalse;
} }
@ -206,8 +195,6 @@ FcValueHash (FcValue v)
case FcTypeFTFace: case FcTypeFTFace:
return FcStringHash ((const FcChar8 *) ((FT_Face) v.u.f)->family_name) ^ return FcStringHash ((const FcChar8 *) ((FT_Face) v.u.f)->family_name) ^
FcStringHash ((const FcChar8 *) ((FT_Face) v.u.f)->style_name); FcStringHash ((const FcChar8 *) ((FT_Face) v.u.f)->style_name);
case FcTypePattern:
return (FcChar32) v.u.p->num;
} }
return FcFalse; return FcFalse;
} }
@ -459,9 +446,6 @@ bail2:
case FcTypeCharSet: case FcTypeCharSet:
FcCharSetDestroy ((FcCharSet *) value.u.c); FcCharSetDestroy ((FcCharSet *) value.u.c);
break; break;
case FcTypePattern:
FcPatternDestroy ((FcPattern *) value.u.p);
break;
default: default:
break; break;
} }
@ -579,16 +563,6 @@ FcPatternAddFTFace (FcPattern *p, const char *object, const FT_Face f)
return FcPatternAdd (p, object, v, FcTrue); return FcPatternAdd (p, object, v, FcTrue);
} }
FcBool
FcPatternAddPattern (FcPattern *p, const char *object, const FcPattern *pp)
{
FcValue v;
v.type = FcTypePattern;
v.u.p = pp;
return FcPatternAdd (p, object, v, FcTrue);
}
FcResult FcResult
FcPatternGet (FcPattern *p, const char *object, int id, FcValue *v) FcPatternGet (FcPattern *p, const char *object, int id, FcValue *v)
{ {
@ -730,21 +704,6 @@ FcPatternGetFTFace (FcPattern *p, const char *object, int id, FT_Face *f)
return FcResultMatch; return FcResultMatch;
} }
FcResult
FcPatternGetPattern (FcPattern *p, const char *object, int id, FcPattern **pp)
{
FcValue v;
FcResult r;
r = FcPatternGet (p, object, id, &v);
if (r != FcResultMatch)
return r;
if (v.type != FcTypePattern)
return FcResultTypeMismatch;
*pp = (FcPattern *) v.u.p;
return FcResultMatch;
}
FcPattern * FcPattern *
FcPatternDuplicate (FcPattern *orig) FcPatternDuplicate (FcPattern *orig)
{ {

View File

@ -1,5 +1,5 @@
/* /*
* $XFree86: xc/lib/fontconfig/src/fcxml.c,v 1.17 2002/07/31 01:36:37 keithp Exp $ * $XFree86: xc/lib/fontconfig/src/fcxml.c,v 1.18 2002/08/11 18:10:42 keithp Exp $
* *
* Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
* *
@ -25,28 +25,15 @@
#include <stdarg.h> #include <stdarg.h>
#include "fcint.h" #include "fcint.h"
#ifndef HAVE_EXPAT
#define HAVE_EXPAT 1
#endif
#ifndef HAVE_XML2
#define HAVE_XML2 0
#endif
#if HAVE_EXPAT
#ifndef HAVE_XMLPARSE_H #ifndef HAVE_XMLPARSE_H
#define HAVE_XMLPARSE_H 0 #define HAVE_XMLPARSE_H 0
#endif #endif
#if HAVE_XMLPARSE_H #if HAVE_XMLPARSE_H
#include <xmlparse.h> #include <xmlparse.h>
#else #else
#include <expat.h> #include <expat.h>
#endif #endif
#endif
#if HAVE_XML2
#include "fclibxml2.h"
#endif
FcTest * FcTest *
FcTestCreate (FcMatchKind kind, FcTestCreate (FcMatchKind kind,

View File

@ -1,5 +1,5 @@
.\" .\"
.\" $XFree86: xc/lib/fontconfig/src/fontconfig.man,v 1.2 2002/08/06 19:54:10 keithp Exp $ .\" $XFree86: xc/lib/fontconfig/src/fontconfig.man,v 1.3 2002/08/11 18:10:43 keithp Exp $
.\" .\"
.\" Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. .\" Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
.\" .\"
@ -865,10 +865,15 @@ void FcConfigAppFontClear (FcConfig *config)
Clears the set of application-specific fonts. Clears the set of application-specific fonts.
.TP .TP
FcBool FcConfigSubstitute (FcConfig *config, FcPattern *p, FcMatchKind kind) FcBool FcConfigSubstituteWithPat (FcConfig *config, FcPattern *p, FcPattern *p_pat FcMatchKind kind)
Performs the sequence of pattern modification operations, if 'kind' is Performs the sequence of pattern modification operations, if 'kind' is
FcMatchPattern, then those tagged as pattern operations are applied, else FcMatchPattern, then those tagged as pattern operations are applied, else
if 'kind' is FcMatchFont, those tagged as font operations are applied. if 'kind' is FcMatchFont, those tagged as font operations are applied and
p_pat is used for <test> elements with target=pattern.
.TP
FcBool FcConfigSubstitute (FcConfig *config, FcPattern *p, FcMatchKind kind)
Calls FcConfigSubstituteWithPat setting p_pat to NULL.
.TP .TP
FcPattern *FcFontMatch (FcConfig *config, FcPattern *p, FcResult *result) FcPattern *FcFontMatch (FcConfig *config, FcPattern *p, FcResult *result)
@ -1025,17 +1030,6 @@ Constructs a pattern representing the 'id'th font in 'file'. The number
of fonts in 'file' is returned in 'count'. of fonts in 'file' is returned in 'count'.
.SS XML specific functions .SS XML specific functions
.nf
.B #include <fontconfig/fcxml.h>
.fi
These functions expose the libxml2 datatypes used for font configuration.
.TP
xmlDocPtr FcConfigLoad (const char *file)
Loads a configuration file mapping 'file' into a filename with
FcConfigFilename. This doesn't load a complete configuration as any
include files referenced from 'file' will not be loaded.
.TP .TP
FcBool FcConfigParseAndLoad (FcConfig *config, const FcChar8 *file, FcBool complain) FcBool FcConfigParseAndLoad (FcConfig *config, const FcChar8 *file, FcBool complain)
Walks the configuration in 'file' and constructs the internal representation in Walks the configuration in 'file' and constructs the internal representation in