Commit Graph

95 Commits

Author SHA1 Message Date
Behdad Esfahbod 1439c8f21a Handle -h and --help according to GNU Coding Standards (#17104)
Added -h instead of -?.  And upon -h and --help, write usave to stdout
instead of stdin, and return 0 instead of 1.

-? still works like before as that's what getopt returns upon unknown
arguments.
2009-02-13 16:53:59 -08:00
Behdad Esfahbod e690fbb20e Get rid of $Id$ tags 2009-02-13 16:53:57 -08:00
Behdad Esfahbod 77c0d8bce8 Add fc-query (#13019) 2009-02-13 16:53:56 -08:00
Behdad Esfahbod d5b6085c3e Update man pages 2009-02-13 16:53:56 -08:00
Behdad Esfahbod 317b849215 Replace RCS Id tags with the file name 2009-02-13 16:53:55 -08:00
Keith Packard c6c9400d67 Call FcFini to make memory debugging easier
FcFini frees all libary data structures so valgrind should report 0
allocations in use when the program exits.
2008-05-04 01:25:04 -07:00
Eric Anholt ba88459913 Fix build with !ENABLE_DOCS and no built manpages. 2008-04-18 11:52:41 -07:00
Keith Packard 32fed45727 Eliminate references to freetype from utility Makefile.am's
The utility programs don't use any freetype interfaces, so they
don't need to directly refer to freetype headers or libraries.
2008-01-08 12:34:19 -08:00
Tor Lillqvist 8a3dc4880c Workaround for stat() brokenness in Microsoft's C library (bug 8526)
Fix a couple of longstanding problems with fontconfig on Windows that
manifest themselves especially in GIMP. The root cause to the problems is in
Microsoft's incredibly stupid stat() implementation. Basically, stat()
returns wrong timestamp fields for files on NTFS filesystems on machines
that use automatic DST switching.

See for instance http://bugzilla.gnome.org/show_bug.cgi?id=154968 and
http://www.codeproject.com/datetime/dstbugs.asp

As fccache.c now looks at more fields in the stat struct I fill in them all.
I noticed that fstat() is used only on a fd just after opening it, so on
Win32 I just call my stat() replacement before opening instead...
Implementing a good replacement for fstat() would be harder because the code
in fccache.c wants to compare inode numbers. There are no (readily
accessible) inode numbers on Win32, so I fake it with the hash of the full
file name, in the case as it is on disk. And fstat() doesn't know the full
file name, so it would be rather hard to come up with a inode number to
identify the file.

The patch also adds similar handling for the cache directory as for the fonts
directory: If a cachedir element in fonts.conf contains the magic string
"WINDOWSTEMPDIR_FONTCONFIG_CACHE" it is replaced at runtime with a path under
the machine's (or user's) temp folder as returned by GetTempPath(). I don't
want to hardcode any pathnames in a fonts.conf intended to be distributed to
end-users, most of which who wouldn't know how to edit it anyway. And
requiring an installer to edit it gets complicated.
2007-11-13 16:41:55 -08:00
Keith Packard 9b84ecff92 Don't check cache file time stamps when cleaning cache dir.
Cache file mtime is meaningless now that the directory time is encoded in
the cache.
2007-11-03 21:57:51 -07:00
Keith Packard 43d0454597 Distribute man source files for command line programs (bug 9678).
For systems on whch DOCBOOK is unavailable, distribute command line program
manual pages in .man format.
2007-10-25 01:26:09 -07:00
Keith Packard 2a3e3c442d Have fc-cache remove invalid cache files from cache directories.
Old cache file versions, or corrupted cache files should be removed when
cleaning cache directories with fc-cache. This only affects filenames which
match the fontconfig cache file format, so other files will be left alone.
2007-10-18 05:07:29 -07:00
Keith Packard 238489030a Don't use X_OK bit when checking for writable directories (bug 12438)
Some mingw versions have broken X_OK checking; instead of trying to work
around this in a system-depedent manner, simply don't bother checking for
X_OK along with W_OK as such cases are expected to be mistakes, and not
sensible access control.
2007-10-18 05:04:39 -07:00
Keith Packard 2b0d3d8af5 Verbose message about cleaning directories was imprecise
Non-existent directories are now described as 'non-existent' instead of
'unwritable'.
2007-10-18 05:01:41 -07:00
Keith Packard 50124d1e48 Improve verbose messages from fc-cache.
fc-cache would say 'skipping: %d fonts, %d dirs' or 'caching: %d fonts, %d
dirs', which could easily mislead the user. Add 'existing cache is valid' or
'new cache contents' to these messages to explain what it is doing.
2007-10-18 04:58:31 -07:00
Keith Packard e12f718f65 Remove unneeded call to access(2) in fc-cache.
This call was followed by a call to stat(2) which provided the necessary
information. This call to access(2) was necessary when cache files were
stored in the font directory as that would check for write permission
correctly.
2007-10-18 04:54:51 -07:00
Mike FABIAN 0334e5a294 Do not clean cache files for different architectures
Use filenames to clean cache files for current architecture only. This is
sufficient as cache files live in their own directory where filenames are
under fontconfig control.
2006-10-27 10:26:50 -07:00
Keith Packard b190ad9da4 Add warning flags to fc-cache build. Clean up warnings in fc-cache.
Looks like the last directory in the project which didn't use $(WARN_CFLAGS)
for some reason. Adding that found the usual collection of char * vs FcChar8
* issues (why, oh why is FcChar8 not just char...)
2006-09-13 18:55:45 -07:00
Keith Packard 4984242e36 Hide private functions in shared library. Export functionality for utilities.
Borrowing header stuff written for cairo, fontconfig now exposes in the
shared library only the symbols which are included in the public header
files. All private symbols are hidden using suitable compiler directives.

A few new public functions were required for the fontconfig utility programs
(fc-cat and fc-cache) so those were added, bumping the .so minor version number
in the process.
2006-09-04 00:47:07 -07:00
Keith Packard 34227592c2 Remove all .cvsignore files 2006-09-03 16:27:09 -07:00
Keith Packard 9b511b2905 Unify directory canonicalization into FcStrAddFilename.
Instead of making filename canonicalization occur in multiple places, it
occurs only in FcStrAddFilename now, as all filenames pass through that
function at one point.
2006-09-02 14:52:37 -07:00
Keith Packard 1741499e23 Fix memory leaks in fc-cache directory cleaning code.
valgrind found a few leaks in the new cache cleaning code.
2006-09-01 12:07:10 -07:00
Keith Packard bc5e487f2a Pass directory information around in FcCache structure. Freeze charsets.
Instead of passing directory information around in separate variables,
collect it all in an FcCache structure. Numerous internal and tool
interfaces changed as a result of this.

Charsets are now pre-frozen before being serialized. This causes them to
share across multiple fonts in the same cache.
2006-09-01 01:15:14 -07:00
Keith Packard bf0c80fc49 Change $(pkgcachedir) to $(fc_cachedir) in fc-cat and fc-cache Makefile.am
make distcheck caught this bug; the effect of 'make uninstall'
would have been to execute 'rm -rf /', somewhat less that desirable.
2006-08-31 18:14:45 -07:00
Keith Packard f57783d2e9 Revert ABI changes from version 2.3
Accidental ABI changes and additions were discovered by looking at the
differences in fontconfig.h. All of those have been reverted.
2006-08-31 14:38:18 -07:00
Keith Packard d8ab9e6c42 Automatically remove invalid cache files.
Cache files for missing or more recently modified directories are
automatically removed at the end of every fc-cache run.
2006-08-31 09:42:49 -07:00
Keith Packard 2d3387fd72 Skip broken caches. Cache files are auto-written, don't rewrite in fc-cache.
Validate cache contents and skip broken caches, looking down cache path for
valid ones.

Every time a directory is scanned, it will be written to a cache file if
possible, so fc-cache doesn't need to re-write the cache file. This makes
detecting when the cache was generated a bit tricky, so we guess that if the
cache wasn't valid before running and is valid afterwards, the cache file
was written.

Also, allow empty charsets to be serialized with null leaves/numbers.

Eliminate a leak in FcEdit by switching to FcObject sooner.

Call FcFini from fc-match to make valgrind happy.
2006-08-30 21:59:53 -07:00
Keith Packard af180c4037 Fix up fc-cache and fc-cat for no global cache changes.
fc-cache and fc-cat use internal (fcint.h) APIs that have
changed with the elimination of the global cache.
2006-08-27 22:24:39 -07:00
Keith Packard 00f059e930 Eliminate global cache. Eliminate multi-arch cache code.
With the removal of the in-directory cache files, and the addition of
per-user cache directories, there is no longer any reason to preserve the
giant global cache file. Eliminating of this unifies the cache structure
and simplifies the overall caching strategies greatly.
2006-08-27 21:53:48 -07:00
Keith Packard db50cbdaf5 Eliminate NormalizeDir. Eliminate gratuitous stat/access calls per dir.
Normalized directory names offer protection against looped directory trees
but cost enormous numbers of system calls (stat per file in the hierarchy).
Also, cache file directory name contents are validated each time the
directory is modified, don't re-validate every time the cache file is loaded
with an access and stat call.
2006-08-27 18:19:39 -07:00
Patrick Lam 7410e40bd9 2006-08-04 Keith Packard (keithp@keithp.com) reviewed by: plam
Make cache directories configurable. Simplify and correct some code which
    deals with per-directory caches.
2006-08-04 16:13:00 +00:00
Patrick Lam f045376c08 Include $(top_srcdir), $(top_srcdir)/src before anything else.
Shuffle order of includes for building out of srcdir on win32.
reviewed by: plam
2006-04-25 05:57:41 +00:00
Patrick Lam 86abd75965 LD_ADD missing dependencies for binaries. Reported by Edson Alves Pereira.
reviewed by: plam
2006-04-07 18:07:51 +00:00
Patrick Lam d6217cc6bc Patrick Lam <plam@mit.edu>
Make fontconfig compile under MinGW:
1) remove unneeded #includes;
2) make use of mmap and sysconf conditional;
3) replace rand_r by srand/rand if needed;
4) use chsize instead of ftruncate; and
5) update libtool exports file
2006-04-07 04:42:32 +00:00
Patrick Lam 392fa276dc Reduce amount of dirty rss by const'ing some data structures.
Don't fail if we can't create or remove $(pkgcachedir) i.e.
    /var/cache/fontconfig. (reported by Quanah Gibson-Mount).
reviewed by: plam
2006-04-06 04:52:21 +00:00
Patrick Lam 530e66b008 Fix the underlying cause of the below segfault (must usually call
FcDirCacheHasCurrentArch after FcDirCacheValid).
2006-02-18 18:18:07 +00:00
Patrick Lam d2c0102944 Add -r --really-force option which blows away cache files and then
regenerates them.
2006-02-16 15:36:43 +00:00
Patrick Lam 719f4b841f Don't bail if fontconfig can't remove a dir cache file. Skip the ID of a
cache file when copying. Eliminate 'source file too small' bug in
    FcDirCacheWrite.
2006-02-16 07:12:04 +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 788c4af232 Make 'make distcheck' work with automake 1.6.3.
reviewed by: plam
2006-02-05 04:11:08 +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 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 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 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 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 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 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 303bcf9b9d Revert the previous patch and commit the correct patch: I forgot a
canonicalization in FcValueListSerialize, so that it would choke on
    already-serialized input files. Duh!
2005-11-02 07:37:00 +00:00