diff options
author | marha <marha@users.sourceforge.net> | 2011-03-25 10:41:05 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-03-25 10:41:05 +0000 |
commit | 272e57235cd60a2e65ac8258d96a02eb3939b687 (patch) | |
tree | 789d74bd6ec1cc468f1f81aab97d4e4dfdb2d5c5 /fontconfig/src | |
parent | b39f063f74bf0163eaf34db03134f226d18142ec (diff) | |
download | vcxsrv-272e57235cd60a2e65ac8258d96a02eb3939b687.tar.gz vcxsrv-272e57235cd60a2e65ac8258d96a02eb3939b687.tar.bz2 vcxsrv-272e57235cd60a2e65ac8258d96a02eb3939b687.zip |
git update until 25 Mar 2011
xserver
fontconfig
glproto
libXau
libXft
libXmu
libfontenc
libxcb
mesa
mkfontscale
pixman
randrproto
xkeyboard-config
xtrans
xwininfo
updated following packages:
xproto-7.0.21
xineramaproto-1.2.1
libXt-1.1.1
libxkbfile-1.0.7
libXpm-3.5.9
libXfont-1.4.3
libXaw-1.0.9
bdftopcf-1.0.3
encodings-1.0.4
fixesproto-5.0
font-adobe-100dpi-1.0.3
font-adobe-75dpi-1.0.3
font-adobe-utopia-100dpi-1.0.4
font-adobe-utopia-75dpi-1.0.4
font-adobe-utopia-type1-1.0.4
font-alias-1.0.3
font-arabic-misc-1.0.3
font-bh-100dpi-1.0.3
font-bh-75dpi-1.0.3
font-bh-lucidatypewriter-100dpi-1.0.3
font-bh-lucidatypewriter-75dpi-1.0.3
font-bh-ttf-1.0.3
font-bh-type1-1.0.3
font-bitstream-100dpi-1.0.3
font-bitstream-75dpi-1.0.3
font-bitstream-speedo-1.0.2
font-bitstream-type1-1.0.3
font-cronyx-cyrillic-1.0.3
font-cursor-misc-1.0.3
font-daewoo-misc-1.0.3
font-dec-misc-1.0.3
font-ibm-type1-1.0.3
font-isas-misc-1.0.3
font-jis-misc-1.0.3
font-micro-misc-1.0.3
font-misc-cyrillic-1.0.3
font-misc-ethiopic-1.0.3
font-misc-meltho-1.0.3
font-misc-misc-1.1.2
font-mutt-misc-1.0.3
font-schumacher-misc-1.1.2
font-screen-cyrillic-1.0.4
font-sony-misc-1.0.3
font-sun-misc-1.0.3
font-util-1.2.0
font-winitzki-cyrillic-1.0.3
font-xfree86-type1-1.0.4
Diffstat (limited to 'fontconfig/src')
-rw-r--r-- | fontconfig/src/Makefile.am | 14 | ||||
-rw-r--r-- | fontconfig/src/fcarch.c | 73 | ||||
-rw-r--r-- | fontconfig/src/fcarch.h | 71 | ||||
-rw-r--r-- | fontconfig/src/fcatomic.c | 10 | ||||
-rw-r--r-- | fontconfig/src/fcblanks.c | 4 | ||||
-rw-r--r-- | fontconfig/src/fccache.c | 86 | ||||
-rw-r--r-- | fontconfig/src/fccfg.c | 167 | ||||
-rw-r--r-- | fontconfig/src/fccharset.c | 171 | ||||
-rw-r--r-- | fontconfig/src/fcdbg.c | 26 | ||||
-rw-r--r-- | fontconfig/src/fcdefault.c | 6 | ||||
-rw-r--r-- | fontconfig/src/fcdir.c | 22 | ||||
-rw-r--r-- | fontconfig/src/fcformat.c | 14 | ||||
-rw-r--r-- | fontconfig/src/fcfreetype.c | 99 | ||||
-rw-r--r-- | fontconfig/src/fcfs.c | 10 | ||||
-rw-r--r-- | fontconfig/src/fcinit.c | 12 | ||||
-rw-r--r-- | fontconfig/src/fcint.h | 68 | ||||
-rw-r--r-- | fontconfig/src/fclang.c | 96 | ||||
-rw-r--r-- | fontconfig/src/fclist.c | 34 | ||||
-rw-r--r-- | fontconfig/src/fcmatch.c | 38 | ||||
-rw-r--r-- | fontconfig/src/fcname.c | 32 | ||||
-rw-r--r-- | fontconfig/src/fcpat.c | 74 | ||||
-rw-r--r-- | fontconfig/src/fcstr.c | 78 | ||||
-rw-r--r-- | fontconfig/src/fcxml.c | 371 |
23 files changed, 1060 insertions, 516 deletions
diff --git a/fontconfig/src/Makefile.am b/fontconfig/src/Makefile.am index 406e85e15..090f9b1ab 100644 --- a/fontconfig/src/Makefile.am +++ b/fontconfig/src/Makefile.am @@ -7,9 +7,9 @@ # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting -# documentation, and that the name of Keith Packard not be used in +# documentation, and that the name of the author(s) not be used in # advertising or publicity pertaining to distribution of the software without -# specific, written prior permission. Keith Packard makes no +# specific, written prior permission. The authors make no # representations about the suitability of this software for any purpose. It # is provided "as is" without express or implied warranty. # @@ -84,13 +84,12 @@ noinst_HEADERS=fcint.h fcftint.h fcdeprecate.h ALIAS_FILES = fcalias.h fcaliastail.h fcftalias.h fcftaliastail.h BUILT_SOURCES = $(ALIAS_FILES) \ - ../fc-arch/fcarch.h \ ../fc-case/fccase.h \ ../fc-glyphname/fcglyphname.h \ ../fc-lang/fclang.h -../fc-arch/fcarch.h: - cd ../fc-arch && $(MAKE) $(AM_MAKEFLAGS) fcarch.h +noinst_PROGRAMS = fcarch + ../fc-case/fccase.h: cd ../fc-case && $(MAKE) $(AM_MAKEFLAGS) fccase.h ../fc-glyphname/fcglyphname.h: @@ -99,6 +98,7 @@ BUILT_SOURCES = $(ALIAS_FILES) \ cd ../fc-lang && $(MAKE) $(AM_MAKEFLAGS) fclang.h libfontconfig_la_SOURCES = \ + fcarch.h \ fcatomic.c \ fcblanks.c \ fccache.c \ @@ -140,7 +140,7 @@ PUBLIC_FILES = \ $(top_srcdir)/fontconfig/fontconfig.h \ $(top_srcdir)/src/fcdeprecate.h \ $(top_srcdir)/fontconfig/fcprivate.h - + PUBLIC_FT_FILES = \ $(top_srcdir)/fontconfig/fcfreetype.h @@ -160,7 +160,7 @@ fontconfig.def: $(PUBLIC_FILES) $(PUBLIC_FT_FILES) echo Generating $@ (echo EXPORTS; \ (cat $(PUBLIC_FILES) $(PUBLIC_FT_FILES) || echo 'FcERROR ()' ) | \ - grep '^Fc[^ ]* *(' | sed -e 's/ *(.*$$//' -e 's/^/ /' | \ + grep '^Fc[^ ]* *(' | sed -e 's/ *(.*$$//' -e 's/^/ /' | \ sort; \ echo LIBRARY libfontconfig-@LIBT_CURRENT_MINUS_AGE@.dll; \ echo VERSION @LIBT_CURRENT@.@LIBT_REVISION@) >$@ diff --git a/fontconfig/src/fcarch.c b/fontconfig/src/fcarch.c new file mode 100644 index 000000000..c69397e18 --- /dev/null +++ b/fontconfig/src/fcarch.c @@ -0,0 +1,73 @@ +/* + * Copyright © 2002 Keith Packard + * Copyright © 2010 Behdad Esfahbod + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of the author(s) not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. The authors make no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include <stdio.h> + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +/* If architecture is hardcoded, skip the assert tests */ + +#ifndef FC_ARCHITECTURE + +#include "fcarch.h" + +/* Make sure the cache structure is consistent with what we expect */ + +#include "fcint.h" + +FC_ASSERT_STATIC (1 == sizeof (char)); +FC_ASSERT_STATIC (2 == sizeof (FcChar16)); +FC_ASSERT_STATIC (4 == sizeof (int)); +FC_ASSERT_STATIC (4 == sizeof (FcChar32)); +FC_ASSERT_STATIC (4 == sizeof (FcObject)); +FC_ASSERT_STATIC (4 == sizeof (FcValueBinding)); +FC_ASSERT_STATIC (8 == sizeof (FcAlign)); +FC_ASSERT_STATIC (0x20 == sizeof (FcCharLeaf)); + +FC_ASSERT_STATIC (SIZEOF_VOID_P == sizeof (intptr_t)); +FC_ASSERT_STATIC (SIZEOF_VOID_P == sizeof (FcPatternEltPtr)); +FC_ASSERT_STATIC (SIZEOF_VOID_P == sizeof (FcValueListPtr)); +FC_ASSERT_STATIC (SIZEOF_VOID_P == sizeof (char *)); +FC_ASSERT_STATIC (SIZEOF_VOID_P == sizeof (struct FcPatternElt *)); +FC_ASSERT_STATIC (SIZEOF_VOID_P == sizeof (FcValueList *)); +FC_ASSERT_STATIC (SIZEOF_VOID_P == sizeof (FcStrSet *)); +FC_ASSERT_STATIC (SIZEOF_VOID_P == sizeof (FcCharLeaf **)); +FC_ASSERT_STATIC (SIZEOF_VOID_P == sizeof (FcChar16 *)); + +FC_ASSERT_STATIC (0x08 + 1*ALIGNOF_DOUBLE == sizeof (FcValue)); +FC_ASSERT_STATIC (0x00 + 2*SIZEOF_VOID_P == sizeof (FcPatternElt)); +FC_ASSERT_STATIC (0x08 + 2*SIZEOF_VOID_P == sizeof (FcPattern)); +FC_ASSERT_STATIC (0x08 + 2*SIZEOF_VOID_P == sizeof (FcCharSet)); +FC_ASSERT_STATIC (0x08 + 6*SIZEOF_VOID_P == sizeof (FcCache)); + +#endif + + +int +main (int argc, char **argv) +{ + printf ("%s\n", FC_ARCHITECTURE); + return 0; +} diff --git a/fontconfig/src/fcarch.h b/fontconfig/src/fcarch.h new file mode 100644 index 000000000..0c8cd053f --- /dev/null +++ b/fontconfig/src/fcarch.h @@ -0,0 +1,71 @@ +/* + * Copyright © 2006 Keith Packard + * Copyright © 2010 Behdad Esfahbod + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of the author(s) not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. The authors make no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +#ifndef _FCARCH_H_ +#define _FCARCH_H_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +/* + * Each unique machine architecture needs an entry in this file + * So far the differences boil down to: endianness, 32 vs 64 bit pointers, + * and on 32bit ones, whether double is aligned to one word or two words. + * Those result in the 6 formats listed below. + * + * If any of the assertion errors in fccache.c fail, you need to add a new + * architecture. Contact the fontconfig mailing list in that case. + * + * name endianness pointer-size double-alignment + * + * le32d4 4321 4 4 + * le32d8 4321 4 8 + * le64 4321 8 8 + * be32d4 1234 4 4 + * be32d8 1234 4 8 + * be64 1234 8 8 + */ + +#if defined(WORDS_BIGENDIAN) && WORDS_BIGENDIAN +# define FC_ARCH_ENDIAN "be" +#else /* !WORDS_BIGENDIAN */ +# define FC_ARCH_ENDIAN "le" +#endif + +#if SIZEOF_VOID_P == 4 +# if ALIGNOF_DOUBLE == 4 +# define FC_ARCH_SIZE_ALIGN "32d4" +# else /* ALIGNOF_DOUBLE != 4 */ +# define FC_ARCH_SIZE_ALIGN "32d8" +# endif +#else /* SIZEOF_VOID_P != 4 */ +# define FC_ARCH_SIZE_ALIGN "64" +#endif + +#ifdef ARCHITECTURE +# define ARCHITECTURE FC_ARCHITECTURE +#else +# define FC_ARCHITECTURE FC_ARCH_ENDIAN FC_ARCH_SIZE_ALIGN +#endif + +#endif /* _FCARCH_H_ */ diff --git a/fontconfig/src/fcatomic.c b/fontconfig/src/fcatomic.c index 89cae6183..33c1cc628 100644 --- a/fontconfig/src/fcatomic.c +++ b/fontconfig/src/fcatomic.c @@ -7,9 +7,9 @@ * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in + * documentation, and that the name of the author(s) not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no + * specific, written prior permission. The authors make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * @@ -79,7 +79,7 @@ FcAtomicCreate (const FcChar8 *file) if (!atomic) return 0; FcMemAlloc (FC_MEM_ATOMIC, total_len); - + atomic->file = (FcChar8 *) (atomic + 1); strcpy ((char *) atomic->file, (char *) file); @@ -142,7 +142,7 @@ FcAtomicLock (FcAtomic *atomic) * machines sharing the same filesystem will have clocks * reasonably close to each other. */ - if (FcStat ((char *) atomic->lck, &lck_stat) >= 0) + if (FcStat (atomic->lck, &lck_stat) >= 0) { time_t now = time (0); if ((long int) (now - lck_stat.st_mtime) > 10 * 60) @@ -206,7 +206,7 @@ FcAtomicDestroy (FcAtomic *atomic) { FcMemFree (FC_MEM_ATOMIC, sizeof (FcAtomic) + strlen ((char *) atomic->file) * 4 + 4 + - sizeof (NEW_NAME) + sizeof (LCK_NAME) + + sizeof (NEW_NAME) + sizeof (LCK_NAME) + sizeof (TMP_NAME)); free (atomic); diff --git a/fontconfig/src/fcblanks.c b/fontconfig/src/fcblanks.c index bab3066e8..a80a1344f 100644 --- a/fontconfig/src/fcblanks.c +++ b/fontconfig/src/fcblanks.c @@ -7,9 +7,9 @@ * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in + * documentation, and that the name of the author(s) not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no + * specific, written prior permission. The authors make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * diff --git a/fontconfig/src/fccache.c b/fontconfig/src/fccache.c index 69e1a6b82..d86526623 100644 --- a/fontconfig/src/fccache.c +++ b/fontconfig/src/fccache.c @@ -6,9 +6,9 @@ * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in + * documentation, and that the name of the author(s) not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no + * specific, written prior permission. The authors make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * @@ -22,7 +22,7 @@ */ #include "fcint.h" -#include "../fc-arch/fcarch.h" +#include "fcarch.h" #include <stdio.h> #include <fcntl.h> #include <dirent.h> @@ -41,6 +41,7 @@ #define O_BINARY 0 #endif + struct MD5Context { FcChar32 buf[4]; FcChar32 bits[2]; @@ -92,10 +93,10 @@ FcStat (const char *file, struct stat *statb) char full_path_name[MAX_PATH]; char *basename; DWORD rc; - + if (!GetFileAttributesEx (file, GetFileExInfoStandard, &wfad)) return -1; - + statb->st_dev = 0; /* Calculate a pseudo inode number as a hash of the full path name. @@ -108,7 +109,7 @@ FcStat (const char *file, struct stat *statb) rc = GetLongPathName (full_path_name, full_path_name, sizeof (full_path_name)); statb->st_ino = FcStringHash (full_path_name); - + statb->st_mode = _S_IREAD | _S_IWRITE; statb->st_mode |= (statb->st_mode >> 3) | (statb->st_mode >> 6); @@ -116,21 +117,30 @@ FcStat (const char *file, struct stat *statb) statb->st_mode |= _S_IFDIR; else statb->st_mode |= _S_IFREG; - + statb->st_nlink = 1; statb->st_uid = statb->st_gid = 0; statb->st_rdev = 0; - + if (wfad.nFileSizeHigh > 0) return -1; statb->st_size = wfad.nFileSizeLow; - + statb->st_atime = (*(INT64 *)&wfad.ftLastAccessTime)/10000000 - EPOCH_OFFSET; statb->st_mtime = (*(INT64 *)&wfad.ftLastWriteTime)/10000000 - EPOCH_OFFSET; statb->st_ctime = statb->st_mtime; - + return 0; } + +#else + +int +FcStat (const char *file, struct stat *statb) +{ + return stat ((char *) file, statb); +} + #endif static const char bin2hex[] = { '0', '1', '2', '3', @@ -215,13 +225,13 @@ FcDirCacheOpenFile (const FcChar8 *cache_file, struct stat *file_stat) return fd; } -/* +/* * Look for a cache file for the specified dir. Attempt * to use each one we find, stopping when the callback * indicates success */ static FcBool -FcDirCacheProcess (FcConfig *config, const FcChar8 *dir, +FcDirCacheProcess (FcConfig *config, const FcChar8 *dir, FcBool (*callback) (int fd, struct stat *fd_stat, struct stat *dir_stat, void *closure), void *closure, FcChar8 **cache_file_ret) @@ -233,7 +243,7 @@ FcDirCacheProcess (FcConfig *config, const FcChar8 *dir, struct stat file_stat, dir_stat; FcBool ret = FcFalse; - if (FcStat ((char *) dir, &dir_stat) < 0) + if (FcStat (dir, &dir_stat) < 0) return FcFalse; FcDirCacheBasename (dir, cache_base); @@ -263,7 +273,7 @@ FcDirCacheProcess (FcConfig *config, const FcChar8 *dir, FcStrFree (cache_hashed); } FcStrListDone (list); - + return ret; } @@ -362,7 +372,7 @@ FcCacheInsert (FcCache *cache, struct stat *cache_stat) update[fcCacheMaxLevel] = &fcCacheChains[fcCacheMaxLevel]; fcCacheMaxLevel = level; } - + s = malloc (sizeof (FcCacheSkip) + (level - 1) * sizeof (FcCacheSkip *)); if (!s) return FcFalse; @@ -382,7 +392,7 @@ FcCacheInsert (FcCache *cache, struct stat *cache_stat) s->cache_ino = 0; s->cache_mtime = 0; } - + /* * Insert into all fcCacheChains */ @@ -515,7 +525,7 @@ FcCacheTimeValid (FcCache *cache, struct stat *dir_stat) if (!dir_stat) { - if (FcStat ((const char *) FcCacheDir (cache), &dir_static) < 0) + if (FcStat (FcCacheDir (cache), &dir_static) < 0) return FcFalse; dir_stat = &dir_static; } @@ -564,7 +574,7 @@ FcDirCacheMapFd (int fd, struct stat *fd_stat, struct stat *dir_stat) PAGE_READONLY, 0, 0, NULL); if (hFileMap != NULL) { - cache = MapViewOfFile (hFileMap, FILE_MAP_READ, 0, 0, + cache = MapViewOfFile (hFileMap, FILE_MAP_READ, 0, 0, fd_stat->st_size); CloseHandle (hFileMap); } @@ -583,8 +593,8 @@ FcDirCacheMapFd (int fd, struct stat *fd_stat, struct stat *dir_stat) return NULL; } allocated = FcTrue; - } - if (cache->magic != FC_CACHE_MAGIC_MMAP || + } + if (cache->magic != FC_CACHE_MAGIC_MMAP || cache->version < FC_CACHE_CONTENT_VERSION || cache->size != fd_stat->st_size || !FcCacheTimeValid (cache, dir_stat) || @@ -674,7 +684,7 @@ FcDirCacheValidateHelper (int fd, struct stat *fd_stat, struct stat *dir_stat, v { FcBool ret = FcTrue; FcCache c; - + if (read (fd, &c, sizeof (FcCache)) != sizeof (FcCache)) ret = FcFalse; else if (c.magic != FC_CACHE_MAGIC_MMAP) @@ -691,7 +701,7 @@ FcDirCacheValidateHelper (int fd, struct stat *fd_stat, struct stat *dir_stat, v static FcBool FcDirCacheValidConfig (const FcChar8 *dir, FcConfig *config) { - return FcDirCacheProcess (config, dir, + return FcDirCacheProcess (config, dir, FcDirCacheValidateHelper, NULL, NULL); } @@ -700,7 +710,7 @@ FcBool FcDirCacheValid (const FcChar8 *dir) { FcConfig *config; - + config = FcConfigGetCurrent (); if (!config) return FcFalse; @@ -722,7 +732,7 @@ FcDirCacheBuild (FcFontSet *set, const FcChar8 *dir, struct stat *dir_stat, FcSt FcChar8 *dir_serialize; intptr_t *dirs_serialize; FcFontSet *set_serialize; - + if (!serialize) return NULL; /* @@ -747,7 +757,7 @@ FcDirCacheBuild (FcFontSet *set, const FcChar8 *dir, struct stat *dir_stat, FcSt */ if (!FcFontSetSerializeAlloc (serialize, set)) goto bail1; - + /* Serialize layout complete. Now allocate space and fill it */ cache = malloc (serialize->size); if (!cache) @@ -769,7 +779,7 @@ FcDirCacheBuild (FcFontSet *set, const FcChar8 *dir, struct stat *dir_stat, FcSt if (!dir_serialize) goto bail2; cache->dir = FcPtrToOffset (cache, dir_serialize); - + /* * Serialize sub dirs */ @@ -778,14 +788,14 @@ FcDirCacheBuild (FcFontSet *set, const FcChar8 *dir, struct stat *dir_stat, FcSt goto bail2; cache->dirs = FcPtrToOffset (cache, dirs_serialize); cache->dirs_count = dirs->num; - for (i = 0; i < dirs->num; i++) + for (i = 0; i < dirs->num; i++) { FcChar8 *d_serialize = FcStrSerialize (serialize, dirs->strs[i]); if (!d_serialize) goto bail2; dirs_serialize[i] = FcPtrToOffset (dirs_serialize, d_serialize); } - + /* * Serialize font set */ @@ -795,7 +805,7 @@ FcDirCacheBuild (FcFontSet *set, const FcChar8 *dir, struct stat *dir_stat, FcSt cache->set = FcPtrToOffset (cache, set_serialize); FcSerializeDestroy (serialize); - + FcCacheInsert (cache, NULL); return cache; @@ -817,10 +827,10 @@ FcMakeDirectory (const FcChar8 *dir) { FcChar8 *parent; FcBool ret; - + if (strlen ((char *) dir) == 0) return FcFalse; - + parent = FcStrDirname (dir); if (!parent) return FcFalse; @@ -854,7 +864,7 @@ FcDirCacheWrite (FcCache *cache, FcConfig *config) /* * Write it to the first directory in the list which is writable */ - + list = FcStrListCreate (config->cacheDirs); if (!list) return FcFalse; @@ -909,21 +919,21 @@ FcDirCacheWrite (FcCache *cache, FcConfig *config) fd = open((char *)FcAtomicNewFile (atomic), O_RDWR | O_CREAT | O_BINARY, 0666); if (fd == -1) goto bail4; - + /* Temporarily switch magic to MMAP while writing to file */ magic = cache->magic; if (magic != FC_CACHE_MAGIC_MMAP) cache->magic = FC_CACHE_MAGIC_MMAP; - + /* * Write cache contents to file */ written = write (fd, cache, cache->size); - + /* Switch magic back */ if (magic != FC_CACHE_MAGIC_MMAP) cache->magic = magic; - + if (written != cache->size) { perror ("write cache"); @@ -982,7 +992,7 @@ FcCacheCopySet args1(const FcCache *c) FcFontSet *old = FcCacheSet (c); FcFontSet *new = FcFontSetCreate (); int i; - + if (!new) return NULL; for (i = 0; i < old->nfont; i++) @@ -1116,7 +1126,7 @@ static void MD5Update(struct MD5Context *ctx, const unsigned char *buf, unsigned } /* - * Final wrapup - pad to 64-byte boundary with the bit pattern + * Final wrapup - pad to 64-byte boundary with the bit pattern * 1 0* (64-bit count of bits processed, MSB-first) */ static void MD5Final(unsigned char digest[16], struct MD5Context *ctx) diff --git a/fontconfig/src/fccfg.c b/fontconfig/src/fccfg.c index 0f89b57a4..4beb7d236 100644 --- a/fontconfig/src/fccfg.c +++ b/fontconfig/src/fccfg.c @@ -7,9 +7,9 @@ * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in + * documentation, and that the name of the author(s) not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no + * specific, written prior permission. The authors make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * @@ -48,19 +48,19 @@ FcConfigCreate (void) if (!config) goto bail0; FcMemAlloc (FC_MEM_CONFIG, sizeof (FcConfig)); - + config->configDirs = FcStrSetCreate (); if (!config->configDirs) goto bail1; - + config->configFiles = FcStrSetCreate (); if (!config->configFiles) goto bail2; - + config->fontDirs = FcStrSetCreate (); if (!config->fontDirs) goto bail3; - + config->acceptGlobs = FcStrSetCreate (); if (!config->acceptGlobs) goto bail4; @@ -72,7 +72,7 @@ FcConfigCreate (void) config->acceptPatterns = FcFontSetCreate (); if (!config->acceptPatterns) goto bail6; - + config->rejectPatterns = FcFontSetCreate (); if (!config->rejectPatterns) goto bail7; @@ -80,7 +80,7 @@ FcConfigCreate (void) config->cacheDirs = FcStrSetCreate (); if (!config->cacheDirs) goto bail8; - + config->blanks = 0; config->substPattern = 0; @@ -91,12 +91,12 @@ FcConfigCreate (void) config->fonts[set] = 0; config->rescanTime = time(0); - config->rescanInterval = 30; + config->rescanInterval = 30; config->expr_pool = NULL; config->ref = 1; - + return config; bail8: @@ -131,7 +131,7 @@ FcConfigNewestFile (FcStrSet *files) if (list) { while ((file = FcStrListNext (list))) - if (FcStat ((char *) file, &statb) == 0) + if (FcStat (file, &statb) == 0) if (!newest.set || statb.st_mtime - newest.time > 0) { newest.set = FcTrue; @@ -181,7 +181,7 @@ static void FcSubstDestroy (FcSubst *s) { FcSubst *n; - + while (s) { n = s->next; @@ -279,7 +279,7 @@ FcConfigDestroy (FcConfig *config) */ FcBool -FcConfigAddCache (FcConfig *config, FcCache *cache, +FcConfigAddCache (FcConfig *config, FcCache *cache, FcSetName set, FcStrSet *dirSet) { FcFontSet *fs; @@ -343,7 +343,7 @@ FcConfigAddDirList (FcConfig *config, FcSetName set, FcStrSet *dirSet) FcStrList *dirlist; FcChar8 *dir; FcCache *cache; - + dirlist = FcStrListCreate (dirSet); if (!dirlist) return FcFalse; @@ -382,9 +382,9 @@ FcConfigBuildFonts (FcConfig *config) fonts = FcFontSetCreate (); if (!fonts) return FcFalse; - + FcConfigSetFonts (config, fonts, FcSetSystem); - + if (!FcConfigAddDirList (config, FcSetSystem, config->fontDirs)) return FcFalse; if (FcDebug () & FC_DBG_FONTSET) @@ -447,7 +447,7 @@ FcBool FcConfigAddDir (FcConfig *config, const FcChar8 *d) { - return (FcConfigAddConfigDir (config, d) && + return (FcConfigAddConfigDir (config, d) && FcConfigAddFontDir (config, d)); } @@ -481,17 +481,17 @@ FcConfigGetCacheDirs (FcConfig *config) } return FcStrListCreate (config->cacheDirs); } - + FcBool FcConfigAddConfigFile (FcConfig *config, const FcChar8 *f) { FcBool ret; FcChar8 *file = FcConfigFilename (f); - + if (!file) return FcFalse; - + ret = FcStrSetAdd (config->configFiles, file); FcStrFree (file); return ret; @@ -555,7 +555,7 @@ FcConfigAddBlank (FcConfig *config, FcChar32 blank) { FcBlanks *b, *freeme = 0; - + b = config->blanks; if (!b) { @@ -613,7 +613,7 @@ FcConfigSetRescanInverval (FcConfig *config, int rescanInterval) return FcConfigSetRescanInterval (config, rescanInterval); } - + FcBool FcConfigAddEdit (FcConfig *config, FcTest *test, @@ -697,10 +697,10 @@ FcConfigCompareValue (const FcValue *left_o, FcValue left = FcValueCanonicalize(left_o); FcValue right = FcValueCanonicalize(right_o); FcBool ret = FcFalse; - + left = FcConfigPromote (left, right); right = FcConfigPromote (right, left); - if (left.type == right.type) + if (left.type == right.type) { switch (left.type) { case FcTypeInteger: @@ -716,16 +716,16 @@ FcConfigCompareValue (const FcValue *left_o, case FcOpNotContains: ret = left.u.d != right.u.d; break; - case FcOpLess: + case FcOpLess: ret = left.u.d < right.u.d; break; - case FcOpLessEqual: + case FcOpLessEqual: ret = left.u.d <= right.u.d; break; - case FcOpMore: + case FcOpMore: ret = left.u.d > right.u.d; break; - case FcOpMoreEqual: + case FcOpMoreEqual: ret = left.u.d >= right.u.d; break; default: @@ -734,7 +734,7 @@ FcConfigCompareValue (const FcValue *left_o, break; case FcTypeBool: switch (op) { - case FcOpEqual: + case FcOpEqual: case FcOpContains: case FcOpListing: ret = left.u.b == right.u.b; @@ -749,7 +749,7 @@ FcConfigCompareValue (const FcValue *left_o, break; case FcTypeString: switch (op) { - case FcOpEqual: + case FcOpEqual: case FcOpListing: ret = FcStrCmpIgnoreCase (left.u.s, right.u.s) == 0; break; @@ -872,7 +872,7 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e) FcResult r; FcMatrix *m; FcChar8 *str; - + switch (e->op) { case FcOpInteger: v.type = FcTypeInteger; @@ -897,6 +897,11 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e) v.u.c = e->u.cval; v = FcValueSave (v); break; + case FcOpLangSet: + v.type = FcTypeLangSet; + v.u.l = e->u.lval; + v = FcValueSave (v); + break; case FcOpBool: v.type = FcTypeBool; v.u.b = e->u.bval; @@ -957,24 +962,24 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e) switch (vl.type) { case FcTypeDouble: switch (e->op) { - case FcOpPlus: + case FcOpPlus: v.type = FcTypeDouble; - v.u.d = vl.u.d + vr.u.d; + v.u.d = vl.u.d + vr.u.d; break; case FcOpMinus: v.type = FcTypeDouble; - v.u.d = vl.u.d - vr.u.d; + v.u.d = vl.u.d - vr.u.d; break; case FcOpTimes: v.type = FcTypeDouble; - v.u.d = vl.u.d * vr.u.d; + v.u.d = vl.u.d * vr.u.d; break; case FcOpDivide: v.type = FcTypeDouble; - v.u.d = vl.u.d / vr.u.d; + v.u.d = vl.u.d / vr.u.d; break; default: - v.type = FcTypeVoid; + v.type = FcTypeVoid; break; } if (v.type == FcTypeDouble && @@ -995,7 +1000,7 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e) v.u.b = vl.u.b && vr.u.b; break; default: - v.type = FcTypeVoid; + v.type = FcTypeVoid; break; } break; @@ -1006,7 +1011,7 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e) str = FcStrPlus (vl.u.s, vr.u.s); v.u.s = FcStrStaticName (str); FcStrFree (str); - + if (!v.u.s) v.type = FcTypeVoid; break; @@ -1036,6 +1041,44 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e) break; } break; + case FcTypeCharSet: + switch (e->op) { + case FcOpPlus: + v.type = FcTypeCharSet; + v.u.c = FcCharSetUnion (vl.u.c, vr.u.c); + if (!v.u.c) + v.type = FcTypeVoid; + break; + case FcOpMinus: + v.type = FcTypeCharSet; + v.u.c = FcCharSetSubtract (vl.u.c, vr.u.c); + if (!v.u.c) + v.type = FcTypeVoid; + break; + default: + v.type = FcTypeVoid; + break; + } + break; + case FcTypeLangSet: + switch (e->op) { + case FcOpPlus: + v.type = FcTypeLangSet; + v.u.l = FcLangSetUnion (vl.u.l, vr.u.l); + if (!v.u.l) + v.type = FcTypeVoid; + break; + case FcOpMinus: + v.type = FcTypeLangSet; + v.u.l = FcLangSetSubtract (vl.u.l, vr.u.l); + if (!v.u.l) + v.type = FcTypeVoid; + break; + default: + v.type = FcTypeVoid; + break; + } + break; default: v.type = FcTypeVoid; break; @@ -1139,7 +1182,7 @@ FcConfigMatchValueList (FcPattern *p, FcExpr *e = t->expr; FcValue value; FcValueList *v; - + while (e) { /* Compute the value of the match expression */ @@ -1180,7 +1223,7 @@ static FcValueList * FcConfigValues (FcPattern *p, FcExpr *e, FcValueBinding binding) { FcValueList *l; - + if (!e) return 0; l = (FcValueList *) malloc (sizeof (FcValueList)); @@ -1218,7 +1261,7 @@ FcConfigAdd (FcValueListPtr *head, { FcValueListPtr *prev, last, v; FcValueBinding sameBinding; - + if (position) sameBinding = position->binding; else @@ -1231,7 +1274,7 @@ FcConfigAdd (FcValueListPtr *head, if (position) prev = &position->next; else - for (prev = head; *prev != NULL; + for (prev = head; *prev != NULL; prev = &(*prev)->next) ; } @@ -1239,7 +1282,7 @@ FcConfigAdd (FcValueListPtr *head, { if (position) { - for (prev = head; *prev != NULL; + for (prev = head; *prev != NULL; prev = &(*prev)->next) { if (*prev == position) @@ -1262,24 +1305,24 @@ FcConfigAdd (FcValueListPtr *head, FcValueListPrint (*head); printf ("\n"); } - + if (new) { last = new; while (last->next != NULL) last = last->next; - + last->next = *prev; *prev = new; } - + if (FcDebug () & FC_DBG_EDIT) { printf ("%s list after ", append ? "Append" : "Prepend"); FcValueListPrint (*head); printf ("\n"); } - + return FcTrue; } @@ -1310,7 +1353,7 @@ FcConfigPatternAdd (FcPattern *p, if (list) { FcPatternElt *e = FcPatternObjectInsertElt (p, object); - + if (!e) return; FcConfigAdd (&e->values, 0, append, list); @@ -1462,7 +1505,7 @@ FcConfigSubstituteWithPat (FcConfig *config, if ((t->kind == FcMatchFont || kind == FcMatchPattern) && t->object == e->object) { - /* + /* * KLUDGE - the pattern may have been reallocated or * things may have been inserted or deleted above * this element by other edits. Go back and find @@ -1485,7 +1528,7 @@ FcConfigSubstituteWithPat (FcConfig *config, { FcValueList *thisValue = st[i].value; FcValueList *nextValue = thisValue; - + /* * Append the new list of values after the current value */ @@ -1624,7 +1667,7 @@ DllMain (HINSTANCE hinstDLL, } else fontconfig_path[0] = '\0'; - + break; } @@ -1671,7 +1714,7 @@ FcConfigFileExists (const FcChar8 *dir, const FcChar8 *file) FcMemAlloc (FC_MEM_STRING, strlen ((char *) path) + 1); if (access ((char *) path, R_OK) == 0) return path; - + FcStrFree (path); return 0; } @@ -1703,7 +1746,7 @@ FcConfigGetPath (void) if (env) { e = env; - while (*e) + while (*e) { colon = (FcChar8 *) strchr ((char *) e, FC_SEARCH_PATH_SEPARATOR); if (!colon) @@ -1720,7 +1763,7 @@ FcConfigGetPath (void) i++; } } - + #ifdef _WIN32 if (fontconfig_path[0] == '\0') { @@ -1858,7 +1901,7 @@ FcConfigAppFontAddFile (FcConfig *config, subdirs = FcStrSetCreate (); if (!subdirs) return FcFalse; - + set = FcConfigGetFonts (config, FcSetApplication); if (!set) { @@ -1894,7 +1937,7 @@ FcConfigAppFontAddDir (FcConfig *config, { FcFontSet *set; FcStrSet *dirs; - + if (!config) { config = FcConfigGetCurrent (); @@ -1905,7 +1948,7 @@ FcConfigAppFontAddDir (FcConfig *config, dirs = FcStrSetCreate (); if (!dirs) return FcFalse; - + set = FcConfigGetFonts (config, FcSetApplication); if (!set) { @@ -1917,9 +1960,9 @@ FcConfigAppFontAddDir (FcConfig *config, } FcConfigSetFonts (config, set, FcSetApplication); } - + FcStrSetAddFilename (dirs, dir); - + if (!FcConfigAddDirList (config, FcSetApplication, dirs)) { FcStrSetDestroy (dirs); @@ -1962,7 +2005,7 @@ FcConfigGlobMatch (const FcChar8 *glob, { FcChar8 c; - while ((c = *glob++)) + while ((c = *glob++)) { switch (c) { case '*': @@ -2034,7 +2077,7 @@ FcConfigPatternsMatch (const FcFontSet *patterns, const FcPattern *font) { int i; - + for (i = 0; i < patterns->nfont; i++) if (FcListPatternMatchAny (patterns->fonts[i], font)) return FcTrue; diff --git a/fontconfig/src/fccharset.c b/fontconfig/src/fccharset.c index d30e1614a..df1d2b538 100644 --- a/fontconfig/src/fccharset.c +++ b/fontconfig/src/fccharset.c @@ -7,9 +7,9 @@ * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in + * documentation, and that the name of the author(s) not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no + * specific, written prior permission. The authors make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * @@ -53,7 +53,7 @@ void FcCharSetDestroy (FcCharSet *fcs) { int i; - + if (fcs->ref == FC_REF_CONSTANT) { FcCacheObjectDereference (fcs); @@ -135,9 +135,9 @@ FcCharSetFindLeaf (const FcCharSet *fcs, FcChar32 ucs4) #define FC_IS_ZERO_OR_POWER_OF_TWO(x) (!((x) & ((x)-1))) static FcBool -FcCharSetPutLeaf (FcCharSet *fcs, +FcCharSetPutLeaf (FcCharSet *fcs, FcChar32 ucs4, - FcCharLeaf *leaf, + FcCharLeaf *leaf, int pos) { intptr_t *leaves = FcCharSetLeaves (fcs); @@ -188,8 +188,8 @@ FcCharSetPutLeaf (FcCharSet *fcs, fcs->leaves_offset = FcPtrToOffset (fcs, leaves); fcs->numbers_offset = FcPtrToOffset (fcs, numbers); } - - memmove (leaves + pos + 1, leaves + pos, + + memmove (leaves + pos + 1, leaves + pos, (fcs->num - pos) * sizeof (*leaves)); memmove (numbers + pos + 1, numbers + pos, (fcs->num - pos) * sizeof (*numbers)); @@ -213,11 +213,11 @@ FcCharSetFindLeafCreate (FcCharSet *fcs, FcChar32 ucs4) pos = FcCharSetFindLeafPos (fcs, ucs4); if (pos >= 0) return FcCharSetLeaf(fcs, pos); - + leaf = calloc (1, sizeof (FcCharLeaf)); if (!leaf) return 0; - + pos = -pos - 1; if (!FcCharSetPutLeaf (fcs, ucs4, leaf, pos)) { @@ -251,7 +251,7 @@ FcCharSetAddChar (FcCharSet *fcs, FcChar32 ucs4) { FcCharLeaf *leaf; FcChar32 *b; - + if (fcs->ref == FC_REF_CONSTANT) return FcFalse; leaf = FcCharSetFindLeafCreate (fcs, ucs4); @@ -262,6 +262,23 @@ FcCharSetAddChar (FcCharSet *fcs, FcChar32 ucs4) return FcTrue; } +FcBool +FcCharSetDelChar (FcCharSet *fcs, FcChar32 ucs4) +{ + FcCharLeaf *leaf; + FcChar32 *b; + + if (fcs->ref == FC_REF_CONSTANT) + return FcFalse; + leaf = FcCharSetFindLeaf (fcs, ucs4); + if (!leaf) + return FcTrue; + b = &leaf->map[(ucs4 & 0xff) >> 5]; + *b &= ~(1 << (ucs4 & 0x1f)); + /* We don't bother removing the leaf if it's empty */ + return FcTrue; +} + /* * An iterator for the leaves of a charset */ @@ -337,7 +354,7 @@ FcCharSetEqual (const FcCharSet *a, const FcCharSet *b) { FcCharSetIter ai, bi; int i; - + if (a == b) return FcTrue; for (FcCharSetIterStart (a, &ai), FcCharSetIterStart (b, &bi); @@ -568,7 +585,7 @@ FcCharSetIntersectCount (const FcCharSet *a, const FcCharSet *b) { FcCharSetIter ai, bi; FcChar32 count = 0; - + FcCharSetIterStart (a, &ai); FcCharSetIterStart (b, &bi); while (ai.leaf && bi.leaf) @@ -581,7 +598,7 @@ FcCharSetIntersectCount (const FcCharSet *a, const FcCharSet *b) while (i--) count += FcCharSetPopCount (*am++ & *bm++); FcCharSetIterNext (a, &ai); - } + } else if (ai.ucs4 < bi.ucs4) { ai.ucs4 = bi.ucs4; @@ -601,7 +618,7 @@ FcCharSetCount (const FcCharSet *a) { FcCharSetIter ai; FcChar32 count = 0; - + for (FcCharSetIterStart (a, &ai); ai.leaf; FcCharSetIterNext (a, &ai)) { int i = 256/32; @@ -618,7 +635,7 @@ FcCharSetSubtractCount (const FcCharSet *a, const FcCharSet *b) { FcCharSetIter ai, bi; FcChar32 count = 0; - + FcCharSetIterStart (a, &ai); FcCharSetIterStart (b, &bi); while (ai.leaf) @@ -657,7 +674,7 @@ FcCharSetIsSubset (const FcCharSet *a, const FcCharSet *b) { int ai, bi; FcChar16 an, bn; - + if (a == b) return FcTrue; bi = 0; ai = 0; @@ -672,7 +689,7 @@ FcCharSetIsSubset (const FcCharSet *a, const FcCharSet *b) { FcChar32 *am = FcCharSetLeaf(a, ai)->map; FcChar32 *bm = FcCharSetLeaf(b, bi)->map; - + if (am != bm) { int i = 256/32; @@ -710,7 +727,7 @@ FcCharSetIsSubset (const FcCharSet *a, const FcCharSet *b) */ FcChar32 -FcCharSetNextPage (const FcCharSet *a, +FcCharSetNextPage (const FcCharSet *a, FcChar32 map[FC_CHARSET_MAP_SIZE], FcChar32 *next) { @@ -721,7 +738,7 @@ FcCharSetNextPage (const FcCharSet *a, FcCharSetIterSet (a, &ai); if (!ai.leaf) return FC_CHARSET_DONE; - + /* * Save current information */ @@ -737,7 +754,7 @@ FcCharSetNextPage (const FcCharSet *a, } FcChar32 -FcCharSetFirstPage (const FcCharSet *a, +FcCharSetFirstPage (const FcCharSet *a, FcChar32 map[FC_CHARSET_MAP_SIZE], FcChar32 *next) { @@ -748,7 +765,7 @@ FcCharSetFirstPage (const FcCharSet *a, /* * old coverage API, rather hard to use correctly */ - + FcChar32 FcCharSetCoverage (const FcCharSet *a, FcChar32 page, FcChar32 *result) { @@ -772,7 +789,7 @@ FcCharSetCoverage (const FcCharSet *a, FcChar32 page, FcChar32 *result) /* * ASCII representation of charsets. - * + * * Each leaf is represented as 9 32-bit values, the code of the first character followed * by 8 32 bit values for the leaf itself. Each value is encoded as 5 ASCII characters, * only 85 different values are used to avoid control characters as well as the other @@ -781,38 +798,38 @@ FcCharSetCoverage (const FcCharSet *a, FcChar32 page, FcChar32 *result) */ static const unsigned char charToValue[256] = { - /* "" */ 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, - /* "\030" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - /* " " */ 0xff, 0x00, 0xff, 0x01, 0x02, 0x03, 0x04, 0xff, - /* "(" */ 0x05, 0x06, 0x07, 0x08, 0xff, 0xff, 0x09, 0x0a, - /* "0" */ 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, - /* "8" */ 0x13, 0x14, 0xff, 0x15, 0x16, 0xff, 0x17, 0x18, - /* "@" */ 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, - /* "H" */ 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, - /* "P" */ 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, - /* "X" */ 0x31, 0x32, 0x33, 0x34, 0xff, 0x35, 0x36, 0xff, - /* "`" */ 0xff, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, - /* "h" */ 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, - /* "p" */ 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, - /* "x" */ 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0xff, - /* "\200" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - /* "\210" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - /* "\220" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - /* "\230" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - /* "\240" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - /* "\250" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - /* "\260" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - /* "\270" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - /* "\300" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - /* "\310" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - /* "\320" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - /* "\330" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - /* "\340" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - /* "\350" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - /* "\360" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - /* "\370" */ 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, + /* "\020" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* "\030" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* " " */ 0xff, 0x00, 0xff, 0x01, 0x02, 0x03, 0x04, 0xff, + /* "(" */ 0x05, 0x06, 0x07, 0x08, 0xff, 0xff, 0x09, 0x0a, + /* "0" */ 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, + /* "8" */ 0x13, 0x14, 0xff, 0x15, 0x16, 0xff, 0x17, 0x18, + /* "@" */ 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, + /* "H" */ 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, + /* "P" */ 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, + /* "X" */ 0x31, 0x32, 0x33, 0x34, 0xff, 0x35, 0x36, 0xff, + /* "`" */ 0xff, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, + /* "h" */ 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, + /* "p" */ 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, + /* "x" */ 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0xff, + /* "\200" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* "\210" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* "\220" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* "\230" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* "\240" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* "\250" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* "\260" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* "\270" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* "\300" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* "\310" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* "\320" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* "\330" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* "\340" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* "\350" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* "\360" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* "\370" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, }; static const FcChar8 valueToChar[0x55] = { @@ -835,7 +852,7 @@ FcCharSetParseValue (FcChar8 *string, FcChar32 *value) int i; FcChar32 v; FcChar32 c; - + if (*string == ' ') { v = 0; @@ -1006,7 +1023,7 @@ FcNameUnparseCharSet (FcStrBuf *buf, const FcCharSet *c) FcCharSetDestroy (check); } #endif - + return FcTrue; } @@ -1093,7 +1110,7 @@ FcCharSetFreezeLeaf (FcCharSetFreezer *freezer, FcCharLeaf *leaf) FcChar32 hash = FcCharLeafHash (leaf); FcCharLeafEnt **bucket = &freezer->leaf_hash_table[hash % FC_CHAR_LEAF_HASH_SIZE]; FcCharLeafEnt *ent; - + for (ent = *bucket; ent; ent = ent->next) { if (ent->hash == hash && !memcmp (&ent->leaf, leaf, sizeof (FcCharLeaf))) @@ -1130,7 +1147,7 @@ FcCharSetFreezeOrig (FcCharSetFreezer *freezer, const FcCharSet *orig, const FcC { FcCharSetOrigEnt **bucket = &freezer->orig_hash_table[((uintptr_t) orig) & FC_CHAR_SET_HASH_SIZE]; FcCharSetOrigEnt *ent; - + ent = malloc (sizeof (FcCharSetOrigEnt)); if (!ent) return FcFalse; @@ -1154,7 +1171,7 @@ FcCharSetFreezeBase (FcCharSetFreezer *freezer, FcCharSet *fcs, const FcCharSet { if (ent->hash == hash && ent->set.num == fcs->num && - !memcmp (FcCharSetNumbers(&ent->set), + !memcmp (FcCharSetNumbers(&ent->set), FcCharSetNumbers(fcs), fcs->num * sizeof (FcChar16))) { @@ -1176,9 +1193,9 @@ FcCharSetFreezeBase (FcCharSetFreezer *freezer, FcCharSet *fcs, const FcCharSet if (!ent) return 0; FcMemAlloc (FC_MEM_CHARSET, size); - + freezer->charsets_allocated++; - + ent->set.ref = FC_REF_CONSTANT; ent->set.num = fcs->num; if (fcs->num) @@ -1188,13 +1205,13 @@ FcCharSetFreezeBase (FcCharSetFreezer *freezer, FcCharSet *fcs, const FcCharSet ent->set.leaves_offset = sizeof (ent->set); ent->set.numbers_offset = (ent->set.leaves_offset + fcs->num * sizeof (intptr_t)); - + ent_leaves = FcCharSetLeaves (&ent->set); for (i = 0; i < fcs->num; i++) ent_leaves[i] = FcPtrToOffset (ent_leaves, FcCharSetLeaf (fcs, i)); - memcpy (FcCharSetNumbers (&ent->set), - FcCharSetNumbers (fcs), + memcpy (FcCharSetNumbers (&ent->set), + FcCharSetNumbers (fcs), fcs->num * sizeof (FcChar16)); } else @@ -1215,7 +1232,7 @@ FcCharSetFindFrozen (FcCharSetFreezer *freezer, const FcCharSet *orig) { FcCharSetOrigEnt **bucket = &freezer->orig_hash_table[((uintptr_t) orig) & FC_CHAR_SET_HASH_SIZE]; FcCharSetOrigEnt *ent; - + for (ent = *bucket; ent; ent = ent->next) if (ent->orig == orig) return ent->frozen; @@ -1325,7 +1342,7 @@ FcCharSetSerializeAlloc (FcSerialize *serialize, const FcCharSet *cs) intptr_t *leaves; FcChar16 *numbers; int i; - + if (cs->ref != FC_REF_CONSTANT) { if (!serialize->cs_freezer) @@ -1336,13 +1353,13 @@ FcCharSetSerializeAlloc (FcSerialize *serialize, const FcCharSet *cs) } if (FcCharSetFindFrozen (serialize->cs_freezer, cs)) return FcTrue; - + cs = FcCharSetFreeze (serialize->cs_freezer, cs); } - + leaves = FcCharSetLeaves (cs); numbers = FcCharSetNumbers (cs); - + if (!FcSerializeAlloc (serialize, cs, sizeof (FcCharSet))) return FcFalse; if (!FcSerializeAlloc (serialize, leaves, cs->num * sizeof (intptr_t))) @@ -1355,7 +1372,7 @@ FcCharSetSerializeAlloc (FcSerialize *serialize, const FcCharSet *cs) return FcFalse; return FcTrue; } - + FcCharSet * FcCharSetSerialize(FcSerialize *serialize, const FcCharSet *cs) { @@ -1371,11 +1388,11 @@ FcCharSetSerialize(FcSerialize *serialize, const FcCharSet *cs) if (!cs) return NULL; } - + cs_serialized = FcSerializePtr (serialize, cs); if (!cs_serialized) return NULL; - + cs_serialized->ref = FC_REF_CONSTANT; cs_serialized->num = cs->num; @@ -1385,7 +1402,7 @@ FcCharSetSerialize(FcSerialize *serialize, const FcCharSet *cs) leaves_serialized = FcSerializePtr (serialize, leaves); if (!leaves_serialized) return NULL; - + cs_serialized->leaves_offset = FcPtrToOffset (cs_serialized, leaves_serialized); @@ -1393,10 +1410,10 @@ FcCharSetSerialize(FcSerialize *serialize, const FcCharSet *cs) numbers_serialized = FcSerializePtr (serialize, numbers); if (!numbers) return NULL; - + cs_serialized->numbers_offset = FcPtrToOffset (cs_serialized, numbers_serialized); - + for (i = 0; i < cs->num; i++) { leaf = FcCharSetLeaf (cs, i); @@ -1404,7 +1421,7 @@ FcCharSetSerialize(FcSerialize *serialize, const FcCharSet *cs) if (!leaf_serialized) return NULL; *leaf_serialized = *leaf; - leaves_serialized[i] = FcPtrToOffset (leaves_serialized, + leaves_serialized[i] = FcPtrToOffset (leaves_serialized, leaf_serialized); numbers_serialized[i] = numbers[i]; } @@ -1414,7 +1431,7 @@ FcCharSetSerialize(FcSerialize *serialize, const FcCharSet *cs) cs_serialized->leaves_offset = 0; cs_serialized->numbers_offset = 0; } - + return cs_serialized; } #define __fccharset__ diff --git a/fontconfig/src/fcdbg.c b/fontconfig/src/fcdbg.c index fd2d55a6b..cf2ff0870 100644 --- a/fontconfig/src/fcdbg.c +++ b/fontconfig/src/fcdbg.c @@ -7,9 +7,9 @@ * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in + * documentation, and that the name of the author(s) not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no + * specific, written prior permission. The authors make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * @@ -87,7 +87,7 @@ FcLangSetPrint (const FcLangSet *ls) { FcStrBuf buf; FcChar8 init_buf[1024]; - + FcStrBufInit (&buf, init_buf, sizeof (init_buf)); if (FcNameUnparseLangSet (&buf, ls) && FcStrBufChar (&buf,'\0')) printf ("%s", buf.buf); @@ -102,16 +102,16 @@ FcCharSetPrint (const FcCharSet *c) int i, j; intptr_t *leaves = FcCharSetLeaves (c); FcChar16 *numbers = FcCharSetNumbers (c); - + #if 0 printf ("CharSet 0x%x\n", (intptr_t) c); printf ("Leaves: +%d = 0x%x\n", c->leaves_offset, (intptr_t) leaves); printf ("Numbers: +%d = 0x%x\n", c->numbers_offset, (intptr_t) numbers); - + for (i = 0; i < c->num; i++) { - printf ("Page %d: %04x +%d = 0x%x\n", - i, numbers[i], leaves[i], + printf ("Page %d: %04x +%d = 0x%x\n", + i, numbers[i], leaves[i], (intptr_t) FcOffsetToPtr (leaves, leaves[i], FcCharLeaf)); } #endif @@ -135,7 +135,7 @@ FcPatternPrint (const FcPattern *p) { int i; FcPatternElt *e; - + if (!p) { printf ("Null pattern\n"); @@ -160,8 +160,10 @@ FcOpPrint (FcOp op) case FcOpDouble: printf ("Double"); break; case FcOpString: printf ("String"); break; case FcOpMatrix: printf ("Matrix"); break; + case FcOpRange: printf ("Range"); break; case FcOpBool: printf ("Bool"); break; case FcOpCharSet: printf ("CharSet"); break; + case FcOpLangSet: printf ("LangSet"); break; case FcOpField: printf ("Field"); break; case FcOpConst: printf ("Const"); break; case FcOpAssign: printf ("Assign"); break; @@ -210,8 +212,14 @@ FcExprPrint (const FcExpr *expr) expr->u.mval->xy, expr->u.mval->yx, expr->u.mval->yy); break; + case FcOpRange: break; case FcOpBool: printf ("%s", expr->u.bval ? "true" : "false"); break; case FcOpCharSet: printf ("charset\n"); break; + case FcOpLangSet: + printf ("langset:"); + FcLangSetPrint(expr->u.lval); + printf ("\n"); + break; case FcOpNil: printf ("nil\n"); break; case FcOpField: printf ("%s", FcObjectName(expr->u.object)); break; case FcOpConst: printf ("%s", expr->u.constant); break; @@ -347,7 +355,7 @@ FcSubstPrint (const FcSubst *subst) { FcEdit *e; FcTest *t; - + printf ("match\n"); for (t = subst->test; t; t = t->next) { diff --git a/fontconfig/src/fcdefault.c b/fontconfig/src/fcdefault.c index 091276b70..a9165facd 100644 --- a/fontconfig/src/fcdefault.c +++ b/fontconfig/src/fcdefault.c @@ -7,9 +7,9 @@ * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in + * documentation, and that the name of the author(s) not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no + * specific, written prior permission. The authors make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * @@ -134,7 +134,7 @@ FcDefaultSubstitute (FcPattern *pattern) for (i = 0; i < NUM_FC_BOOL_DEFAULTS; i++) if (FcPatternObjectGet (pattern, FcBoolDefaults[i].field, 0, &v) == FcResultNoMatch) FcPatternObjectAddBool (pattern, FcBoolDefaults[i].field, FcBoolDefaults[i].value); - + if (FcPatternObjectGet (pattern, FC_PIXEL_SIZE_OBJECT, 0, &v) == FcResultNoMatch) { double dpi, size, scale; diff --git a/fontconfig/src/fcdir.c b/fontconfig/src/fcdir.c index f927c0b28..359446c36 100644 --- a/fontconfig/src/fcdir.c +++ b/fontconfig/src/fcdir.c @@ -7,9 +7,9 @@ * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in + * documentation, and that the name of the author(s) not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no + * specific, written prior permission. The authors make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * @@ -30,7 +30,7 @@ FcFileIsDir (const FcChar8 *file) { struct stat statb; - if (FcStat ((const char *) file, &statb) != 0) + if (FcStat (file, &statb) != 0) return FcFalse; return S_ISDIR(statb.st_mode); } @@ -45,7 +45,7 @@ FcFileScanFontConfig (FcFontSet *set, FcBool ret = FcTrue; int id; int count = 0; - + id = 0; do { @@ -164,7 +164,7 @@ FcDirScanConfig (FcFontSet *set, strcpy ((char *) file, (char *) dir); strcat ((char *) file, "/"); base = file + strlen ((char *) file); - + if (FcDebug () & FC_DBG_SCAN) printf ("\tScanning dir %s\n", dir); @@ -205,7 +205,7 @@ FcDirScanConfig (FcFontSet *set, */ for (i = 0; i < files->num; i++) FcFileScanConfig (set, dirs, blanks, files->strs[i], config); - + bail2: FcStrSetDestroy (files); bail1: @@ -243,7 +243,7 @@ FcDirCacheScan (const FcChar8 *dir, FcConfig *config) if (FcDebug () & FC_DBG_FONTSET) printf ("cache scan dir %s\n", dir); - if (FcStat ((char *) dir, &dir_stat) < 0) + if (FcStat (dir, &dir_stat) < 0) { if (errno != ENOENT) ret = FcFalse; @@ -282,12 +282,12 @@ FcDirCacheScan (const FcChar8 *dir, FcConfig *config) ret = FcFalse; goto bail2; } - + /* * Write out the cache file, ignoring any troubles */ FcDirCacheWrite (cache, config); - + bail2: FcStrSetDestroy (dirs); bail1: @@ -310,11 +310,11 @@ FcDirCacheRead (const FcChar8 *dir, FcBool force, FcConfig *config) /* Try to use existing cache file */ if (!force) cache = FcDirCacheLoad (dir, config, NULL); - + /* Not using existing cache file, construct new cache */ if (!cache) cache = FcDirCacheScan (dir, config); - + return cache; } diff --git a/fontconfig/src/fcformat.c b/fontconfig/src/fcformat.c index bf9401740..1368b7186 100644 --- a/fontconfig/src/fcformat.c +++ b/fontconfig/src/fcformat.c @@ -7,9 +7,9 @@ * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in + * documentation, and that the name of the author(s) not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no + * specific, written prior permission. The authors make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * @@ -69,6 +69,7 @@ * * - verbose builtin that is like FcPatternPrint * - allow indexing subexprs using '%{[idx]elt1,elt2{subexpr}}' + * - allow indexing in +, -, ? filtering? * - conditional/filtering/deletion on binding (using '(w)'/'(s)'/'(=)' notation) */ @@ -436,6 +437,7 @@ interpret_filter_in (FcFormatContext *c, do { + /* XXX binding */ if (!read_word (c) || !FcObjectSetAdd (os, (const char *) c->word)) { @@ -608,7 +610,7 @@ interpret_enumerate (FcFormatContext *c, { FcLangSet *langset; if (FcResultMatch == - FcPatternGetLangSet (pat, os->objects[0], idx, &langset)) + FcPatternGetLangSet (pat, os->objects[0], 0, &langset)) { FcStrSet *ss; if (!(ss = FcLangSetGetLangs (langset)) || @@ -636,6 +638,7 @@ interpret_enumerate (FcFormatContext *c, FcPatternDel (subpat, os->objects[0]); if ((lang = FcStrListNext (lang_strs))) { + /* XXX binding? */ FcPatternAddString (subpat, os->objects[0], lang); done = FcFalse; } @@ -654,6 +657,7 @@ interpret_enumerate (FcFormatContext *c, if (FcResultMatch == FcPatternGet (pat, os->objects[i], idx, &v)) { + /* XXX binding */ FcPatternAdd (subpat, os->objects[i], v, FcFalse); done = FcFalse; } @@ -788,6 +792,8 @@ cescape (FcFormatContext *c, const FcChar8 *str, FcStrBuf *buf) { + /* XXX escape \n etc? */ + while(*str) { switch (*str) @@ -825,6 +831,8 @@ xmlescape (FcFormatContext *c, const FcChar8 *str, FcStrBuf *buf) { + /* XXX escape \n etc? */ + while(*str) { switch (*str) diff --git a/fontconfig/src/fcfreetype.c b/fontconfig/src/fcfreetype.c index 68596f5a4..d37af2d0e 100644 --- a/fontconfig/src/fcfreetype.c +++ b/fontconfig/src/fcfreetype.c @@ -7,9 +7,9 @@ * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in + * documentation, and that the name of the author(s) not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no + * specific, written prior permission. The authors make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * @@ -115,18 +115,19 @@ typedef struct { #define FC_ENCODING_MAC_ROMAN "MACINTOSH" static const FcFtEncoding fcFtEncoding[] = { - { TT_PLATFORM_APPLE_UNICODE, TT_ENCODING_DONT_CARE, "UCS-2BE" }, + { TT_PLATFORM_APPLE_UNICODE, TT_ENCODING_DONT_CARE, "UTF-16BE" }, { TT_PLATFORM_MACINTOSH, TT_MAC_ID_ROMAN, "MACINTOSH" }, { TT_PLATFORM_MACINTOSH, TT_MAC_ID_JAPANESE, "SJIS" }, + { TT_PLATFORM_MICROSOFT, TT_MS_ID_SYMBOL_CS, "UTF-16BE" }, { TT_PLATFORM_MICROSOFT, TT_MS_ID_UNICODE_CS, "UTF-16BE" }, { TT_PLATFORM_MICROSOFT, TT_MS_ID_SJIS, "SJIS-WIN" }, { TT_PLATFORM_MICROSOFT, TT_MS_ID_GB2312, "GB2312" }, { TT_PLATFORM_MICROSOFT, TT_MS_ID_BIG_5, "BIG-5" }, { TT_PLATFORM_MICROSOFT, TT_MS_ID_WANSUNG, "Wansung" }, { TT_PLATFORM_MICROSOFT, TT_MS_ID_JOHAB, "Johab" }, - { TT_PLATFORM_MICROSOFT, TT_MS_ID_UCS_4, "UCS-2BE" }, + { TT_PLATFORM_MICROSOFT, TT_MS_ID_UCS_4, "UTF-16BE" }, { TT_PLATFORM_ISO, TT_ISO_ID_7BIT_ASCII, "ASCII" }, - { TT_PLATFORM_ISO, TT_ISO_ID_10646, "UCS-2BE" }, + { TT_PLATFORM_ISO, TT_ISO_ID_10646, "UTF-16BE" }, { TT_PLATFORM_ISO, TT_ISO_ID_8859_1, "ISO-8859-1" }, }; @@ -251,14 +252,14 @@ static const FcFtLanguage fcFtLanguage[] = { { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_DZONGKHA, "dz" }, { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_JAVANESE, "jw" }, { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SUNDANESE, "su" }, - + #if 0 /* these seem to be errors that have been dropped */ { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SCOTTISH_GAELIC }, { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_IRISH_GAELIC }, #endif - + /* The following codes are new as of 2000-03-10 */ { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GALICIAN, "gl" }, { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_AFRIKAANS, "af" }, @@ -494,7 +495,7 @@ static const FcFtLanguage fcFtLanguage[] = { { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_PASHTO_AFGHANISTAN, "ps" }, { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FILIPINO_PHILIPPINES, "phi" }, { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_DHIVEHI_MALDIVES, "div" }, - + { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_OROMO_ETHIOPIA, "om" }, { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TIGRIGNA_ETHIOPIA, "ti" }, { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TIGRIGNA_ERYTHREA, "ti" }, @@ -743,7 +744,7 @@ FcSfntNameTranscode (FT_SfntName *sname) while (in_bytes_left) { - size_t did = iconv (cd, + size_t did = iconv (cd, &inbuf, &in_bytes_left, &outbuf, &out_bytes_left); if (did == (size_t) (-1)) @@ -785,7 +786,7 @@ FcSfntNameLanguage (FT_SfntName *sname) { language_id = TT_MAC_LANGID_JAPANESE; } - + for (i = 0; i < NUM_FC_FT_LANGUAGE; i++) if (fcFtLanguage[i].platform_id == platform_id && (fcFtLanguage[i].language_id == TT_LANGUAGE_DONT_CARE || @@ -870,7 +871,7 @@ FcVendorMatch(const FT_Char vendor[4], const FT_Char *vendor_string) { /* vendor is not necessarily NUL-terminated. */ int i, len; - + len = strlen((char *) vendor_string); if (memcmp(vendor, vendor_string, len) != 0) return FcFalse; @@ -926,7 +927,7 @@ static const FcChar8 * FcVendorFoundry(const FT_Char vendor[4]) { int i; - + if (vendor) for(i = 0; i < NUM_VENDOR_FOUNDRIES; i++) if (FcVendorMatch (vendor, FcVendorFoundries[i].vendor)) @@ -1139,7 +1140,7 @@ FcFreeTypeQueryFace (const FT_Face face, const FcChar8 *exclusiveLang = 0; FT_SfntName sname; FT_UInt snamei, snamec; - + int nfamily = 0; int nfamily_lang = 0; int nstyle = 0; @@ -1151,7 +1152,7 @@ FcFreeTypeQueryFace (const FT_Face face, FcChar8 *style = 0; int st; - + pat = FcPatternCreate (); if (!pat) goto bail0; @@ -1177,7 +1178,7 @@ FcFreeTypeQueryFace (const FT_Face face, * the Postscript FontInfo dictionary. Finally, the * BDF properties will queried. */ - + if (os2 && os2->version >= 0x0001 && os2->version != 0xffff) foundry = FcVendorFoundry(os2->achVendID); @@ -1247,7 +1248,7 @@ FcFreeTypeQueryFace (const FT_Face face, #endif case TT_NAME_ID_PREFERRED_FAMILY: case TT_NAME_ID_FONT_FAMILY: -#if 0 +#if 0 case TT_NAME_ID_PS_NAME: case TT_NAME_ID_UNIQUE_ID: #endif @@ -1334,7 +1335,7 @@ FcFreeTypeQueryFace (const FT_Face face, } } - if (!nfamily && face->family_name && + if (!nfamily && face->family_name && FcStrCmpIgnoreBlanksAndCase ((FcChar8 *) face->family_name, (FcChar8 *) "") != 0) { if (FcDebug () & FC_DBG_SCANV) @@ -1343,7 +1344,7 @@ FcFreeTypeQueryFace (const FT_Face face, goto bail1; ++nfamily; } - + if (!nstyle && face->style_name && FcStrCmpIgnoreBlanksAndCase ((FcChar8 *) face->style_name, (FcChar8 *) "") != 0) { @@ -1353,7 +1354,7 @@ FcFreeTypeQueryFace (const FT_Face face, goto bail1; ++nstyle; } - + if (!nfamily) { FcChar8 *start, *end; @@ -1432,7 +1433,7 @@ FcFreeTypeQueryFace (const FT_Face face, } if (bits & (1 << bit)) { - /* + /* * If the font advertises support for multiple * "exclusive" languages, then include support * for any language found to have coverage @@ -1504,7 +1505,7 @@ FcFreeTypeQueryFace (const FT_Face face, * Type 1: Check for FontInfo dictionary information * Code from g2@magestudios.net (Gerard Escalante) */ - + #if HAVE_FT_GET_PS_FONT_INFO if (FT_Get_PS_Font_Info(face, &psfontinfo) == 0) { @@ -1515,23 +1516,23 @@ FcFreeTypeQueryFace (const FT_Face face, printf ("\tType1 weight %s maps to %d\n", psfontinfo.weight, weight); } - + #if 0 - /* + /* * Don't bother with italic_angle; FreeType already extracts that * information for us and sticks it into style_flags */ if (psfontinfo.italic_angle) - slant = FC_SLANT_ITALIC; + slant = FC_SLANT_ITALIC; else - slant = FC_SLANT_ROMAN; + slant = FC_SLANT_ROMAN; #endif if(!foundry) foundry = FcNoticeFoundry(psfontinfo.notice); } #endif /* HAVE_FT_GET_PS_FONT_INFO */ - + #if HAVE_FT_GET_BDF_PROPERTY /* * Finally, look for a FOUNDRY BDF property if no other @@ -1553,7 +1554,7 @@ FcFreeTypeQueryFace (const FT_Face face, prop.type == BDF_PROPERTY_TYPE_CARDINAL)) { FT_Int32 value; - + if (prop.type == BDF_PROPERTY_TYPE_INTEGER) value = prop.u.integer; else @@ -1730,7 +1731,7 @@ FcFreeTypeQueryFace (const FT_Face face, * Drop our reference to the charset */ FcCharSetDestroy (cs); - + return pat; bail2: @@ -1750,10 +1751,10 @@ FcFreeTypeQuery(const FcChar8 *file, FT_Face face; FT_Library ftLibrary; FcPattern *pat = NULL; - + if (FT_Init_FreeType (&ftLibrary)) return NULL; - + if (FT_New_Face (ftLibrary, (char *) file, id, &face)) goto bail; @@ -2225,7 +2226,7 @@ static const FcCharMap AdobeSymbol = { AdobeSymbolEnt, sizeof (AdobeSymbolEnt) / sizeof (AdobeSymbolEnt[0]), }; - + static const FcFontDecode fcFontDecoders[] = { { ft_encoding_unicode, 0, (1 << 21) - 1 }, { ft_encoding_symbol, &AdobeSymbol, (1 << 16) - 1 }, @@ -2310,7 +2311,7 @@ static FcBool FcFreeTypeUseNames (FT_Face face) { FT_Int map; - + if (!FT_Has_PS_Glyph_Names (face)) return FcFalse; for (map = 0; map < face->num_charmaps; map++) @@ -2330,7 +2331,7 @@ FcUcs4ToGlyphName (FcChar32 ucs4) { if (_fc_glyph_names[gn].ucs == ucs4) return _fc_glyph_names[gn].name; - if (!r) + if (!r) { r = (int) (ucs4 % FC_GLYPHNAME_REHASH); if (!r) @@ -2355,7 +2356,7 @@ FcGlyphNameToUcs4 (FcChar8 *name) { if (!strcmp ((char *) name, (char *) _fc_glyph_names[gn].name)) return _fc_glyph_names[gn].ucs; - if (!r) + if (!r) { r = (int) (h % FC_GLYPHNAME_REHASH); if (!r) @@ -2478,14 +2479,14 @@ FcFreeTypeCharIndex (FT_Face face, FcChar32 ucs4) } static FcBool -FcFreeTypeCheckGlyph (FT_Face face, FcChar32 ucs4, +FcFreeTypeCheckGlyph (FT_Face face, FcChar32 ucs4, FT_UInt glyph, FcBlanks *blanks, FT_Pos *advance, FcBool using_strike) { FT_Int load_flags = FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH | FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING; FT_GlyphSlot slot; - + if (using_strike) load_flags &= ~FT_LOAD_NO_SCALE; @@ -2498,14 +2499,14 @@ FcFreeTypeCheckGlyph (FT_Face face, FcChar32 ucs4, */ if (face->face_flags & FT_FACE_FLAG_SCALABLE) load_flags |= FT_LOAD_NO_BITMAP; - + if (FT_Load_Glyph (face, glyph, load_flags)) return FcFalse; - + slot = face->glyph; if (!glyph) return FcFalse; - + *advance = slot->metrics.horiAdvance; switch (slot->format) { @@ -2559,7 +2560,7 @@ FcFreeTypeCharSetAndSpacingForSize (FT_Face face, FcBlanks *blanks, int *spacing fcs = FcCharSetCreate (); if (!fcs) goto bail0; - + #if HAVE_FT_SELECT_SIZE if (strike_index >= 0) { if (FT_Select_Size (face, strike_index) != FT_Err_Ok) @@ -2586,10 +2587,10 @@ FcFreeTypeCharSetAndSpacingForSize (FT_Face face, FcBlanks *blanks, int *spacing { ucs4 = map->ent[i].bmp; glyph = FT_Get_Char_Index (face, map->ent[i].encode); - if (glyph && + if (glyph && FcFreeTypeCheckGlyph (face, ucs4, glyph, blanks, &advance, using_strike)) { - /* + /* * ignore glyphs with zero advance. They’re * combining characters, and while their behaviour * isn’t well defined for monospaced applications in @@ -2701,7 +2702,7 @@ FcFreeTypeCharSetAndSpacingForSize (FT_Face face, FcBlanks *blanks, int *spacing if (FT_Get_Glyph_Name (face, glyph, name_buf, FC_GLYPHNAME_BUFLEN+1) == 0) { ucs4 = FcGlyphNameToUcs4 (name_buf); - if (ucs4 != 0xffff && + if (ucs4 != 0xffff && FcFreeTypeCheckGlyph (face, ucs4, glyph, blanks, &advance, using_strike)) { if (advance) @@ -2771,13 +2772,13 @@ FcCharSet * FcFreeTypeCharSetAndSpacing (FT_Face face, FcBlanks *blanks, int *spacing) { FcCharSet *cs; - + cs = FcFreeTypeCharSetAndSpacingForSize (face, blanks, spacing, -1); /* * Check for bitmap-only ttf fonts that are missing the glyf table. * In that case, pick a size and look for glyphs in that size instead */ - if (FcCharSetCount (cs) == 0) + if (FcCharSetCount (cs) == 0) { /* Check for non-scalable TT fonts */ if (!(face->face_flags & FT_FACE_FLAG_SCALABLE) && @@ -2789,7 +2790,7 @@ FcFreeTypeCharSetAndSpacing (FT_Face face, FcBlanks *blanks, int *spacing) /* Select the face closest to 16 pixels tall */ for (i = 1; i < face->num_fixed_sizes; i++) { - if (abs (face->available_sizes[i].height - 16) < + if (abs (face->available_sizes[i].height - 16) < abs (face->available_sizes[strike_index].height - 16)) strike_index = i; } @@ -2825,7 +2826,7 @@ FcFreeTypeCharSet (FT_Face face, FcBlanks *blanks) */ #define FcIsSpace(x) (040 == (x)) #define FcIsValidScript(x) (FcIsLower(x) || FcIsUpper (x) || FcIsSpace(x)) - + static void addtag(FcChar8 *complex_, FT_ULong tag) { @@ -2836,7 +2837,7 @@ addtag(FcChar8 *complex_, FT_ULong tag) tagstring[2] = (FcChar8)(tag >> 8), tagstring[3] = (FcChar8)(tag); tagstring[4] = '\0'; - + /* skip tags which aren't alphabetic, under the assumption that * they're probably broken */ @@ -2964,7 +2965,7 @@ FcFontCapabilities(FT_Face face) if (!issilgraphitefont && !gsub_count && !gpos_count) goto bail; - maxsize = (((FT_ULong) gpos_count + (FT_ULong) gsub_count) * OTLAYOUT_LEN + + maxsize = (((FT_ULong) gpos_count + (FT_ULong) gsub_count) * OTLAYOUT_LEN + (issilgraphitefont ? 13 : 0)); complex_ = malloc (sizeof (FcChar8) * maxsize); if (!complex_) diff --git a/fontconfig/src/fcfs.c b/fontconfig/src/fcfs.c index 0e97501f8..6625687c1 100644 --- a/fontconfig/src/fcfs.c +++ b/fontconfig/src/fcfs.c @@ -7,9 +7,9 @@ * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in + * documentation, and that the name of the author(s) not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no + * specific, written prior permission. The authors make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * @@ -61,7 +61,7 @@ FcFontSetAdd (FcFontSet *s, FcPattern *font) { FcPattern **f; int sfont; - + if (s->nfont == s->sfont) { sfont = s->sfont + 32; @@ -85,7 +85,7 @@ FcBool FcFontSetSerializeAlloc (FcSerialize *serialize, const FcFontSet *s) { int i; - + if (!FcSerializeAlloc (serialize, s, sizeof (FcFontSet))) return FcFalse; if (!FcSerializeAlloc (serialize, s->fonts, s->nfont * sizeof (FcPattern *))) @@ -111,7 +111,7 @@ FcFontSetSerialize (FcSerialize *serialize, const FcFontSet * s) return NULL; *s_serialize = *s; s_serialize->sfont = s_serialize->nfont; - + fonts_serialize = FcSerializePtr (serialize, s->fonts); if (!fonts_serialize) return NULL; diff --git a/fontconfig/src/fcinit.c b/fontconfig/src/fcinit.c index 3789d67b5..b7966b6db 100644 --- a/fontconfig/src/fcinit.c +++ b/fontconfig/src/fcinit.c @@ -7,9 +7,9 @@ * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in + * documentation, and that the name of the author(s) not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no + * specific, written prior permission. The authors make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * @@ -58,18 +58,18 @@ FcConfig * FcInitLoadConfig (void) { FcConfig *config; - + FcInitDebug (); config = FcConfigCreate (); if (!config) - return FcFalse; - + return NULL; + if (!FcConfigParseAndLoad (config, 0, FcTrue)) { FcConfigDestroy (config); return FcInitFallbackConfig (); } - + if (config->cacheDirs && config->cacheDirs->num == 0) { fprintf (stderr, diff --git a/fontconfig/src/fcint.h b/fontconfig/src/fcint.h index 233b4c302..83a7a435b 100644 --- a/fontconfig/src/fcint.h +++ b/fontconfig/src/fcint.h @@ -7,9 +7,9 @@ * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in + * documentation, and that the name of the author(s) not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no + * specific, written prior permission. The authors make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * @@ -107,6 +107,10 @@ #define FC_MEM_NUM 30 +#define _FC_ASSERT_STATIC1(_line, _cond) typedef int _static_assert_on_line_##_line##_failed[(_cond)?1:-1] +#define _FC_ASSERT_STATIC0(_line, _cond) _FC_ASSERT_STATIC1 (_line, (_cond)) +#define FC_ASSERT_STATIC(_cond) _FC_ASSERT_STATIC0 (__LINE__, (_cond)) + #define FC_MIN(a,b) ((a) < (b) ? (a) : (b)) #define FC_MAX(a,b) ((a) > (b) ? (a) : (b)) #define FC_ABS(a) ((a) < 0 ? -(a) : (a)) @@ -130,7 +134,7 @@ typedef enum _FcValueBinding { * Serialized data structures use only offsets instead of pointers * A low bit of 1 indicates an offset. */ - + /* Is the provided pointer actually an offset? */ #define FcIsEncodedOffset(p) ((((intptr_t) (p)) & 1) != 0) @@ -181,13 +185,13 @@ typedef struct _FcValueList { } FcValueList; #define FcValueListNext(vl) FcPointerMember(vl,next,FcValueList) - + typedef int FcObject; typedef struct _FcPatternElt *FcPatternEltPtr; /* - * Pattern elts are stuck in a structure connected to the pattern, + * Pattern elts are stuck in a structure connected to the pattern, * so they get moved around when the pattern is resized. Hence, the * values field must be a pointer/offset instead of just an offset */ @@ -216,13 +220,13 @@ struct _FcPattern { fs->fonts[i]) typedef enum _FcOp { - FcOpInteger, FcOpDouble, FcOpString, FcOpMatrix, FcOpBool, FcOpCharSet, + FcOpInteger, FcOpDouble, FcOpString, FcOpMatrix, FcOpRange, FcOpBool, FcOpCharSet, FcOpLangSet, FcOpNil, FcOpField, FcOpConst, - FcOpAssign, FcOpAssignReplace, + FcOpAssign, FcOpAssignReplace, FcOpPrependFirst, FcOpPrepend, FcOpAppend, FcOpAppendLast, FcOpQuest, - FcOpOr, FcOpAnd, FcOpEqual, FcOpNotEqual, + FcOpOr, FcOpAnd, FcOpEqual, FcOpNotEqual, FcOpContains, FcOpListing, FcOpNotContains, FcOpLess, FcOpLessEqual, FcOpMore, FcOpMoreEqual, FcOpPlus, FcOpMinus, FcOpTimes, FcOpDivide, @@ -235,12 +239,13 @@ typedef struct _FcExpr { union { int ival; double dval; - FcChar8 *sval; + const FcChar8 *sval; FcMatrix *mval; FcBool bval; FcCharSet *cval; + FcLangSet *lval; FcObject object; - FcChar8 *constant; + const FcChar8 *constant; struct { struct _FcExpr *left, *right; } tree; @@ -253,7 +258,7 @@ struct _FcExprPage { FcExprPage *next_page; FcExpr *next; FcExpr exprs[(1024 - 2/* two pointers */ - 2/* malloc overhead */) * sizeof (void *) / sizeof (FcExpr)]; - FcExpr end[0]; + FcExpr end[]; }; typedef enum _FcQual { @@ -373,7 +378,7 @@ typedef struct _FcSerialize { void *linear; FcSerializeBucket *buckets[FC_SERIALIZE_HASH_SIZE]; } FcSerialize; - + /* * To map adobe glyph names to unicode values, a precomputed hash * table is used @@ -387,14 +392,14 @@ typedef struct _FcGlyphName { /* * To perform case-insensitive string comparisons, a table * is used which holds three different kinds of folding data. - * + * * The first is a range of upper case values mapping to a range * of their lower case equivalents. Within each range, the offset * between upper and lower case is constant. * * The second is a range of upper case values which are interleaved * with their lower case equivalents. - * + * * The third is a set of raw unicode values mapping to a list * of unicode values for comparison purposes. This allows conversion * of ß to "ss" so that SS, ss and ß all match. A separate array @@ -448,7 +453,7 @@ struct _FcConfig { FcBlanks *blanks; /* * List of directories containing fonts, - * built by recursively scanning the set + * built by recursively scanning the set * of configured directories */ FcStrSet *fontDirs; @@ -497,7 +502,7 @@ struct _FcConfig { FcExprPage *expr_pool; /* pool of FcExpr's */ }; - + extern FcPrivate FcConfig *_fcConfig; typedef struct _FcFileTime { @@ -507,6 +512,13 @@ typedef struct _FcFileTime { typedef struct _FcCharMap FcCharMap; +typedef struct _FcRange FcRange; + +struct _FcRange { + FcChar32 begin; + FcChar32 end; +}; + /* fcblanks.c */ /* fccache.c */ @@ -519,7 +531,7 @@ FcDirCacheBuild (FcFontSet *set, const FcChar8 *dir, struct stat *dir_stat, FcSt FcPrivate FcBool FcDirCacheWrite (FcCache *cache, FcConfig *config); - + FcPrivate void FcCacheObjectReference (void *object); @@ -528,16 +540,12 @@ FcCacheObjectDereference (void *object); FcPrivate void FcCacheFini (void); - + FcPrivate void FcDirCacheReference (FcCache *cache, int nref); -#ifdef _WIN32 FcPrivate int FcStat (const char *file, struct stat *statb); -#else -#define FcStat stat -#endif /* fccfg.c */ @@ -606,13 +614,13 @@ FcPrivate FcFileTime FcConfigModifiedTime (FcConfig *config); FcPrivate FcBool -FcConfigAddCache (FcConfig *config, FcCache *cache, +FcConfigAddCache (FcConfig *config, FcCache *cache, FcSetName set, FcStrSet *dirSet); /* fcserialize.c */ FcPrivate intptr_t FcAlignSize (intptr_t size); - + FcPrivate FcSerialize * FcSerializeCreate (void); @@ -702,7 +710,7 @@ FcSubstPrint (const FcSubst *subst); FcPrivate void FcCharSetPrint (const FcCharSet *c); - + extern FcPrivate int FcDebugVal; #define FcDebug() (FcDebugVal) @@ -763,12 +771,12 @@ FcMemFree (int kind, int size); /* fclang.c */ FcPrivate FcLangSet * -FcFreeTypeLangSet (const FcCharSet *charset, +FcFreeTypeLangSet (const FcCharSet *charset, const FcChar8 *exclusiveLang); FcPrivate FcLangResult FcLangCompare (const FcChar8 *s1, const FcChar8 *s2); - + FcPrivate FcLangSet * FcLangSetPromote (const FcChar8 *lang); @@ -885,13 +893,13 @@ FcPatternObjectAddWithBinding (FcPattern *p, FcPrivate FcBool FcPatternObjectAdd (FcPattern *p, FcObject object, FcValue value, FcBool append); - + FcPrivate FcBool FcPatternObjectAddWeak (FcPattern *p, FcObject object, FcValue value, FcBool append); - + FcPrivate FcResult FcPatternObjectGet (const FcPattern *p, FcObject object, int id, FcValue *v); - + FcPrivate FcBool FcPatternObjectDel (FcPattern *p, FcObject object); diff --git a/fontconfig/src/fclang.c b/fontconfig/src/fclang.c index 1d62c4e3f..be42b58c4 100644 --- a/fontconfig/src/fclang.c +++ b/fontconfig/src/fclang.c @@ -7,9 +7,9 @@ * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in + * documentation, and that the name of the author(s) not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no + * specific, written prior permission. The authors make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * @@ -71,8 +71,22 @@ FcLangSetBitGet (const FcLangSet *ls, return ((ls->map[bucket] >> (id & 0x1f)) & 1) ? FcTrue : FcFalse; } +static void +FcLangSetBitReset (FcLangSet *ls, + unsigned int id) +{ + int bucket; + + id = fcLangCharSetIndices[id]; + bucket = id >> 5; + if (bucket >= ls->map_size) + return; /* shouldn't happen really */ + + ls->map[bucket] &= ~((FcChar32) 1 << (id & 0x1f)); +} + FcLangSet * -FcFreeTypeLangSet (const FcCharSet *charset, +FcFreeTypeLangSet (const FcCharSet *charset, const FcChar8 *exclusiveLang) { int i, j; @@ -85,7 +99,7 @@ FcFreeTypeLangSet (const FcCharSet *charset, ls = FcLangSetCreate (); if (!ls) return 0; - if (FcDebug() & FC_DBG_LANGSET) + if (FcDebug() & FC_DBG_LANGSET) { printf ("font charset"); FcCharSetPrint (charset); @@ -93,7 +107,7 @@ FcFreeTypeLangSet (const FcCharSet *charset, } for (i = 0; i < NUM_LANG_CHAR_SET; i++) { - if (FcDebug() & FC_DBG_LANGSET) + if (FcDebug() & FC_DBG_LANGSET) { printf ("%s charset", fcLangCharSets[i].lang); FcCharSetPrint (&fcLangCharSets[i].charset); @@ -112,7 +126,7 @@ FcFreeTypeLangSet (const FcCharSet *charset, continue; for (j = 0; j < fcLangCharSets[i].charset.num; j++) - if (FcCharSetLeaf(&fcLangCharSets[i].charset, j) != + if (FcCharSetLeaf(&fcLangCharSets[i].charset, j) != FcCharSetLeaf(exclusiveCharset, j)) continue; } @@ -121,7 +135,7 @@ FcFreeTypeLangSet (const FcCharSet *charset, { if (missing && missing < 10) { - FcCharSet *missed = FcCharSetSubtract (&fcLangCharSets[i].charset, + FcCharSet *missed = FcCharSetSubtract (&fcLangCharSets[i].charset, charset); FcChar32 ucs4; FcChar32 map[FC_CHARSET_MAP_SIZE]; @@ -154,8 +168,8 @@ FcFreeTypeLangSet (const FcCharSet *charset, if (FcDebug() & FC_DBG_SCANV) printf ("\n"); - - + + return ls; } @@ -188,7 +202,7 @@ FcLangCompare (const FcChar8 *s1, const FcChar8 *s2) } /* - * Return FcTrue when super contains sub. + * Return FcTrue when super contains sub. * * super contains sub if super and sub have the same * language and either the same country or one @@ -329,9 +343,9 @@ FcLangSetIndex (const FcChar8 *lang) { int low, high, mid = 0; int cmp = 0; - FcChar8 firstChar = FcToLower(lang[0]); + FcChar8 firstChar = FcToLower(lang[0]); FcChar8 secondChar = firstChar ? FcToLower(lang[1]) : '\0'; - + if (firstChar < 'a') { low = 0; @@ -360,11 +374,11 @@ FcLangSetIndex (const FcChar8 *lang) { /* fast path for resolving 2-letter languages (by far the most common) after * finding the first char (probably already true because of the hash table) */ cmp = fcLangCharSets[mid].lang[1] - secondChar; - if (cmp == 0 && - (fcLangCharSets[mid].lang[2] != '\0' || + if (cmp == 0 && + (fcLangCharSets[mid].lang[2] != '\0' || lang[2] != '\0')) { - cmp = FcStrCmpIgnoreCase(fcLangCharSets[mid].lang+2, + cmp = FcStrCmpIgnoreCase(fcLangCharSets[mid].lang+2, lang+2); } } @@ -400,6 +414,23 @@ FcLangSetAdd (FcLangSet *ls, const FcChar8 *lang) return FcStrSetAdd (ls->extra, lang); } +FcBool +FcLangSetDel (FcLangSet *ls, const FcChar8 *lang) +{ + int id; + + id = FcLangSetIndex (lang); + if (id >= 0) + { + FcLangSetBitReset (ls, id); + } + else if (ls->extra) + { + FcStrSetDel (ls->extra, lang); + } + return FcTrue; +} + FcLangResult FcLangSetHasLang (const FcLangSet *ls, const FcChar8 *lang) { @@ -505,6 +536,7 @@ FcLangSetCompare (const FcLangSet *lsa, const FcLangSet *lsb) /* * Used in computing values -- mustn't allocate any storage + * XXX Not thread-safe */ FcLangSet * FcLangSetPromote (const FcChar8 *lang) @@ -515,6 +547,7 @@ FcLangSetPromote (const FcChar8 *lang) int id; memset (ls.map, '\0', sizeof (ls.map)); + ls.map_size = NUM_LANG_SET_MAP; ls.extra = 0; id = FcLangSetIndex (lang); if (id > 0) @@ -727,7 +760,7 @@ FcLangSetContains (const FcLangSet *lsa, const FcLangSet *lsb) if (missing) { for (j = 0; j < 32; j++) - if (missing & (1 << j)) + if (missing & (1 << j)) { if (!FcLangSetContainsLang (lsa, fcLangCharSets[fcLangCharSetIndicesInv[i*32 + j]].lang)) @@ -816,6 +849,37 @@ FcLangSetGetLangs (const FcLangSet *ls) return langs; } +static FcLangSet * +FcLangSetOperate(const FcLangSet *a, + const FcLangSet *b, + FcBool (*func) (FcLangSet *ls, + const FcChar8 *s)) +{ + FcLangSet *langset = FcLangSetCopy (a); + FcStrList *sl = FcStrListCreate (FcLangSetGetLangs (b)); + FcChar8 *str; + + while ((str = FcStrListNext (sl))) + { + func (langset, str); + } + FcStrListDone (sl); + + return langset; +} + +FcLangSet * +FcLangSetUnion (const FcLangSet *a, const FcLangSet *b) +{ + return FcLangSetOperate(a, b, FcLangSetAdd); +} + +FcLangSet * +FcLangSetSubtract (const FcLangSet *a, const FcLangSet *b) +{ + return FcLangSetOperate(a, b, FcLangSetDel); +} + #define __fclang__ #include "fcaliastail.h" #include "fcftaliastail.h" diff --git a/fontconfig/src/fclist.c b/fontconfig/src/fclist.c index d804c1503..9a84b5c7e 100644 --- a/fontconfig/src/fclist.c +++ b/fontconfig/src/fclist.c @@ -7,9 +7,9 @@ * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in + * documentation, and that the name of the author(s) not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no + * specific, written prior permission. The authors make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * @@ -46,7 +46,7 @@ FcObjectSetAdd (FcObjectSet *os, const char *object) int s; const char **objects; int high, low, mid, c; - + if (os->nobject == os->sobject) { s = os->sobject + 4; @@ -81,7 +81,7 @@ FcObjectSetAdd (FcObjectSet *os, const char *object) } if (c < 0) mid++; - memmove (os->objects + mid + 1, os->objects + mid, + memmove (os->objects + mid + 1, os->objects + mid, (os->nobject - mid) * sizeof (const char *)); os->objects[mid] = object; os->nobject++; @@ -140,8 +140,8 @@ FcListValueListMatchAny (FcValueListPtr patOrig, /* pattern */ * where it requires an exact match) */ if (FcConfigCompareValue (&fnt->value, - FcOpListing, - &pat->value)) + FcOpListing, + &pat->value)) break; } if (fnt == NULL) @@ -226,8 +226,8 @@ FcListPatternMatchAny (const FcPattern *p, static FcChar32 FcListMatrixHash (const FcMatrix *m) { - int xx = (int) (m->xx * 100), - xy = (int) (m->xy * 100), + int xx = (int) (m->xx * 100), + xy = (int) (m->xy * 100), yx = (int) (m->yx * 100), yy = (int) (m->yy * 100); @@ -265,7 +265,7 @@ static FcChar32 FcListValueListHash (FcValueListPtr list) { FcChar32 h = 0; - + while (list != NULL) { h = h ^ FcListValueHash (&list->value); @@ -303,7 +303,7 @@ typedef struct _FcListHashTable { int entries; FcListBucket *buckets[FC_LIST_HASH_SIZE]; } FcListHashTable; - + static void FcListHashTableInit (FcListHashTable *table) { @@ -382,7 +382,7 @@ FcListAppend (FcListHashTable *table, for (prev = &table->buckets[hash % FC_LIST_HASH_SIZE]; (bucket = *prev); prev = &(bucket->next)) { - if (bucket->hash == hash && + if (bucket->hash == hash && FcListPatternEqual (bucket->pattern, font, os)) return FcTrue; } @@ -395,7 +395,7 @@ FcListAppend (FcListHashTable *table, bucket->pattern = FcPatternCreate (); if (!bucket->pattern) goto bail1; - + for (o = 0; o < os->nobject; o++) { if (!strcmp (os->objects[o], FC_FAMILY) || !strcmp (os->objects[o], FC_FAMILYLANG)) @@ -425,8 +425,8 @@ FcListAppend (FcListHashTable *table, for (v = FcPatternEltValues(e), idx = 0; v; v = FcValueListNext(v), ++idx) { - if (!FcPatternAdd (bucket->pattern, - os->objects[o], + if (!FcPatternAdd (bucket->pattern, + os->objects[o], FcValueCanonicalize(&v->value), defidx != idx)) goto bail2; } @@ -436,7 +436,7 @@ FcListAppend (FcListHashTable *table, ++table->entries; return FcTrue; - + bail2: FcPatternDestroy (bucket->pattern); bail1: @@ -515,7 +515,7 @@ FcFontSetList (FcConfig *config, full++; } } - printf ("used: %d max: %d avg: %g\n", full, max, + printf ("used: %d max: %d avg: %g\n", full, max, (double) ents / FC_LIST_HASH_SIZE); } #endif @@ -535,7 +535,7 @@ FcFontSetList (FcConfig *config, FcMemFree (FC_MEM_LISTBUCK, sizeof (FcListBucket)); free (bucket); } - + return ret; bail2: diff --git a/fontconfig/src/fcmatch.c b/fontconfig/src/fcmatch.c index aa84eda83..f111be52f 100644 --- a/fontconfig/src/fcmatch.c +++ b/fontconfig/src/fcmatch.c @@ -7,9 +7,9 @@ * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in + * documentation, and that the name of the author(s) not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no + * specific, written prior permission. The authors make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * @@ -31,7 +31,7 @@ static double FcCompareNumber (FcValue *value1, FcValue *value2) { double v1, v2, v; - + switch (value1->type) { case FcTypeInteger: v1 = (double) value1->u.i; @@ -67,7 +67,7 @@ FcCompareString (FcValue *v1, FcValue *v2) static double FcCompareFamily (FcValue *v1, FcValue *v2) { - /* rely on the guarantee in FcPatternAddWithBinding that + /* rely on the guarantee in FcPatternObjectAddWithBinding that * families are always FcTypeString. */ const FcChar8* v1_string = FcValueString(v1); const FcChar8* v2_string = FcValueString(v2); @@ -84,7 +84,7 @@ FcCompareLang (FcValue *v1, FcValue *v2) { FcLangResult result; FcValue value1 = FcValueCanonicalize(v1), value2 = FcValueCanonicalize(v2); - + switch (value1.type) { case FcTypeLangSet: switch (value2.type) { @@ -92,7 +92,7 @@ FcCompareLang (FcValue *v1, FcValue *v2) result = FcLangSetCompare (value1.u.l, value2.u.l); break; case FcTypeString: - result = FcLangSetHasLang (value1.u.l, + result = FcLangSetHasLang (value1.u.l, value2.u.s); break; default: @@ -105,7 +105,7 @@ FcCompareLang (FcValue *v1, FcValue *v2) result = FcLangSetHasLang (value2.u.l, value1.u.s); break; case FcTypeString: - result = FcLangCompare (value1.u.s, + result = FcLangCompare (value1.u.s, value2.u.s); break; default: @@ -354,10 +354,10 @@ FcCompare (FcPattern *pat, FcResult *result) { int i, i1, i2; - + for (i = 0; i < NUM_MATCH_VALUES; i++) value[i] = 0.0; - + i1 = 0; i2 = 0; while (i1 < pat->num && i2 < fnt->num) @@ -394,7 +394,7 @@ FcFontRenderPrepare (FcConfig *config, FcPatternElt *fe, *pe; FcValue v; FcResult result; - + new = FcPatternCreate (); if (!new) return 0; @@ -404,7 +404,7 @@ FcFontRenderPrepare (FcConfig *config, pe = FcPatternObjectFindElt (pat, fe->object); if (pe) { - if (!FcCompareValueList (pe->object, FcPatternEltValues(pe), + if (!FcCompareValueList (pe->object, FcPatternEltValues(pe), FcPatternEltValues(fe), &v, 0, &result)) { FcPatternDestroy (new); @@ -529,7 +529,7 @@ FcFontSetMatch (FcConfig *config, FcPattern * FcFontMatch (FcConfig *config, - FcPattern *p, + FcPattern *p, FcResult *result) { FcFontSet *sets[2]; @@ -687,21 +687,21 @@ FcFontSetSort (FcConfig *config, } if (!nnodes) goto bail0; - + for (nPatternLang = 0; FcPatternGet (p, FC_LANG, nPatternLang, &patternLang) == FcResultMatch; nPatternLang++) ; /* freed below */ - nodes = malloc (nnodes * sizeof (FcSortNode) + + nodes = malloc (nnodes * sizeof (FcSortNode) + nnodes * sizeof (FcSortNode *) + nPatternLang * sizeof (FcBool)); if (!nodes) goto bail0; nodeps = (FcSortNode **) (nodes + nnodes); patternLangSat = (FcBool *) (nodeps + nnodes); - + new = nodes; nodep = nodeps; for (set = 0; set < nsets; set++) @@ -735,13 +735,13 @@ FcFontSetSort (FcConfig *config, } nnodes = new - nodes; - + qsort (nodeps, nnodes, sizeof (FcSortNode *), FcSortCompare); - + for (i = 0; i < nPatternLang; i++) patternLangSat[i] = FcFalse; - + for (f = 0; f < nnodes; f++) { FcBool satisfies = FcFalse; @@ -814,7 +814,7 @@ bail0: FcFontSet * FcFontSort (FcConfig *config, - FcPattern *p, + FcPattern *p, FcBool trim, FcCharSet **csp, FcResult *result) diff --git a/fontconfig/src/fcname.c b/fontconfig/src/fcname.c index b4ce94421..86c10b65e 100644 --- a/fontconfig/src/fcname.c +++ b/fontconfig/src/fcname.c @@ -7,9 +7,9 @@ * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in + * documentation, and that the name of the author(s) not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no + * specific, written prior permission. The authors make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * @@ -28,9 +28,9 @@ #include <string.h> #include <stdio.h> -/* +/* * Please do not change this list, it is used to initialize the object - * list in this order to match the FC_foo_OBJECT constants. Those + * list in this order to match the FC_foo_OBJECT constants. Those * constants are written into cache files. */ @@ -169,7 +169,7 @@ FcObjectFindByName (const char *object, FcBool insert) * Hook it into the hash chain */ b = malloc (sizeof(FcObjectBucket)); - if (!b) + if (!b) return NULL; object = (const char *) FcStrCopy ((FcChar8 *) object); if (!object) { @@ -212,7 +212,7 @@ FcObjectHashInsert (const FcObjectType *object, FcBool copy) * Hook it into the hash chain */ b = malloc (sizeof(FcObjectBucket)); - if (!b) + if (!b) return FcFalse; if (copy) { @@ -421,7 +421,7 @@ static const FcConstant _FcBaseConstants[] = { { (FcChar8 *) "expanded", "width", FC_WIDTH_EXPANDED }, { (FcChar8 *) "extraexpanded", "width", FC_WIDTH_EXTRAEXPANDED }, { (FcChar8 *) "ultraexpanded", "width", FC_WIDTH_ULTRAEXPANDED }, - + { (FcChar8 *) "proportional", "spacing", FC_PROPORTIONAL, }, { (FcChar8 *) "dual", "spacing", FC_DUAL, }, { (FcChar8 *) "mono", "spacing", FC_MONO, }, @@ -495,8 +495,8 @@ FcNameUnregisterConstants (const FcConstant *consts, int nconsts) { const FcConstantList *l, **prev; - for (prev = &_FcConstants; - (l = *prev); + for (prev = &_FcConstants; + (l = *prev); prev = (const FcConstantList **) &(l->next)) { if (l->consts == consts && l->nconsts == nconsts) @@ -620,7 +620,7 @@ static const FcChar8 * FcNameFindNext (const FcChar8 *cur, const char *delim, FcChar8 *save, FcChar8 *last) { FcChar8 c; - + while ((c = *cur)) { if (c == '\\') @@ -765,7 +765,7 @@ bail0: return 0; } static FcBool -FcNameUnparseString (FcStrBuf *buf, +FcNameUnparseString (FcStrBuf *buf, const FcChar8 *string, const FcChar8 *escape) { @@ -790,7 +790,7 @@ FcNameUnparseValue (FcStrBuf *buf, { FcChar8 temp[1024]; FcValue v = FcValueCanonicalize(v0); - + switch (v.type) { case FcTypeVoid: return FcTrue; @@ -805,7 +805,7 @@ FcNameUnparseValue (FcStrBuf *buf, case FcTypeBool: return FcNameUnparseString (buf, v.u.b ? (FcChar8 *) "True" : (FcChar8 *) "False", 0); 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); return FcNameUnparseString (buf, temp, 0); case FcTypeCharSet: @@ -873,11 +873,11 @@ FcNameUnparseEscaped (FcPattern *pat, FcBool escape) for (i = 0; i < l->ntypes; i++) { o = &l->types[i]; - if (!strcmp (o->object, FC_FAMILY) || + if (!strcmp (o->object, FC_FAMILY) || !strcmp (o->object, FC_SIZE) || !strcmp (o->object, FC_FILE)) continue; - + e = FcPatternObjectFindElt (pat, FcObjectFromName (o->object)); if (e) { @@ -887,7 +887,7 @@ FcNameUnparseEscaped (FcPattern *pat, FcBool escape) goto bail0; if (!FcNameUnparseString (&buf, (FcChar8 *) "=", 0)) goto bail0; - if (!FcNameUnparseValueList (&buf, FcPatternEltValues(e), escape ? + if (!FcNameUnparseValueList (&buf, FcPatternEltValues(e), escape ? (FcChar8 *) FC_ESCAPE_VARIABLE : 0)) goto bail0; } diff --git a/fontconfig/src/fcpat.c b/fontconfig/src/fcpat.c index 76263b655..be01a4fd2 100644 --- a/fontconfig/src/fcpat.c +++ b/fontconfig/src/fcpat.c @@ -5,9 +5,9 @@ * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in + * documentation, and that the name of the author(s) not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no + * specific, written prior permission. The authors make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * @@ -138,11 +138,11 @@ FcValueListDestroy (FcValueListPtr l) FcMatrixFree ((FcMatrix *)l->value.u.m); break; case FcTypeCharSet: - FcCharSetDestroy + FcCharSetDestroy ((FcCharSet *) (l->value.u.c)); break; case FcTypeLangSet: - FcLangSetDestroy + FcLangSetDestroy ((FcLangSet *) (l->value.u.l)); break; default: @@ -210,7 +210,7 @@ FcStringHash (const FcChar8 *s) { FcChar8 c; FcChar32 h = 0; - + if (s) while ((c = *s++)) h = ((h << 1) | (h >> 31)) ^ c; @@ -232,9 +232,9 @@ FcValueHash (const FcValue *v) case FcTypeBool: return (FcChar32) v->u.b; case FcTypeMatrix: - return (FcDoubleHash (v->u.m->xx) ^ - FcDoubleHash (v->u.m->xy) ^ - FcDoubleHash (v->u.m->yx) ^ + return (FcDoubleHash (v->u.m->xx) ^ + FcDoubleHash (v->u.m->xy) ^ + FcDoubleHash (v->u.m->yx) ^ FcDoubleHash (v->u.m->yy)); case FcTypeCharSet: return (FcChar32) FcValueCharSet(v)->num; @@ -269,7 +269,7 @@ static FcChar32 FcValueListHash (FcValueListPtr l) { FcChar32 hash = 0; - + for (; l; l = FcValueListNext(l)) { hash = ((hash << 1) | (hash >> 31)) ^ FcValueHash (&l->value); @@ -282,7 +282,7 @@ FcPatternDestroy (FcPattern *p) { int i; FcPatternElt *elts; - + if (p->ref == FC_REF_CONSTANT) { FcCacheObjectDereference (p); @@ -342,12 +342,12 @@ FcPatternObjectInsertElt (FcPattern *p, FcObject object) { int i; FcPatternElt *e; - + i = FcPatternObjectPosition (p, object); if (i < 0) { i = -i - 1; - + /* reallocate array */ if (p->num + 1 >= p->size) { @@ -385,14 +385,14 @@ FcPatternObjectInsertElt (FcPattern *p, FcObject object) e + i, sizeof (FcPatternElt) * (p->num - i)); - + /* bump count */ p->num++; e[i].object = object; e[i].values = NULL; } - + return FcPatternElts(p) + i; } @@ -429,7 +429,7 @@ FcPatternHash (const FcPattern *p) for (i = 0; i < p->num; i++) { - h = (((h << 1) | (h >> 31)) ^ + h = (((h << 1) | (h >> 31)) ^ pe[i].object ^ FcValueListHash (FcPatternEltValues(&pe[i]))); } @@ -441,7 +441,7 @@ FcPatternEqualSubset (const FcPattern *pai, const FcPattern *pbi, const FcObject { FcPatternElt *ea, *eb; int i; - + for (i = 0; i < os->nobject; i++) { FcObject object = FcObjectFromName (os->objects[i]); @@ -503,11 +503,11 @@ FcPatternObjectAddWithBinding (FcPattern *p, new->value = value; new->binding = binding; new->next = NULL; - + e = FcPatternObjectInsertElt (p, object); if (!e) goto bail2; - + if (append) { for (prev = &e->values; *prev; prev = &(*prev)->next) @@ -519,10 +519,10 @@ FcPatternObjectAddWithBinding (FcPattern *p, new->next = e->values; e->values = new; } - + return FcTrue; -bail2: +bail2: FcValueDestroy (value); bail1: FcMemFree (FC_MEM_VALLIST, sizeof (FcValueList)); @@ -563,10 +563,10 @@ FcPatternObjectDel (FcPattern *p, FcObject object) /* destroy value */ FcValueListDestroy (e->values); - + /* shuffle existing ones down */ - memmove (e, e+1, - (FcPatternElts(p) + p->num - (e + 1)) * + memmove (e, e+1, + (FcPatternElts(p) + p->num - (e + 1)) * sizeof (FcPatternElt)); p->num--; e = FcPatternElts(p) + p->num; @@ -580,7 +580,7 @@ FcPatternDel (FcPattern *p, const char *object) { return FcPatternObjectDel (p, FcObjectFromName (object)); } - + FcBool FcPatternRemove (FcPattern *p, const char *object, int id) { @@ -773,8 +773,8 @@ FcPatternGetInteger (const FcPattern *p, const char *object, int id, int *i) { return FcPatternObjectGetInteger (p, FcObjectFromName (object), id, i); } - - + + FcResult FcPatternObjectGetDouble (const FcPattern *p, FcObject object, int id, double *d) { @@ -824,7 +824,7 @@ FcPatternGetString (const FcPattern *p, const char *object, int id, FcChar8 ** s { return FcPatternObjectGetString (p, FcObjectFromName (object), id, s); } - + FcResult FcPatternGetMatrix(const FcPattern *p, const char *object, int id, FcMatrix **m) { @@ -924,7 +924,7 @@ FcPatternDuplicate (const FcPattern *orig) l->binding, FcTrue)) goto bail1; - + } } @@ -949,7 +949,7 @@ FcPattern * FcPatternVaBuild (FcPattern *p, va_list va) { FcPattern *ret; - + FcPatternVapBuild (ret, p, va); return ret; } @@ -958,7 +958,7 @@ FcPattern * FcPatternBuild (FcPattern *p, ...) { va_list va; - + va_start (va, p); FcPatternVapBuild (p, p, va); va_end (va); @@ -974,14 +974,14 @@ FcPatternAppend (FcPattern *p, FcPattern *s) int i; FcPatternElt *e; FcValueListPtr v; - + for (i = 0; i < s->num; i++) { e = FcPatternElts(s)+i; for (v = FcPatternEltValues(e); v; v = FcValueListNext(v)) { if (!FcPatternObjectAddWithBinding (p, e->object, - FcValueCanonicalize(&v->value), + FcValueCanonicalize(&v->value), v->binding, FcTrue)) return FcFalse; } @@ -1102,7 +1102,7 @@ FcPatternSerializeAlloc (FcSerialize *serialize, const FcPattern *pat) { int i; FcPatternElt *elts = FcPatternElts(pat); - + if (!FcSerializeAlloc (serialize, pat, sizeof (FcPattern))) return FcFalse; if (!FcSerializeAlloc (serialize, elts, pat->num * sizeof (FcPatternElt))) @@ -1128,11 +1128,11 @@ FcPatternSerialize (FcSerialize *serialize, const FcPattern *pat) *pat_serialized = *pat; pat_serialized->size = pat->num; pat_serialized->ref = FC_REF_CONSTANT; - + elts_serialized = FcSerializePtr (serialize, elts); if (!elts_serialized) return NULL; - + pat_serialized->elts_offset = FcPtrToOffset (pat_serialized, elts_serialized); @@ -1142,7 +1142,7 @@ FcPatternSerialize (FcSerialize *serialize, const FcPattern *pat) if (!values_serialized) return NULL; elts_serialized[i].object = elts[i].object; - elts_serialized[i].values = FcPtrToEncodedOffset (&elts_serialized[i], + elts_serialized[i].values = FcPtrToEncodedOffset (&elts_serialized[i], values_serialized, FcValueList); } @@ -1199,7 +1199,7 @@ FcValueListSerialize (FcSerialize *serialize, const FcValueList *vl) vl_serialized = FcSerializePtr (serialize, vl); if (!vl_serialized) return NULL; - + if (prev_serialized) prev_serialized->next = FcPtrToEncodedOffset (prev_serialized, vl_serialized, diff --git a/fontconfig/src/fcstr.c b/fontconfig/src/fcstr.c index ea7c376c2..8b94ecba5 100644 --- a/fontconfig/src/fcstr.c +++ b/fontconfig/src/fcstr.c @@ -7,9 +7,9 @@ * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in + * documentation, and that the name of the author(s) not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no + * specific, written prior permission. The authors make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * @@ -109,7 +109,7 @@ FcStrCaseWalkerLong (FcCaseWalker *w, FcChar8 r) int mid = (min + max) >> 1; FcChar32 low = fcCaseFold[mid].upper; FcChar32 high = low + FcCaseFoldUpperCount (&fcCaseFold[mid]); - + if (high <= ucs4) min = mid + 1; else if (ucs4 < low) @@ -158,7 +158,7 @@ FcStrCaseWalkerNext (FcCaseWalker *w) w->read = 0; } r = *w->src++; - + if ((r & 0xc0) == 0xc0) return FcStrCaseWalkerLong (w, r); if ('A' <= r && r <= 'Z') @@ -181,7 +181,7 @@ FcStrCaseWalkerNextIgnoreBlanks (FcCaseWalker *w) { r = *w->src++; } while (r == ' '); - + if ((r & 0xc0) == 0xc0) return FcStrCaseWalkerLong (w, r); if ('A' <= r && r <= 'Z') @@ -215,11 +215,11 @@ FcStrCmpIgnoreCase (const FcChar8 *s1, const FcChar8 *s2) FcChar8 c1, c2; if (s1 == s2) return 0; - + FcStrCaseWalkerInit (s1, &w1); FcStrCaseWalkerInit (s2, &w2); - - for (;;) + + for (;;) { c1 = FcStrCaseWalkerNext (&w1); c2 = FcStrCaseWalkerNext (&w2); @@ -236,11 +236,11 @@ FcStrCmpIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2) FcChar8 c1, c2; if (s1 == s2) return 0; - + FcStrCaseWalkerInit (s1, &w1); FcStrCaseWalkerInit (s2, &w2); - - for (;;) + + for (;;) { c1 = FcStrCaseWalkerNextIgnoreBlanks (&w1); c2 = FcStrCaseWalkerNextIgnoreBlanks (&w2); @@ -254,10 +254,10 @@ int FcStrCmp (const FcChar8 *s1, const FcChar8 *s2) { FcChar8 c1, c2; - + if (s1 == s2) return 0; - for (;;) + for (;;) { c1 = *s1++; c2 = *s2++; @@ -296,8 +296,8 @@ FcStrIsAtIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2) FcStrCaseWalkerInit (s1, &w1); FcStrCaseWalkerInit (s2, &w2); - - for (;;) + + for (;;) { c1 = FcStrCaseWalkerNextIgnoreBlanks (&w1); c2 = FcStrCaseWalkerNextIgnoreBlanks (&w2); @@ -355,8 +355,8 @@ FcStrIsAtIgnoreCase (const FcChar8 *s1, const FcChar8 *s2) FcStrCaseWalkerInit (s1, &w1); FcStrCaseWalkerInit (s2, &w2); - - for (;;) + + for (;;) { c1 = FcStrCaseWalkerNext (&w1); c2 = FcStrCaseWalkerNext (&w2); @@ -395,7 +395,7 @@ FcStrContainsWord (const FcChar8 *s1, const FcChar8 *s2) while (s1len >= s2len) { - if (wordStart && + if (wordStart && FcStrIsAtIgnoreCase (s1, s2) && (s1len == s2len || FcCharIsPunct (s1[s2len]))) { @@ -422,12 +422,12 @@ FcStrStrIgnoreCase (const FcChar8 *s1, const FcChar8 *s2) if (s1 == s2) return s1; - + FcStrCaseWalkerInit (s1, &w1); FcStrCaseWalkerInit (s2, &w2); - + c2 = FcStrCaseWalkerNext (&w2); - + for (;;) { cur = w1.src; @@ -474,7 +474,7 @@ again: if (!c2) return 0; - for (;;) + for (;;) { p = s1; c1 = *s1++; @@ -517,15 +517,15 @@ FcUtf8ToUcs4 (const FcChar8 *src_orig, if (len == 0) return 0; - + s = *src++; len--; - + if (!(s & 0x80)) { result = s; extra = 0; - } + } else if (!(s & 0x40)) { return -1; @@ -561,7 +561,7 @@ FcUtf8ToUcs4 (const FcChar8 *src_orig, } if (extra > len) return -1; - + while (extra--) { result <<= 6; @@ -586,7 +586,7 @@ FcUtf8Len (const FcChar8 *string, int clen; FcChar32 c; FcChar32 max; - + n = 0; max = 0; while (len) @@ -616,7 +616,7 @@ FcUcs4ToUtf8 (FcChar32 ucs4, { int bits; FcChar8 *d = dest; - + if (ucs4 < 0x80) { *d++= ucs4; bits= -6; } else if (ucs4 < 0x800) { *d++= ((ucs4 >> 6) & 0x1F) | 0xC0; bits= 0; } else if (ucs4 < 0x10000) { *d++= ((ucs4 >> 12) & 0x0F) | 0xE0; bits= 6; } @@ -647,11 +647,11 @@ FcUtf16ToUcs4 (const FcChar8 *src_orig, if (len < 2) return 0; - + a = GetUtf16 (src, endian); src += 2; len -= 2; - - /* - * Check for surrogate + + /* + * Check for surrogate */ if ((a & 0xfc00) == 0xd800) { @@ -683,7 +683,7 @@ FcUtf16Len (const FcChar8 *string, int clen; FcChar32 c; FcChar32 max; - + n = 0; max = 0; while (len) @@ -835,7 +835,7 @@ FcChar8 * FcStrCopyFilename (const FcChar8 *s) { FcChar8 *new; - + if (*s == '~') { FcChar8 *home = FcConfigHome (); @@ -875,7 +875,7 @@ FcStrLastSlash (const FcChar8 *path) return slash; } - + FcChar8 * FcStrDirname (const FcChar8 *file) { @@ -954,10 +954,10 @@ FcStrCanonAbsoluteFilename (const FcChar8 *s) } return file; } - + #ifdef _WIN32 /* - * Convert '\\' to '/' , remove double '/' + * Convert '\\' to '/' , remove double '/' */ static void FcConvertDosPath (char *str) @@ -1135,7 +1135,7 @@ FcStrSetDel (FcStrSet *set, const FcChar8 *s) * copy remaining string pointers and trailing * NULL */ - memmove (&set->strs[i], &set->strs[i+1], + memmove (&set->strs[i], &set->strs[i+1], (set->num - i) * sizeof (FcChar8 *)); set->num--; return FcTrue; @@ -1149,7 +1149,7 @@ FcStrSetDestroy (FcStrSet *set) if (--set->ref == 0) { int i; - + for (i = 0; i < set->num; i++) FcStrFree (set->strs[i]); if (set->strs) diff --git a/fontconfig/src/fcxml.c b/fontconfig/src/fcxml.c index 9428468a4..ff30b7bbd 100644 --- a/fontconfig/src/fcxml.c +++ b/fontconfig/src/fcxml.c @@ -7,9 +7,9 @@ * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in + * documentation, and that the name of the author(s) not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no + * specific, written prior permission. The authors make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * @@ -134,6 +134,30 @@ FcExprCreateBool (FcConfig *config, FcBool b) } static FcExpr * +FcExprCreateCharSet (FcConfig *config, FcCharSet *charset) +{ + FcExpr *e = FcConfigAllocExpr (config); + if (e) + { + e->op = FcOpCharSet; + e->u.cval = FcCharSetCopy (charset); + } + return e; +} + +static FcExpr * +FcExprCreateLangSet (FcConfig *config, FcLangSet *langset) +{ + FcExpr *e = FcConfigAllocExpr (config); + if (e) + { + e->op = FcOpLangSet; + e->u.lval = FcLangSetCopy (langset); + } + return e; +} + +static FcExpr * FcExprCreateField (FcConfig *config, const char *field) { FcExpr *e = FcConfigAllocExpr (config); @@ -185,9 +209,14 @@ FcExprDestroy (FcExpr *e) case FcOpMatrix: FcMatrixFree (e->u.mval); break; + case FcOpRange: + break; case FcOpCharSet: FcCharSetDestroy (e->u.cval); break; + case FcOpLangSet: + FcLangSetDestroy (e->u.lval); + break; case FcOpBool: break; case FcOpField: @@ -277,8 +306,10 @@ typedef enum _FcElement { FcElementDouble, FcElementString, FcElementMatrix, + FcElementRange, FcElementBool, - FcElementCharset, + FcElementCharSet, + FcElementLangSet, FcElementName, FcElementConst, FcElementOr, @@ -316,7 +347,7 @@ static const struct { { "config", FcElementConfig }, { "match", FcElementMatch }, { "alias", FcElementAlias }, - + { "blank", FcElementBlank }, { "rescan", FcElementRescan }, @@ -338,8 +369,10 @@ static const struct { { "double", FcElementDouble }, { "string", FcElementString }, { "matrix", FcElementMatrix }, + { "range", FcElementRange }, { "bool", FcElementBool }, - { "charset", FcElementCharset }, + { "charset", FcElementCharSet }, + { "langset", FcElementLangSet }, { "name", FcElementName }, { "const", FcElementConst }, { "or", FcElementOr }, @@ -383,7 +416,7 @@ typedef struct _FcPStack { FcStrBuf str; FcChar8 *attr_buf_static[16]; } FcPStack; - + typedef enum _FcVStackTag { FcVStackNone, @@ -393,16 +426,19 @@ typedef enum _FcVStackTag { FcVStackConstant, FcVStackGlob, FcVStackPattern, - + FcVStackPrefer, FcVStackAccept, FcVStackDefault, - + FcVStackInteger, FcVStackDouble, FcVStackMatrix, + FcVStackRange, FcVStackBool, - + FcVStackCharSet, + FcVStackLangSet, + FcVStackTest, FcVStackExpr, FcVStackEdit @@ -418,7 +454,10 @@ typedef struct _FcVStack { int integer; double _double; FcMatrix *matrix; + FcRange range; FcBool bool_; + FcCharSet *charset; + FcLangSet *langset; FcTest *test; FcQual qual; @@ -529,7 +568,7 @@ FcTypecheckExpr (FcConfigParse *parse, FcExpr *expr, FcType type) { const FcObjectType *o; const FcConstant *c; - + /* If parsing the expression failed, some nodes may be NULL */ if (!expr) return; @@ -551,6 +590,9 @@ FcTypecheckExpr (FcConfigParse *parse, FcExpr *expr, FcType type) case FcOpCharSet: FcTypecheckValue (parse, FcTypeCharSet, type); break; + case FcOpLangSet: + FcTypecheckValue (parse, FcTypeLangSet, type); + break; case FcOpNil: break; case FcOpField: @@ -566,8 +608,8 @@ FcTypecheckExpr (FcConfigParse *parse, FcExpr *expr, FcType type) if (o) FcTypecheckValue (parse, o->type, type); } - else - FcConfigMessage (parse, FcSevereWarning, + else + FcConfigMessage (parse, FcSevereWarning, "invalid constant used : %s", expr->u.constant); break; @@ -618,7 +660,7 @@ FcTypecheckExpr (FcConfigParse *parse, FcExpr *expr, FcType type) static FcTest * FcTestCreate (FcConfigParse *parse, - FcMatchKind kind, + FcMatchKind kind, FcQual qual, const FcChar8 *field, FcOp compare, @@ -742,6 +784,18 @@ FcVStackPushMatrix (FcConfigParse *parse, FcMatrix *matrix) } static FcBool +FcVStackPushRange (FcConfigParse *parse, FcRange *range) +{ + FcVStack *vstack = FcVStackCreateAndPush (parse); + if (!vstack) + return FcFalse; + vstack->u.range.begin = range->begin; + vstack->u.range.end = range->end; + vstack->tag = FcVStackRange; + return FcTrue; +} + +static FcBool FcVStackPushBool (FcConfigParse *parse, FcBool bool_) { FcVStack *vstack = FcVStackCreateAndPush (parse); @@ -753,6 +807,34 @@ FcVStackPushBool (FcConfigParse *parse, FcBool bool_) } static FcBool +FcVStackPushCharSet (FcConfigParse *parse, FcCharSet *charset) +{ + FcVStack *vstack; + if (!charset) + return FcFalse; + vstack = FcVStackCreateAndPush (parse); + if (!vstack) + return FcFalse; + vstack->u.charset = charset; + vstack->tag = FcVStackCharSet; + return FcTrue; +} + +static FcBool +FcVStackPushLangSet (FcConfigParse *parse, FcLangSet *langset) +{ + FcVStack *vstack; + if (!langset) + return FcFalse; + vstack = FcVStackCreateAndPush (parse); + if (!vstack) + return FcFalse; + vstack->u.langset = langset; + vstack->tag = FcVStackLangSet; + return FcTrue; +} + +static FcBool FcVStackPushTest (FcConfigParse *parse, FcTest *test) { FcVStack *vstack = FcVStackCreateAndPush (parse); @@ -817,7 +899,7 @@ static void FcVStackPopAndDestroy (FcConfigParse *parse) { FcVStack *vstack = parse->vstack; - + if (!vstack || vstack->pstack != parse->pstack) return; @@ -843,8 +925,15 @@ FcVStackPopAndDestroy (FcConfigParse *parse) case FcVStackMatrix: FcMatrixFree (vstack->u.matrix); break; + case FcVStackRange: case FcVStackBool: break; + case FcVStackCharSet: + FcCharSetDestroy (vstack->u.charset); + break; + case FcVStackLangSet: + FcLangSetDestroy (vstack->u.langset); + break; case FcVStackTest: FcTestDestroy (vstack->u.test); break; @@ -954,8 +1043,8 @@ static FcBool FcPStackPop (FcConfigParse *parse) { FcPStack *old; - - if (!parse->pstack) + + if (!parse->pstack) { FcConfigMessage (parse, FcSevereError, "mismatching element"); return FcFalse; @@ -1026,11 +1115,11 @@ FcStartElement(void *userData, const XML_Char *name, const XML_Char **attr) { FcConfigParse *parse = userData; FcElement element; - + element = FcElementMap (name); if (element == FcElementUnknown) FcConfigMessage (parse, FcSevereWarning, "unknown element \"%s\"", name); - + if (!FcPStackPush (parse, element, attr)) { FcConfigMessage (parse, FcSevereError, "out of memory"); @@ -1042,30 +1131,40 @@ FcStartElement(void *userData, const XML_Char *name, const XML_Char **attr) static void FcParseBlank (FcConfigParse *parse) { - int n = FcVStackElements (parse); + int n = FcVStackElements (parse); + FcChar32 i; while (n-- > 0) { FcVStack *v = FcVStackFetch (parse, n); - if (v->tag != FcVStackInteger) - FcConfigMessage (parse, FcSevereError, "non-integer blank"); - else + if (!parse->config->blanks) { + parse->config->blanks = FcBlanksCreate (); if (!parse->config->blanks) - { - parse->config->blanks = FcBlanksCreate (); - if (!parse->config->blanks) - { - FcConfigMessage (parse, FcSevereError, "out of memory"); - break; - } - } + goto bail; + } + switch (v->tag) { + case FcVStackInteger: if (!FcBlanksAdd (parse->config->blanks, v->u.integer)) + goto bail; + break; + case FcVStackRange: + if (v->u.range.begin <= v->u.range.end) { - FcConfigMessage (parse, FcSevereError, "out of memory"); - break; + for (i = v->u.range.begin; i <= v->u.range.end; i++) + { + if (!FcBlanksAdd (parse->config->blanks, i)) + goto bail; + } } + break; + default: + FcConfigMessage (parse, FcSevereError, "invalid element in blank"); + break; } } + return; + bail: + FcConfigMessage (parse, FcSevereError, "out of memory"); } static void @@ -1087,7 +1186,7 @@ FcParseInt (FcConfigParse *parse) { FcChar8 *s, *end; int l; - + if (!parse->pstack) return; s = FcStrBufDoneStatic (&parse->pstack->str); @@ -1106,13 +1205,13 @@ FcParseInt (FcConfigParse *parse) } /* - * idea copied from glib g_ascii_strtod with - * permission of the author (Alexander Larsson) + * idea copied from glib g_ascii_strtod with + * permission of the author (Alexander Larsson) */ #include <locale.h> -static double +static double FcStrtod (char *s, char **end) { struct lconv *locale_data; @@ -1168,7 +1267,7 @@ FcParseDouble (FcConfigParse *parse) { FcChar8 *s, *end; double d; - + if (!parse->pstack) return; s = FcStrBufDoneStatic (&parse->pstack->str); @@ -1190,7 +1289,7 @@ static void FcParseString (FcConfigParse *parse, FcVStackTag tag) { FcChar8 *s; - + if (!parse->pstack) return; s = FcStrBufDone (&parse->pstack->str); @@ -1209,7 +1308,7 @@ FcParseMatrix (FcConfigParse *parse) FcVStack *vstack; enum { m_done, m_xx, m_xy, m_yx, m_yy } matrix_state = m_yy; FcMatrix m; - + while ((vstack = FcVStackPeek (parse))) { double v; @@ -1241,6 +1340,49 @@ FcParseMatrix (FcConfigParse *parse) FcVStackPushMatrix (parse, &m); } +static void +FcParseRange (FcConfigParse *parse) +{ + FcVStack *vstack; + FcRange r; + FcChar32 n; + int count = 1; + + while ((vstack = FcVStackPeek (parse))) + { + if (count < 0) + { + FcConfigMessage (parse, FcSevereError, "too many elements in range"); + return; + } + switch (vstack->tag) { + case FcVStackInteger: + n = vstack->u.integer; + break; + default: + FcConfigMessage (parse, FcSevereError, "invalid element in range"); + break; + } + if (count == 1) + r.end = n; + else + r.begin = n; + count--; + FcVStackPopAndDestroy (parse); + } + if (count < 0) + { + if (r.begin > r.end) + { + FcConfigMessage (parse, FcSevereError, "invalid range"); + return; + } + FcVStackPushRange (parse, &r); + } + else + FcConfigMessage (parse, FcSevereError, "invalid range"); +} + static FcBool FcConfigLexBool (FcConfigParse *parse, const FcChar8 *bool_) { @@ -1269,13 +1411,88 @@ FcParseBool (FcConfigParse *parse) FcStrBufDestroy (&parse->pstack->str); } +static void +FcParseCharSet (FcConfigParse *parse) +{ + FcVStack *vstack; + FcCharSet *charset = FcCharSetCreate (); + FcChar32 i; + int n = 0; + + while ((vstack = FcVStackPeek (parse))) + { + switch (vstack->tag) { + case FcVStackInteger: + if (!FcCharSetAddChar (charset, vstack->u.integer)) + { + FcConfigMessage (parse, FcSevereWarning, "invalid character: 0x%04x", vstack->u.integer); + } + else + n++; + break; + case FcVStackRange: + if (vstack->u.range.begin <= vstack->u.range.end) + { + for (i = vstack->u.range.begin; i <= vstack->u.range.end; i++) + { + if (!FcCharSetAddChar (charset, i)) + { + FcConfigMessage (parse, FcSevereWarning, "invalid character: 0x%04x", i); + } + else + n++; + } + } + break; + default: + FcConfigMessage (parse, FcSevereError, "invalid element in charset"); + break; + } + FcVStackPopAndDestroy (parse); + } + if (n > 0) + FcVStackPushCharSet (parse, charset); + else + FcCharSetDestroy (charset); +} + +static void +FcParseLangSet (FcConfigParse *parse) +{ + FcVStack *vstack; + FcLangSet *langset = FcLangSetCreate (); + int n = 0; + + while ((vstack = FcVStackPeek (parse))) + { + switch (vstack->tag) { + case FcVStackString: + if (!FcLangSetAdd (langset, vstack->u.string)) + { + FcConfigMessage (parse, FcSevereWarning, "invalid langset: %s", vstack->u.string); + } + else + n++; + break; + default: + FcConfigMessage (parse, FcSevereError, "invalid element in langset"); + break; + } + FcVStackPopAndDestroy (parse); + } + if (n > 0) + FcVStackPushLangSet (parse, langset); + else + FcLangSetDestroy (langset); +} + static FcBool FcConfigLexBinding (FcConfigParse *parse, const FcChar8 *binding_string, FcValueBinding *binding_ret) { FcValueBinding binding; - + if (!binding_string) binding = FcValueBindingWeak; else @@ -1426,7 +1643,7 @@ FcParseAlias (FcConfigParse *parse) } if (prefer) { - edit = FcEditCreate (parse, + edit = FcEditCreate (parse, FC_FAMILY_OBJECT, FcOpPrepend, prefer, @@ -1515,9 +1732,17 @@ FcPopExpr (FcConfigParse *parse) case FcVStackMatrix: expr = FcExprCreateMatrix (parse->config, vstack->u.matrix); break; + case FcVStackRange: + break; case FcVStackBool: expr = FcExprCreateBool (parse->config, vstack->u.bool_); break; + case FcVStackCharSet: + expr = FcExprCreateCharSet (parse->config, vstack->u.charset); + break; + case FcVStackLangSet: + expr = FcExprCreateLangSet (parse->config, vstack->u.langset); + break; case FcVStackTest: break; case FcVStackExpr: @@ -1611,7 +1836,7 @@ FcParseInclude (FcConfigParse *parse) FcChar8 *s; const FcChar8 *i; FcBool ignore_missing = FcFalse; - + s = FcStrBufDoneStatic (&parse->pstack->str); if (!s) { @@ -1637,7 +1862,7 @@ FcConfigLexOp (const FcChar8 *op, const FcOpMap *map, int nmap) int i; for (i = 0; i < nmap; i++) - if (!strcmp ((char *) op, map[i].name)) + if (!strcmp ((char *) op, map[i].name)) return map[i].op; return FcOpInvalid; } @@ -1846,7 +2071,7 @@ FcParseMatch (FcConfigParse *parse) vstack->tag = FcVStackNone; if (kind == FcMatchScan && edit->object > FC_MAX_BASE_OBJECT) { - FcConfigMessage (parse, FcSevereError, + FcConfigMessage (parse, FcSevereError, "<match target=\"scan\"> cannot edit user-defined object \"%s\"", FcObjectName(edit->object)); } @@ -1870,7 +2095,7 @@ FcParseAcceptRejectFont (FcConfigParse *parse, FcElement element) { switch (vstack->tag) { case FcVStackGlob: - if (!FcConfigGlobAdd (parse->config, + if (!FcConfigGlobAdd (parse->config, vstack->u.string, element == FcElementAcceptfont)) { @@ -1901,12 +2126,12 @@ FcPopValue (FcConfigParse *parse) { FcVStack *vstack = FcVStackPeek (parse); FcValue value; - + value.type = FcTypeVoid; - + if (!vstack) return value; - + switch (vstack->tag) { case FcVStackString: value.u.s = FcStrStaticName (vstack->u.string); @@ -1934,13 +2159,23 @@ FcPopValue (FcConfigParse *parse) value.u.b = vstack->u.bool_; value.type = FcTypeBool; break; + case FcVStackCharSet: + value.u.c = FcCharSetCopy (vstack->u.charset); + if (value.u.c) + value.type = FcTypeCharSet; + break; + case FcVStackLangSet: + value.u.l = FcLangSetCopy (vstack->u.langset); + if (value.u.l) + value.type = FcTypeLangSet; + break; default: - FcConfigMessage (parse, FcSevereWarning, "unknown pattern element %d", + FcConfigMessage (parse, FcSevereWarning, "unknown pattern element %d", vstack->tag); break; } FcVStackPopAndDestroy (parse); - + return value; } @@ -1964,7 +2199,7 @@ FcParsePatelt (FcConfigParse *parse) FcPatternDestroy (pattern); return; } - + for (;;) { value = FcPopValue (parse); @@ -2199,11 +2434,17 @@ FcEndElement(void *userData, const XML_Char *name) case FcElementMatrix: FcParseMatrix (parse); break; + case FcElementRange: + FcParseRange (parse); + break; case FcElementBool: FcParseBool (parse); break; - case FcElementCharset: -/* FcParseCharset (parse); */ + case FcElementCharSet: + FcParseCharSet (parse); + break; + case FcElementLangSet: + FcParseLangSet (parse); break; case FcElementSelectfont: break; @@ -2296,7 +2537,7 @@ static void FcCharacterData (void *userData, const XML_Char *s, int len) { FcConfigParse *parse = userData; - + if (!parse->pstack) return; if (!FcStrBufData (&parse->pstack->str, (FcChar8 *) s, len)) @@ -2382,18 +2623,18 @@ FcConfigParseAndLoadDir (FcConfig *config, ret = FcFalse; goto bail1; } - + strcpy ((char *) file, (char *) dir); strcat ((char *) file, "/"); base = file + strlen ((char *) file); - + files = FcStrSetCreate (); if (!files) { ret = FcFalse; goto bail2; } - + if (FcDebug () & FC_DBG_CONFIG) printf ("\tScanning config dir %s\n", dir); @@ -2421,7 +2662,7 @@ FcConfigParseAndLoadDir (FcConfig *config, if (ret) { int i; - qsort (files->strs, files->num, sizeof (FcChar8 *), + qsort (files->strs, files->num, sizeof (FcChar8 *), (int (*)(const void *, const void *)) FcSortCmpStr); for (i = 0; ret && i < files->num; i++) ret = FcConfigParseAndLoad (config, files->strs[i], complain); @@ -2448,18 +2689,18 @@ FcConfigParseAndLoad (FcConfig *config, int len; FcConfigParse parse; FcBool error = FcTrue; - + #ifdef ENABLE_LIBXML2 xmlSAXHandler sax; char buf[BUFSIZ]; #else void *buf; #endif - + filename = FcConfigFilename (name); if (!filename) goto bail0; - + if (FcStrSetMember (config->configFiles, filename)) { FcStrFree (filename); @@ -2483,11 +2724,11 @@ FcConfigParseAndLoad (FcConfig *config, printf ("\tLoading config file %s\n", filename); fd = open ((char *) filename, O_RDONLY); - if (fd == -1) { + if (fd == -1) { FcStrFree (filename); goto bail0; } - + #ifdef ENABLE_LIBXML2 memset(&sax, 0, sizeof(sax)); @@ -2512,7 +2753,7 @@ FcConfigParseAndLoad (FcConfig *config, #ifndef ENABLE_LIBXML2 XML_SetUserData (p, &parse); - + XML_SetDoctypeDeclHandler (p, FcStartDoctypeDecl, FcEndDoctypeDecl); XML_SetElementHandler (p, FcStartElement, FcEndElement); XML_SetCharacterDataHandler (p, FcCharacterData); @@ -2541,7 +2782,7 @@ FcConfigParseAndLoad (FcConfig *config, if (!XML_ParseBuffer (p, len, len == 0)) #endif { - FcConfigMessage (&parse, FcSevereError, "%s", + FcConfigMessage (&parse, FcSevereError, "%s", XML_ErrorString (XML_GetErrorCode (p))); goto bail3; } |