permitting cache files to be stored in font dirs. Bump cache magic.
Don't include /fonts.cache-2 in cache hash construction.
reviewed by: Patrick Lam <plam@mit.edu>
Check if pattern is not null before using it (Coverity defect #1883).
Fix memory leak with hash collision (Coverity defect #1829).
Fix memory leak when bail cases (Coverity defect #1828).
Don't leak directory name (Coverity defect #1827).
reviewed by: plam
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
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
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.
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.
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.
helps make fontconfig FHS-compliant, but requires that all caches get
rebuilt.
Also, autogen.sh now needs the additional parameter
--localstatedir=/var.
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
fully-qualified font names for clients' benefit. Clients only pay for
the font names once they request the FC_FILE property from an
FcPattern, but the font name is malloc'd at that point (i.e. not
mmapped: that's impossible, since it may vary between machines.)
Clients do have to pay for a copy of the path name per cache file.
Note that FcPatternGetString now does some rewriting if you ask for an
FC_FILE, appending the pathname as appropriate.
fc-cache once per cached architecture; add some documentation to the
FcCache structure.
Make fc-cache write out fonts.cache-2 files for directories with no fonts
(i.e. only subdirectories).
that aren't hardcoded into fontconfig, but generated by fontconfig
clients: keep another array of user-defined objects (indexed after the
built-in objects).
Fix compilation warning (uninitialized variable).
Add comment.
data format. Also match subdirectories when consuming cache
information. Also check dates for global cache: a dir is out of date if
it is newer than the global cache; scan it manually if that's the case.
Save subdirectory names in cache files to save time. This completely
restores the original fontconfig API, BTW. Note that directories
without fonts don't get a cache file; but then how many files would it
have in that directory...
*Serialize no longer mutates original FcPatterns, it creates a new copy
in the supplied buffer. Fix thinkos in global cache freeing and in
FcCacheSkipToArch.
The global cache now uses the same mmap-based cache infrastructure as the
per-directory caches. Furthermore, the global cache is automatically
updated (if possible) whenever fontconfig is used. Rip out remnants of
the old cache infrastructure.
probably all right to use the global cache as it was previously and
just store filenames and font info, as long as no mmap cache exists in
the directory. Of course, if an mmap cache exists, use that instead.
If a directory cache does not exist or is invalid, load the fonts for just
that directory using the old codepath.
Fix premature free of the FcPatterns belonging to the FcFontSet which we
create from the mmapped files.
and distribute bytes for each directory from a single malloc for that
directory. Store pointers as differences between the data pointed to
and the pointer's address (s_off = s - v). Don't serialize data
structures that never actually get serialized. Separate strings used
for keys from strings used for values (in FcPatternElt and FcValue,
respectively). Bump FC_CACHE_VERSION to 2.
cache. Add *Read and *Write procedures which mmap in and write out the
fontconfig data structures to disk. Currently, create cache in /tmp,
with different sections for each architecture (as returned by uname's
.machine field. Run the fc-cache binary to create a new cache file;
fontconfig then uses this cache file on subsequent runs, saving lots of
memory. Also fixes a few bugs and leaks.
This patch allows the fundamental fontconfig data structures to be
serialized. I've converted everything from FcPattern down to be able to
use *Ptr objects, which can be either static or dynamic (using a union
which either contains a pointer or an index) and replaced storage of
pointers in the heap with the appropriate *Ptr object. I then changed
all writes of pointers to the heap with a *CreateDynamic call, which
creates a dynamic Ptr object pointing to the same object as before.
This way, the fundamental fontconfig semantics should be unchanged; I
did not have to change external signatures this way, although I did
change some internal signatures. When given a *Ptr object, just run *U
to get back to a normal pointer; it gives the right answer regardless
of whether we're using static or dynamic storage.
I've also implemented a Fc*Serialize call. Calling FcFontSetSerialize
converts the dynamic FcFontSets contained in the config object to
static FcFontSets and also converts its dependencies (e.g. everything
you'd need to write to disk) to static objects. Note that you have to
call Fc*PrepareSerialize first; this call will count the number of
objects that actually needs to be allocated, so that we can avoid
realloc. The Fc*Serialize calls then check the static pointers for
nullness, and allocate the buffers if necessary. I've tested the
execution of fc-list and fc-match after Fc*Serialize and they appear to
work the same way.
Add detection of iconv
Document new selectfont elements
Switch to UTF-8 in comment
Add fullname, and family/style/fullname language entries
Respect selectfont/*/glob
Add support for selectfont
Add multi-lingual family/style/fullname support
Expose FcListPatternMatchAny (which selectfont/*/pattern uses)
Add new FcPatternRemove/FcPatternAppend. FcObjectStaticName stores computed
pattern element names which are required to be static.
On Windows with gcc (a.k.a. mingw) build as a DLL.
We don't want to hardcode the fonts.conf file location in the DLL, so we
look up the DLL location at run-time in a DllMain() function. The
fonts.conf location is deduced from that.
The colon can't be used as path separator on Windows, semicolon is used
instead. File path components can be separated with either slash or
backslash. Absolute paths can also begin with a drive letter.
Add internal function FcStrLastSlash that strrchr's the last slash, or
backslash on Windows.
There is no link() on Windows. For atomicity checks, mkdir a lock directory
instead.
In addition to HOME, also look for USERPROFILE.
Recognize the special font directory token WINDOWSFONTDIR, to use the
system's font directory.
Remove the fontconfig-def.cpp that was obsolete. Add fontconfig.def(.in),
without internal functions.
Add a fontconfig-zip(.in) script, used to build a binary distribution.