Commit Graph

29 Commits

Author SHA1 Message Date
Patrick Lam eb0cf67144 src/fcint.c
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.
2005-08-30 05:55:13 +00:00
Patrick Lam 2dbe759762 Emit and verify machine signature (sizeof (stuff) + endianness) in cache
files. Fix bugs in FcCacheBankToIndex.
2005-08-28 05:20:23 +00:00
Patrick Lam 1b7be37790 Reinstate the old global cache code. For the forseeable future, it's
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.
2005-08-25 07:38:02 +00:00
Patrick Lam 4262e0b385 Overhaul the serialization system to create one mmapable file per directory
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.
2005-08-24 06:21:30 +00:00
Patrick Lam 212c9f437e #ifdef out old cache stuff, replace with first version of new mmapping
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.
2005-07-25 04:10:09 +00:00
Patrick Lam cd2ec1a940 Add functionality to allow fontconfig data structure serialization.
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.
2005-06-28 03:41:02 +00:00
Keith Packard fce87a189b Verify that every font pattern loaded from cache has both FC_FILE and
FC_FAMILY entries. Attempt to fix bug #2219.
2005-01-04 21:54:50 +00:00
Keith Packard 46b51147d1 Change files from ISO-Latin-1 to UTF-8 2004-12-07 01:14:46 +00:00
Keith Packard 4f27c1c0a3 Move existing fonts.conf to fonts.conf.bak
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.
2004-12-04 19:41:10 +00:00
Keith Packard d47c9d6efe Add filename-based accept/reject to ammend available fonts.
change FT_ENCODING_ADOBE_CUSTOM to ft_encoding_adobe_custom for older
    FreeType releases.
2003-05-07 16:13:24 +00:00
Tor Lillqvist daeed6e048 Changes for Windows:
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.
2003-03-22 21:25:34 +00:00
Keith Packard a8386abc91 Global cache time checking was using wrong file name and computing wrong
count of fonts per file
2003-03-12 22:15:39 +00:00
Keith Packard 4bd4418ab5 Change RCS tag 2003-03-05 05:51:27 +00:00
Keith Packard c4ab52dcb5 Track dirs containing fonts.cache files referenced from ~/.fonts.cache file 2003-02-13 16:42:38 +00:00
Keith Packard c8d5753c0f Dont cache directorys until theyve been scanned. Avoids losing subdir
contents. Also fixed cache hashing function (was returning constant).
    Lots of comments
2003-02-12 18:19:33 +00:00
Keith Packard e712133ca7 Was losing local cached dirs in global cache list 2002-09-26 00:16:23 +00:00
Keith Packard 9dac3c5945 More complete memory tracking. Install always overwrites header files 2002-08-31 22:17:32 +00:00
Keith Packard d8d7395877 Reimplement FC_LANG as FcTypeLang, freeze patterns, other cleanup 2002-08-22 07:36:45 +00:00
Keith Packard fa244f3d88 Various config changes plus a couple of optimizations from Owen 2002-08-19 19:32:05 +00:00
Keith Packard bb356b68ab Uninitialized member of cache structure could lead to non-updated cache
files
2002-08-06 19:00:43 +00:00
Keith Packard 327a7fd491 Rewrite global cache handling code in fontconfig to eliminate per-file
syscalls
2002-07-28 10:50:59 +00:00
Keith Packard 6f6563edb5 Add ref counting to font config patterns so that FcFontSort return values
are persistant
2002-06-19 20:08:22 +00:00
Keith Packard 179c39959c Fix autoconf build process for fontconfig 2002-05-21 17:06:22 +00:00
Keith Packard a391da8f0f Add fcatomic.c 2002-03-03 00:19:43 +00:00
Keith Packard 134f6011f3 Add new FcAtomic datatype for config file locking 2002-03-01 22:06:30 +00:00
Keith Packard 9c8e07f195 Port Xft1 to fontconfig 2002-03-01 01:00:54 +00:00
Keith Packard aae6f7d487 Eliminate const in FcPatternGetString; too hard. Add FcCharSetCoverage to
enumarate Unicode coverage efficiently
2002-02-19 07:50:44 +00:00
Keith Packard ccb3e93b27 fontconfig library: build fixes and compiler warning fixes 2002-02-15 06:01:28 +00:00
Keith Packard 24330d27f8 Initial revision 2002-02-14 23:34:13 +00:00