Commit Graph

54 Commits

Author SHA1 Message Date
Mike Frysinger 6f020161e8 FcStrPlus: optimize a little
We've already calculated the lengths of these strings, so re-use those
values to avoid having to rescan the strings multiple times.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-02-21 14:09:51 -05:00
Behdad Esfahbod 5aaf466d38 Cleanup copyright notices to replace "Keith Packard" with "the author(s)" 2010-11-10 16:45:42 -05:00
Behdad Esfahbod 594dcef0f3 Remove all training whitespaces 2010-04-12 12:19:05 -04:00
Behdad Esfahbod 4d13536db4 [fcstr] Remove unused variable 2009-06-24 13:52:09 -04:00
Behdad Esfahbod 3074a73b41 Replace 'KEITH PACKARD' with 'THE AUTHOR(S)' in license text in all files 2009-03-13 17:59:28 -04:00
Behdad Esfahbod de69ee14d3 [fcxml.c] Embed a static 64-byte attr buffer in FcPStack
Reduces number of mallocs called from FcConfigSaveAttr in my small test
from 160 down to 6.
2009-03-12 13:14:38 -04:00
Behdad Esfahbod 3ed70071cd [fcstr,fcxml] Don't copy FcStrBuf contents when we would free it soon
We can simply NUL-terminate the buffer and use it.  Reduces number of
mallocs called from FcStrBufDone in my small test from 631 down to 66.
2009-03-12 13:14:37 -04:00
Behdad Esfahbod 7d35c11b33 [fcstr.c] Embed a static 64-byte buffer in FcStrBuf
Reduces number of mallocs called from FcStrBufChar in my small test
from 900 down to 6.
2009-03-12 13:14:37 -04:00
Behdad Esfahbod dccbbe83ef [FcStrBuf] better handle malloc failure
If buffer has failed allocation, return NULL when done.
2009-02-15 13:40:28 -08:00
Behdad Esfahbod f9feb587fa [win32] Do not remove leading '\\' such that network paths work
Raised by Diego Santa Cruz.
2009-02-15 13:40:24 -08:00
Behdad Esfahbod e62058abb9 [win32] Fix usage of GetFullPathName()
Diego Santa Cruz pointed out that we are using that API wrongly.
The forth argument is a pointer to a pointer.  Turns out we don't
need that arugment and it accepts NULL, so just pass that.
2009-02-15 13:40:24 -08:00
Behdad Esfahbod 317b849215 Replace RCS Id tags with the file name 2009-02-13 16:53:55 -08:00
Behdad Esfahbod 1bcf4ae5f2 When canonizing filenames, squash // and remove final / (#bug 16286)
The fact that we now drop final slashes from all filenames without
checking that the file name represents a directory may surprise some,
but it doesn't bother me really.
2009-02-13 16:53:54 -08:00
Keith Packard 13a14cbf56 Fix a few memory tracking mistakes.
The built-in memory tracking code in fontconfig relies on a lot of manual
function call tracking. A pain, but it helps debug leaks.
2008-05-04 01:26:40 -07:00
Behdad Esfahbod fc990b2e86 Update CaseFolding.txt to Unicode 5.1.0 2007-10-25 14:20:06 -07:00
Keith Packard 4ee9ca6786 Match 'ultra' on word boundaries to detect ultra bold fonts. (bug 2511)
Added FcStrContainsWord to detect strings on word boundaries.
2007-10-25 14:00:15 -07:00
Keith Packard b5803016d7 FcStrCanonAbsoluteFilename should be static. 2006-11-12 17:15:55 -08:00
Han-Wen Nienhuys 1de7a4cc09 FcStrCanonFileName buggy for mingw. (bug 8311)
FcStrCanonFileName checks whether s[0] == '/', and recurses if not.

This only works on POSIX. On dos, this crashes with a stack overflow.

The patch attached splits this functionality in two functions
(FcStrCanonAbsoluteFilename) and uses GetFullPathName on windows to get an
absolute path.  It also fixes a number of other issues. With this patch,
LilyPond actually produces output on Windows.
2006-09-17 14:34:46 -07:00
Keith Packard 23816bf9ac Eliminate .so PLT entries for local symbols. (thanks to Arjan van de Ven)
Using a simple shell script that processes the public headers, two header
files are constructed that map public symbols to hidden internal aliases
avoiding the assocated PLT entry for referring to a public symbol.

A few mistakes in the FcPrivate/FcPublic annotations were also discovered
through this process
2006-09-05 02:24:01 -07:00
Keith Packard e3b771a63e Using uninitialized (and wrong) variable in FcStrCopyFilename.
A typo from the change in where filename canonicalization occurs.
2006-09-02 23:09:44 -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 7ce1967331 Rework cache files to use offsets for all data structures.
Replace all of the bank/id pairs with simple offsets, recode several
data structures to always use offsets inside the library to avoid
conditional paths. Exposed data structures use pointers to hold offsets,
setting the low bit to distinguish between offset and pointer.

Use offset-based data structures for lang charset encodings; eliminates
separate data structure format for that file.

Much testing will be needed; offsets are likely not detected everywhere in
the library yet.
2006-08-30 04:16:22 -07:00
Keith Packard 0d9e31c810 Eliminate ./ and ../ elements from font directory names when scanning.
FcStrCanonFilename eliminates ./ and ../ elements from pathnames through
simple string editing. Also, relative path names are fixed by prepending the
current working directory.
2006-08-27 23:40:51 -07:00
Patrick Lam 31b7e6d7f5 2006-04-27 Paolo Borelli (pborelli@katamail.com) reviewed by: plam
Make FcStrCopy slightly more efficient.
2006-04-28 07:00:25 +00:00
Patrick Lam 0037aad501 Keith Packard <keithp@keithp.com>
Reduce transient memory usage during config file parsing by allocating
    smaller buffers (64 seems to be a magic number).
2006-04-27 08:13:45 +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 b023dbd384 Eliminate unused vars reported by Intel's compiler.
reviewed by: plam
2006-02-21 15:40:18 +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 8245771d5a Merge with HEAD and finish the GCC 4 cleanups (no more warnings!) 2005-09-11 02:16:09 +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 479f551f6d Document ASCII limitations of Fc character conversion macros
Fix off-by-one error in utf-8 case walking code. Add FcStrDowncase (useful
    for testing case conversion functions)
2004-12-29 19:37:14 +00:00
Keith Packard 192296d852 Adopt some RedHat suggestions for standard font configuration.
Add new helper program 'fc-case' to construct case folding tables from
    standard Unicode CaseFolding.txt file
Re-implement case insensitive functions with Unicode aware versions
    (including full case folding mappings)
2004-12-29 09:15:17 +00:00
Keith Packard 46b51147d1 Change files from ISO-Latin-1 to UTF-8 2004-12-07 01:14:46 +00:00
James Su d4d1e8bc60 Fix "contains" op for strings and langsets. 2003-05-28 01:34:38 +00:00
Keith Packard 11fec41c0e Grub through style to find weight/slant/width values when other techniques
fail
2003-05-02 01:11:53 +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 d93fb00e8d optimize string compares even more 2003-03-05 06:09:36 +00:00
Keith Packard 4bd4418ab5 Change RCS tag 2003-03-05 05:51:27 +00:00
Keith Packard ff3f1f98ed Switch back to -version-info for fontconfig as its at minor 0. Add
--system-only to fc-cache. Fix FC_VERSION to match product version
    rather than .so version
2003-03-02 19:12:23 +00:00
Keith Packard b2b6903259 Make FcStrCmpIgnoreCase a bit faster 2003-02-12 18:20:04 +00:00
Keith Packard dda27aa9ee Avoid crash when $HOME is not set 2003-02-06 19:30:32 +00:00
David Dawes 45fb31aa91 632. Finish off the UTF-16 APIs in Xft, and fix the UTF-16 conversion code
in fontconfig (#A.1411, Keith Packard, Jungshik Shin).
2002-12-14 01:59:38 +00:00
Keith Packard 9dac3c5945 More complete memory tracking. Install always overwrites header files 2002-08-31 22:17:32 +00:00
Keith Packard 0f9a306e71 Add const to a bunch of string APIs 2002-08-24 20:08:53 +00:00
Keith Packard d8d7395877 Reimplement FC_LANG as FcTypeLang, freeze patterns, other cleanup 2002-08-22 07:36:45 +00:00
Keith Packard 69937bd941 Add some Utf16 support, extract font family and style names from name table
for sfnt fonts
2002-07-13 05:43:25 +00:00
Keith Packard 82f4243f22 Switch to RFC 3066 based lang names 2002-07-06 23:47:44 +00:00
Keith Packard bc9469baad Optimize after profiling. Fix FcStrCmp to return correct sign 2002-05-29 22:07:33 +00:00