Commit Graph

289 Commits

Author SHA1 Message Date
Patrick Lam a8c425301a Fix problem with missing 'en' due to euro.patch: change cache file format
slightly to coincide with that generated by fc-lang.
2006-02-09 15:25:57 +00:00
Patrick Lam b10e77628c Fix warning. 2006-02-08 03:34:17 +00:00
Patrick Lam 5c3deb2985 Don't reject dirs that can't be normalized (fixes lilypond, and is correct
in the context of application font directories.)
Use normalized directory name exclusively in FcCacheReadDirs.
reviewed by: plam
2006-02-07 22:09:01 +00:00
Patrick Lam efb11b36c4 Perf optimizations. Inline FcValueCanonicalize, reduce FcValueListPtrU
usage, remove redundant cast.
reviewed by: plam
2006-02-07 21:15:33 +00:00
Patrick Lam 6cc02fe6b9 src/fccharset.c (FcLangCharSetPopulate, FcCharSetInsertLeaf)
Fix missing FcCacheBankToIndex in FcCharSetInsertLeaf. Declare extern for
    static arrays as arrays, not pointers. (Part of the fix for 'fonts
    don't have en' issue after Euro patch.)
(I forgot to commit the ChangeLog last time.)
reviewed by: plam
2006-02-07 20:56:48 +00:00
Patrick Lam a81f23c0ce Fix hidden variable warning. 2006-02-07 03:53:32 +00:00
Patrick Lam 799157dbbf Remove de-escaping logic because FcCacheWriteString doesn't escape anyway.
Do blockwise reading instead of byte-wise for performance.
2006-02-07 02:33:57 +00:00
Patrick Lam 8b413bb62c Takashi Iwai <tiwai@suse.de>
Don't loop infinitely on recursive symlinks (client-side).
2006-02-07 02:22:50 +00:00
Patrick Lam 660acf8f22 Don't loop infinitely on recursive symlinks.
reviewed by: plam
2006-02-06 23:11:41 +00:00
Patrick Lam fff5a5af30 Skip subdirs when skipping over stale bits of global cache. Introduce state
machine into FcGlobalCacheDir to avoid doing inappropriate operations
    on global dir entries, e.g. writing out an out-of-date cache entry.
reviewed by: plam
2006-02-06 22:44:02 +00:00
Patrick Lam 98592bbb1d Hoist FcFileIsDir check out of FcFileScanConfig loop.
reviewed by: plam
2006-02-06 21:52:15 +00:00
Patrick Lam a0aa54f6ee Don't rescan when trying to normalize a non-declared font dir. Don't add
font dirs multiple times (even if they're aliased).
reviewed by: plam
2006-02-06 19:25:45 +00:00
Patrick Lam 86e75dfb5d Explain apples/oranges comparison and fix compilation error.
reviewed by: plam
2006-02-06 14:44:46 +00:00
Patrick Lam f076169d19 Insert check for integer overflow in # of fonts.
reviewed by: plam
2006-02-06 14:14:21 +00:00
Patrick Lam 788c4af232 Make 'make distcheck' work with automake 1.6.3.
reviewed by: plam
2006-02-05 04:11:08 +00:00
Patrick Lam 68355f3877 src/fccache.c (FcGlobalCacheLoad, FcGlobalCacheSave, FcDirCacheConsume,
FcDirCacheWrite)
Check I/O call return values and eliminate unused variable warnings.
reviewed by: plam
2006-02-05 02:57:21 +00:00
Patrick Lam c4c47a7654 src/fccfg.c (FcConfigAppFontAddFile, FcConfigAppFontAddDir)
Fix memory leak.
reviewed by: plam
2006-02-04 00:09:42 +00:00
Patrick Lam a8e4d9eb39 Gracefully handle the case where a cache asserts that it has a negative
number of fonts, causing overflow.
reviewed by: plam
2006-02-04 00:04:00 +00:00
Patrick Lam 1af0f5741a Fix double free in error case. 2006-02-03 23:47:37 +00:00
Patrick Lam 80ba0571f3 Stephan Kulow <coolo@suse.de> reviewed by: plam
Replace 'stamp' target with mkinstalldirs.
2006-01-31 07:30:23 +00:00
Patrick Lam 28aefd013d Toast broken global cache files.
reviewed by: plam
2006-01-31 07:16:22 +00:00
Patrick Lam 3616cbe251 Actually use the directories that I added to the global cache. Fixes 'make
check'.
2006-01-31 04:42:20 +00:00
Patrick Lam 275cf6cd83 Don't stop scanning if a directory in fonts.conf doesn't exist, because
subsequent directories might exist.
reviewed by: plam
2006-01-31 04:07:45 +00:00
Patrick Lam 81d97094cf Make global cache work again after putting dir names into global cache (I
misplaced the recording of a file offset).
2006-01-30 16:31:56 +00:00
Patrick Lam 2c4e012497 Update fc-cat to handle subdir lists in global cache file.
Another FcCacheReadString return value check.
2006-01-30 15:59:17 +00:00
Patrick Lam c5411c4cae Make fccache more resilient to broken cache files by checking return value
of FcCacheReadString all the time.
reviewed by: plam
2006-01-30 15:44:13 +00:00
Patrick Lam 946478e1a7 Remove references to dead fontconfig(3) manpages in other fontconfig
manpages.
reviewed by: plam
2006-01-30 14:43:04 +00:00
Patrick Lam af7a965f94 Fix world's tiniest typo in code example.
reviewed by: plam
2006-01-30 04:51:22 +00:00
Patrick Lam 30c4189deb Fix global cache reads of subdirectories.
reviewed by: plam
2006-01-30 04:47:17 +00:00
Patrick Lam 971cf18018 Add documentation for FcConfigNormalizeFontDir.
Write directory information to global caches to fix make check (reported by
    Ronny V. Vindenes). This changes the global cache format again.
2006-01-30 04:27:53 +00:00
Patrick Lam 97293e07dd Move FcConfigNormalizeFontDir call so that it doesn't result in infinite
recursion (reported by Ronny V. Vindenes).
2006-01-27 05:47:59 +00:00
Patrick Lam 3cf9f5cec3 Add a couple of missing normalizations to make fc-cache work right; only
scan subdirectories once.
2006-01-27 00:27:37 +00:00
Patrick Lam 4073203deb Don't crash on non-existant directories in global cache.
reviewed by: plam
2006-01-26 16:11:41 +00:00
Patrick Lam f468f568b4 Stop trampling the directory name when writing out caches. (with Mike
Fabian:) Beef up FcConfigNormalizeFontDir to scan subdirs when
    necessary. Don't scan directories that can't be normalized.
2006-01-26 16:09:12 +00:00
Patrick Lam 575a37b797 Fix additional memory leaks reported by Ronny V. Vindenes: don't invoke
FcValueSave on hashed static strings in FcPatternAddWithBinding.
Add another st_dev check in FcDirCacheOpen.
2006-01-25 14:52:49 +00:00
Patrick Lam 16a71eff3e Treat zh-hk fonts differently from zh-tw fonts. This patch may cause
fontconfig to treat A-X fonts differently from A-Y fonts; please mail
    the fontconfig list if this causes any problems.
reviewed by: plam
2006-01-25 02:54:37 +00:00
Patrick Lam 6f9fcb5186 Fix memory leaks reported by Ronny V. Vindenes. 2006-01-25 02:33:46 +00:00
Patrick Lam 986e35979e Fix for unaligned memory accesses.
reviewed by: plam
2006-01-19 19:20:30 +00:00
Patrick Lam 58bdd29619 Properly order the FcConfigAddFontDir and FcConfigNormalizeFontDir calls to
avoid crashes.
reviewed by: plam
2006-01-18 15:41:15 +00:00
Patrick Lam eadadf489a Fix segfault when consuming zero-length caches in fc-cat (which has no
config, so FcConfigAddFontDir shouldn't be called.)
2006-01-15 05:31:58 +00:00
Patrick Lam 8a0b0ed6d0 Compare device numbers as well as inodes. Always normalize directory names
before comparing them.
Allocate extra space for appended '/' in directory name.
reviewed by: plam
2006-01-14 21:23:03 +00:00
Patrick Lam df3efc11a9 Explicitly add font dirs to config.fontDirs even if they're empty. Set
current config in fc-cache.c. Fix treatment of cache directory as read
    from cache file; don't use string equality to determine if we have the
    right file, use inode equality.
2006-01-10 13:15:05 +00:00
Patrick Lam cd9bca6970 Normalize font dirs by using the form, as given in fonts.conf, and recorded
in FcConfig's fontDirs string set, as canonical.
Actually update config.fontDirs as font directories are scanned.
2006-01-09 13:58:04 +00:00
Patrick Lam a6d3757d98 Fix matching bug when multiple elements match; don't use the sum of all
scores, but the best score.
Also more perf opts, e.g. evaluate best over all font sets rather than on a
    per-set basis (and other changes).
2006-01-08 10:58:05 +00:00
Patrick Lam 05a98eaf4b Properly skip past dir caches that contain zero fonts (as occurs in global
caches.) Reported by Mike Fabian.
2006-01-08 10:50:51 +00:00
Patrick Lam 5fe09702f4 Print out full pathname in fc-match -v as well. Reported by Frederic
Crozat.
Fix bug where fc-match crashes when given __DUMMY__ property to match on.
(I added the __DUMMY__ string to enable callers of FcObjectToPtrLookup to
    distinguish an error return from a successful return. -PL)
reviewed by: plam
2006-01-07 06:36:24 +00:00
Patrick Lam c60ec7cc6d Add self to AUTHORS list.
Minor change to global cache file format to fix fc-cat bug reported by
    Frederic Crozat, and buglet with not globally caching directories with
    zero fonts cached.
2006-01-05 15:12:22 +00:00
Patrick Lam 52ac91f7c1 Fix double-free which occurs because FcValueCanonicalize doesn't create an
extra copy of the returned value, it only canonicalizes it.
reviewed by: plam
2006-01-02 17:20:23 +00:00
Patrick Lam cea78a8791 Fix version of .cache file (currently 1 -> currently 2). Reported by Jim
Osborn.
2006-01-02 17:18:22 +00:00
Patrick Lam ebc157f9a1 Shut up GCC warnings on amd.
reviewed by: plam
2005-12-21 20:00:20 +00:00
Patrick Lam 19ea60bc7c Avoid check on _fcBankId nullness and fix case where it used to crash. 2005-12-21 05:37:10 +00:00
Patrick Lam 3bfae75d44 Bump version to 2.3.93.
Use open instead of fopen (requested by Phil Race for Sun).
src/fccache.c (FcDirCacheWrite);
Fix GCC4 warning and Makefile brokenness for /var/cache/fontconfig dir.
2005-12-21 03:31:19 +00:00
Patrick Lam 6f767cec49 Restore code to skip over PCF fonts that have no encoded characters. (We
guess that a font is PCF by presence of the PIXEL_SIZE BDF property.)
2005-12-20 20:35:47 +00:00
Patrick Lam ec760b178a Read and write the original location as a fallback for the hashed cache
file locations. This is mostly for users to be able to have
    per-directory cache files.
2005-12-12 20:45:54 +00:00
Patrick Lam 83b6739035 Improve error message when fc-cache can't write the cache. Add missing
slash. Reported by Behdad. Incorporate Behdad's patch to create
    /var/cache/fontconfig when appropriate.
2005-12-12 13:46:45 +00:00
Patrick Lam 368104c381 Fix crash reported by Frederic Crozat when using libxml2.
reviewed by: plam
2005-12-12 13:20:41 +00:00
Patrick Lam ea44e21841 Migrate cache files from fonts directories to /var/cache/fontconfig. This
helps make fontconfig FHS-compliant, but requires that all caches get
    rebuilt.
Also, autogen.sh now needs the additional parameter
--localstatedir=/var.
2005-12-09 16:36:45 +00:00
Patrick Lam 204da5a8b8 Because we've changed FcPatternAddString to use FcStrStaticName and not
FcValueSave, explicitly handle the case of a null string.
2005-12-08 05:54:27 +00:00
Patrick Lam 982b598278 Fix warnings. 2005-12-07 03:55:25 +00:00
Patrick Lam c6103dfb22 Don't assign types to user object names. 2005-12-06 18:57:43 +00:00
Patrick Lam 9ede93f1dc Don't free strings that have been returned from FcStrStaticName. 2005-12-05 16:08:01 +00:00
Patrick Lam 6059daeddb Add codepath for reading global cache files as well. 2005-12-01 07:12:45 +00:00
Patrick Lam 2c6fead73f Add config file for Persian fonts from Sharif FarsiWeb, Inc.
reviewed by: plam
2005-12-01 06:27:07 +00:00
Patrick Lam cb6d97eb1b Only add a config file to the set of config files once.
reviewed by: plam
2005-11-30 22:13:21 +00:00
Patrick Lam 93a27747a4 src/fcint.h (FcCacheBankToIndex);
Fix segfault by guarding array dereference.
2005-11-29 15:04:06 +00:00
Patrick Lam b8948e8542 Refactor FcCacheBankToIndex into an inlineable part (in fcint.h) which
checks the front of the list and a non-inlineable part which finds and
    moves the appropriate element to the front of the list.
reviewed by: plam
2005-11-29 14:57:10 +00:00
Patrick Lam 9fad72abaf Make the perf guys hate me a bit less: hoist the directory-name
FcConfigAcceptFont check for cached fonts up to directory cache read
    time, rather than running it for each font.
2005-11-29 06:23:00 +00:00
Patrick Lam 51af050992 Don't make FcPatternFindFullFname available to fccfg, it's not really safe.
Instead go through FcPatternGetString (sorry, perf guys.) Also, use
    globs for dirs as well.
2005-11-29 06:09:18 +00:00
Patrick Lam e0421d0289 Fix segfault. 2005-11-29 00:21:05 +00:00
Patrick Lam ced3f0a0ab Fix problem dating back at least to 2.3.2 where globs weren't being applied
to patterns loaded from a cache.
Fix some obvious spelling mistakes.
2005-11-29 00:14:42 +00:00
Patrick Lam 1ed98a0c87 Stephan Kulow <coolo@suse.de> reviewed by: plam
Don't kill all fonts during match (oops!)
2005-11-28 10:54:11 +00:00
Patrick Lam 200a44fed0 Fix incorrect merge.
reviewed by: plam
2005-11-26 05:05:14 +00:00
Patrick Lam cbe1df8150 Don't do random matching when bad objects are passed into
FcCompareValueList.
2005-11-25 16:33:58 +00:00
Patrick Lam 81fe99fdd0 Rename fcpatterns, fcpatternelts, fcvaluelists to _fcPatterns,
_fcPatternElts, _fcValueLists for consistency.
2005-11-25 16:04:44 +00:00
Patrick Lam d854eaf8a9 Pass the FcObjectPtr to FcCompareValueList, not the char * (perf).
reviewed by: plam
2005-11-25 15:54:24 +00:00
Patrick Lam 61571f3f2e Pass around FcCache *s to the Unserialize functions for extra consistency
(and less overhead, for what that's worth).
2005-11-25 15:50:34 +00:00
Patrick Lam 9ab79bdfb7 Inline the *PtrU functions to gain perf. Remove unneeded params for the
FcCompare* functions.
reviewed by: plam
2005-11-25 03:00:51 +00:00
Patrick Lam 1c9fdccab9 Move FC_BANK_DYNAMIC, FC_BANK_FIRST to internal header.
Check for type validity during FcPatternAddWithBinding, don't verify type
    in FcFontMatch, don't call FcCanonicalize here (which always does a
    deep copy).
reviewed by: plam
2005-11-24 21:40:20 +00:00
Patrick Lam 4f8b266fd9 Make FcCompareString and FcCompareFamily less expensive. Only add a value
for FC_FAMILY if the proposed value is a string.
reviewed by: plam
2005-11-24 20:20:26 +00:00
Patrick Lam b97a34b592 Inline FcDebug invocations and only initialize once, in FcInit*. Improve
debug msg in FcPatternPrint.
reviewed by: plam
2005-11-24 19:38:05 +00:00
Patrick Lam f7c4624f56 2005-11-23 Frederic Crozat <fcrozat@mandriva.com>: reviewed by: plam
Minor code warning cleanups.
2005-11-23 16:36:26 +00:00
Patrick Lam 435fc66073 2005-11-23 Frederic Crozat <fcrozat@mandriva.com>: reviewed by: plam
Make getopt_long accept -s parameter to fc-match as well.
2005-11-23 15:32:36 +00:00
Patrick Lam adac22f290 Manually perform inlining & partial redundancy elimination to reduce calls
to FcValueListPtrU.
Only invoke strlen() when really necessary.
reviewed by: plam
reviewed by: plam
2005-11-22 04:46:55 +00:00
Patrick Lam 8c24aa6b45 Get rid of the use of freetype internal headers in fcfreetype.c, since
those headers will go away with freetype 2.2. Replace with public
    domain ftglue code from pango. Note that the patch removes some extra
    error checking in FT_Get_BDF_Property() and comments out the skipping
    of empty pcf fonts.
reviewed by: plam
2005-11-19 22:38:39 +00:00
Patrick Lam 8ebf7725a8 Get rid of the use of freetype internal headers in fcfreetype.c, since
those headers will go away with freetype 2.2. Replace with public
    domain ftglue code from pango. Note that the patch removes some extra
    error checking in FT_Get_BDF_Property() and comments out the skipping
    of empty pcf fonts.
reviewed by: plam
2005-11-19 22:32:13 +00:00
Patrick Lam a151acedc0 Further fix of patch from 2005-11-04: miscounted numbers count
(numbers_count); didn't strip duplicate numbers (langBankNumbers); and
    leafidx_offset and numbers_offset in fcLangCharSets are wrong.
Removed leafidx_count and numbers_count since they are the same and
    replaced them with offset_count.
reviewed by: plam
2005-11-19 16:24:53 +00:00
Patrick Lam 8f2a807810 Don't crash when fc-cat invoked with no arguments.
Fix invalid read access caused by premature free and GCC4 warnings in
    libxml2 codepath.
reviewed by: plam
reviewed by: plam
2005-11-18 20:32:30 +00:00
Patrick Lam 82912b062b List iteration not needed in FcConfigValues, since it's building up the
list itself; we can just strip FcVoid elements during construction.
reviewed by: plam
2005-11-18 04:21:10 +00:00
Patrick Lam 38b2ecad5a Fix crash on invalid constants in config files (forgot to update a pointer
upon list iteration.)
2005-11-17 16:46:07 +00:00
Patrick Lam f28472fdb4 Complain about invalid constants in config files.
reviewed by: plam
2005-11-17 16:17:05 +00:00
Patrick Lam 1c5b6345b9 Don't add current_arch_start more than once.
Fix ordering of ALIGN with respect to saving block_ptr; add another ALIGN
    to fcfs.c.
reviewed by: plam
2005-11-17 15:43:39 +00:00
Patrick Lam 8e351527bb src/fccache.c (FcDirCacheProduce)
Fix case where alignment bytes bumped up metadata->count causing
    unwarranted failures to write cache files. (Reported by Stephan Kulow).
2005-11-16 17:49:01 +00:00
Patrick Lam 7fd7221e68 Add *NeededBytesAlign(), which overestimates the padding which is later
added by the new ALIGN macro. Fix alignment problems on ia64 and s390
    by bumping up block_ptr appropriately. (Earlier version by Andreas
    Schwab).
Use sysconf to determine proper PAGESIZE value; this appears to be
    POSIX-compliant. (reported by Andreas Schwab)
reviewed by: plam
2005-11-16 15:55:17 +00:00
Patrick Lam 82f35f8bb4 Fix bug 2878 (excessive relocations at startup for charsets, reported by
Ross Burton): fc-lang/fc-lang now creates the static form of the
    langset, not the dynamic form, so that the charsets should now be in
    .rodata.
2005-11-04 19:31:26 +00:00
Patrick Lam 50544b13c1 Add test for validity of directory caches that somehow got lost (reported
by make distcheck).
2005-11-04 16:48:32 +00:00
Patrick Lam e6d3e251ee Bump version to 2.3.92. 2005-11-04 06:17:00 +00:00
Patrick Lam ea9726b620 Fix argument ordering problem in call to FcPatternTransferFullFname. 2005-11-03 04:45:57 +00:00
Patrick Lam 7358dae49b Fix warnings and embarrassing double-free error. 2005-11-03 04:23:22 +00:00
Patrick Lam efa9f2bd07 Change the rule for artificial emboldening in fonts.conf.in. This enables
the support for artificial emboldening included in cairo.
reviewed by: plam
2005-11-02 15:57:36 +00:00
Patrick Lam d7b3ac6367 Don't zero out full names for FC_REF_CONSTANT fonts; also, duplicate full
names when transferring, and free full names when freeing the
    associated font. Reported by Jinghua Luo.
2005-11-02 15:29:53 +00:00