From 938bc63358c09b9fd3709e8f914870f906361594 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 11 Aug 2002 18:11:04 +0000 Subject: [PATCH] Fix weird first/not-first lameness in font matches, replacing with target qualifiers on test elements. Update library manual page. --- fontconfig/fcprivate.h | 5 +- fontconfig/fontconfig.h | 23 ++- fonts.conf.in | 9 +- fonts.dtd | 4 + src/fccfg.c | 142 +++++++---------- src/fcdbg.c | 29 +++- src/fcint.h | 19 ++- src/fclist.c | 4 +- src/fcmatch.c | 19 +-- src/fcname.c | 4 +- src/fcpat.c | 43 +++++- src/fcxml.c | 33 +++- src/fontconfig.man | 332 +++++++++++++++++++++++++++++++++++++--- 13 files changed, 510 insertions(+), 156 deletions(-) diff --git a/fontconfig/fcprivate.h b/fontconfig/fcprivate.h index 16ea543..3754efa 100644 --- a/fontconfig/fcprivate.h +++ b/fontconfig/fcprivate.h @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/fontconfig/fontconfig/fcprivate.h,v 1.2 2002/02/15 06:01:27 keithp Exp $ + * $XFree86: xc/lib/fontconfig/fontconfig/fcprivate.h,v 1.3 2002/05/31 23:21:24 keithp Exp $ * * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. * @@ -72,6 +72,9 @@ break; \ case FcTypeFTFace: \ __v__.u.f = va_arg (va, FT_Face); \ + break; \ + case FcTypePattern: \ + __v__.u.p = va_arg (va, FcPattern *); \ } \ if (!FcPatternAdd (__p__, __o__, __v__, FcTrue)) \ goto _FcPatternVapBuild_bail1; \ diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h index faa0554..b5fc1f6 100644 --- a/fontconfig/fontconfig.h +++ b/fontconfig/fontconfig.h @@ -71,6 +71,7 @@ typedef int FcBool; #define FC_SOURCE "source" /* String (X11, freetype) */ #define FC_CHARSET "charset" /* CharSet */ #define FC_LANG "lang" /* String OS/2 CodePageRange */ +#define FC_PATTERN "pattern" /* FcPattern */ #define FC_DIR_CACHE_FILE "fonts.cache" #define FC_USER_CACHE_FILE ".fonts.cache" @@ -109,7 +110,8 @@ typedef enum _FcType { FcTypeBool, FcTypeMatrix, FcTypeCharSet, - FcTypeFTFace + FcTypeFTFace, + FcTypePattern } FcType; typedef struct _FcMatrix { @@ -141,6 +143,8 @@ typedef enum _FcResult { FcResultMatch, FcResultNoMatch, FcResultTypeMismatch, FcResultNoId } FcResult; +typedef struct _FcPattern FcPattern; + typedef struct _FcValue { FcType type; union { @@ -151,11 +155,10 @@ typedef struct _FcValue { const FcMatrix *m; const FcCharSet *c; void *f; + const FcPattern *p; } u; } FcValue; -typedef struct _FcPattern FcPattern; - typedef struct _FcFontSet { int nfont; int sfont; @@ -169,7 +172,7 @@ typedef struct _FcObjectSet { } FcObjectSet; typedef enum _FcMatchKind { - FcMatchPattern, FcMatchFont + FcMatchPattern, FcMatchFont } FcMatchKind; typedef enum _FcSetName { @@ -336,13 +339,13 @@ FcCharSetNextPage (const FcCharSet *a, /* fcdbg.c */ void -FcValuePrint (FcValue v); +FcValuePrint (const FcValue v); void -FcPatternPrint (FcPattern *p); +FcPatternPrint (const FcPattern *p); void -FcFontSetPrint (FcFontSet *s); +FcFontSetPrint (const FcFontSet *s); /* fcdefault.c */ void @@ -602,6 +605,9 @@ FcPatternAddCharSet (FcPattern *p, const char *object, const FcCharSet *c); FcBool FcPatternAddBool (FcPattern *p, const char *object, FcBool b); +FcBool +FcPatternAddPattern (FcPattern *p, const char *object, const FcPattern *pp); + FcResult FcPatternGetInteger (FcPattern *p, const char *object, int n, int *i); @@ -620,6 +626,9 @@ FcPatternGetCharSet (FcPattern *p, const char *object, int n, FcCharSet **c); FcResult FcPatternGetBool (FcPattern *p, const char *object, int n, FcBool *b); +FcResult +FcPatternGetPattern (FcPattern *p, const char *object, int n, FcPattern **pp); + FcPattern * FcPatternVaBuild (FcPattern *orig, va_list va); diff --git a/fonts.conf.in b/fonts.conf.in index baccc8a..4806560 100644 --- a/fonts.conf.in +++ b/fonts.conf.in @@ -127,6 +127,11 @@ --> ~/.fonts.conf + + local.conf + @@ -197,11 +202,11 @@ - + roman - + roman diff --git a/fonts.dtd b/fonts.dtd index a6aedbb..9cbff4b 100644 --- a/fonts.dtd +++ b/fonts.dtd @@ -112,11 +112,15 @@ if 'qual' is 'first', then the match succeeds only if the first value matches. if 'qual' is 'not_first', then the match succeeds only if any value other than the first matches. + For match elements with target=font, if test 'target' is 'pattern', + then the test is applied to the pattern used in matching rather than + to the resulting font. -->