Keith Packard [Sat, 3 Nov 2007 20:26:16 +0000 (13:26 -0700)]
Correct documentation for FcConfigUptoDate (bug 12948).
FcConfigUptoDate only checks whether files have been modified since the
configuration was created. Any changes to the configuration through the API
since then are not considered.
Keith Packard [Sat, 3 Nov 2007 20:09:01 +0000 (13:09 -0700)]
Remove fcprivate.h, move the remaining macros to fcint.h.
fcprivate.h was supposed to extend the fontconfig API for the various
fontconfig utilities. Instead, just have those utilities use the internal
fcint.h header file (which they already do), removing fcprivate.h from the
installation and hence from the defacto public API.
Keith Packard [Thu, 25 Oct 2007 08:35:32 +0000 (01:35 -0700)]
Ensure weight/slant values present even when style is supplied (bug 9313).
If the provided style value doesn't match any available font, fall back to
using the weight and slant values by ensuring that those are in the pattern.
Dwayne Bailey [Thu, 25 Oct 2007 08:16:06 +0000 (01:16 -0700)]
Add/fix *.orth files for South African languages
This adds the missing orth files for Ndebele (South) (nr), Northern Sotho
(nso), Swati (ss) and Southern Sotho (st). It also fixes the Tswana (tn)
orth file.
Keith Packard [Thu, 25 Oct 2007 04:47:40 +0000 (21:47 -0700)]
Leave generated headers out of distribution (bug 12734).
If the generated header files are included in the distribution, a build
outside of the source directory will use them. For machine-specific files,
this generates the wrong result (fcarch.h). Leaving them out of the
distribution forces them to be built.
Keith Packard [Thu, 18 Oct 2007 16:43:22 +0000 (09:43 -0700)]
Eliminate relocations for glyph name table.
Glyph names (now used only for dingbats) were using many relocations,
causing startup latency plus per-process memory usage. Replace pointers with
table indices, shrinking table size and elimninating relocations.
Keith Packard [Thu, 18 Oct 2007 16:41:00 +0000 (09:41 -0700)]
Must not insert cache into hash table before completely validating.
The cache was inserted into the hash table before the timestamps in the
cache were verified; if that verification failed, an extra pointer to the
now freed cache would be left in the hash table. FcFini would fail an
assertion as a result.
mfabian@magellan:~$ fc-match sans
Fontconfig error: "~/.fonts.conf", line 46: "mono": not a valid
integer
セグメンテーション違反です (core dumped)
mfabian@magellan:~$
Of course the above is nonsense, “mono” is no valid integer indeed.
But I think nevertheless fontconfig should not crash in that case.
The problem was caused by partially truncated expression trees caused by
parse errors -- typechecking these walked the tree without verifying the
integrity of the structure. Of course, the whole tree will be discarded
shortly after being loaded as it contained an error.
Keith Packard [Thu, 18 Oct 2007 12:05:59 +0000 (05:05 -0700)]
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.
Keith Packard [Thu, 18 Oct 2007 12:04:39 +0000 (05:04 -0700)]
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.
Keith Packard [Thu, 18 Oct 2007 11:58:31 +0000 (04:58 -0700)]
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.
Keith Packard [Thu, 18 Oct 2007 11:54:51 +0000 (04:54 -0700)]
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.
Keith Packard [Thu, 18 Oct 2007 11:31:33 +0000 (04:31 -0700)]
Make FC_FULLNAME include all fullname entries, elide nothing. [bug 12827]
The old policy of eliding fullname entries which matched FC_FAMILY or
FC_FAMILY + FC_STYLE meant that applications could not know what the
font foundry set as the fullname of the font. Hiding information is not
helpful.
Keith Packard [Thu, 18 Oct 2007 11:13:51 +0000 (04:13 -0700)]
Store font directory mtime in cache file.
Instead of relying on mtime ordering between a directory and its associated
cache file, write the directory mtime into the cache file itself. This makes
cache file checks more reliable across file systems.
This change is made in a way that old programs can use new cache files, but
new programs will need new cache files.
Keith Packard [Mon, 12 Mar 2007 17:32:23 +0000 (10:32 -0700)]
Work around FreeType bug when glyph name buffer is too small.
Recent versions of FreeType do not correctly deal with glyph name buffers
that are too small; work around this by declaring a buffer that can hold any
PS name (127 bytes).
Stephan Kulow [Mon, 12 Mar 2007 17:21:35 +0000 (10:21 -0700)]
Make FcPatternDuplicate copy the binding instead of always using Strong.
I noticed that Qt always uses a different font than fc-match advertises.
Debugging the issue, I found that a call that looks pretty innocent is
changing all weak bindings to strong bindings and as such changes the
semantic of the match: FcPatternDuplicate.
Keith Packard [Sat, 2 Dec 2006 21:57:45 +0000 (13:57 -0800)]
Segfault scanning non-font files. Disallow scan edit of user vars. (#8767)
Missing NULL font check before attempting to edit scanned pattern.
Also, <match target="scan"> rules are now checked to ensure all
edited variables are in the predefined set; otherwise, the resulting
cache files will not be stable.
Kean Johnston [Sat, 2 Dec 2006 21:36:56 +0000 (13:36 -0800)]
Don't use varargs CPP macros in fccache.c. (bug 8733)
src/fccache.c uses a trick to try and use a function name that is also a
macro name. It does this using the varargs args() macro. Replace that
with separate macros for each number of formals.
Keith Packard [Sat, 2 Dec 2006 21:14:23 +0000 (13:14 -0800)]
Fix grep pattern in makealias to work on non-Gnu grep (bug 8368).
grep -l -w '^foo' doesn't work on Solaris. Replace with
grep -l '^foo\>' instead which does. Also, grep -l will
report the filename more than once (!), so add | head -1
to pick just the first one.
Keith Packard [Sat, 2 Dec 2006 21:04:05 +0000 (13:04 -0800)]
Avoid writing uninitialized structure pad bytes to cache files.
The union inside the FcValue structure contains pad bytes. Instead of
copying the whole structure to the cache block, copy only the initialized
fields to avoid writing whichever bytes serve as padding within the
structure.
Keith Packard [Sat, 2 Dec 2006 20:14:49 +0000 (12:14 -0800)]
Warn (and recover) from config file without <cachedir> elements.
When updating from older fontconfig versions, if the config file
is not replaced, it will not contain <cachedir> elements. Lacking these,
fontconfig has no place to store cached font information and cannot operate
reasonably.
Add code to check and see if the loaded configuration has no cache
directories, and if so, warn the user and add both the default system cache
directory and the normal per-user cache directory.
Keith Packard [Sat, 2 Dec 2006 19:47:07 +0000 (11:47 -0800)]
Use explicit platform/nameid order when scanning ttf files.
Instead of accepting whatever order names appear in the font file,
use an explicit ordering for both platform and nameid.
Platforms are high precedence than nameids.
The platform order is:
microsoft, apple unicode, macintosh, (other)
The family nameid order is:
preferred family, font family
The fullname nameid order is:
mac full name, full name
The style nameid order is
preferred subfamily, font subfamily
This will change the names visible to users in various application UIs, but
should not change how existing font names are matched as all names remain
present in the resulting database. The hope is that family names will, in
general, be less ambiguous. Testing here shows that commercial fonts
have longer names now while DejaVu has a shorter family name, and moves more
of the font description to the style name.
Mike FABIAN [Fri, 27 Oct 2006 17:26:50 +0000 (10:26 -0700)]
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.
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.
Keith Packard [Sun, 17 Sep 2006 21:09:12 +0000 (14:09 -0700)]
Build fontconfig.def from header files when needed.
Instead of attempting to track exported symbols manually in
fontconfig.def.in, build it directly from the public fontconfig header files
to ensure it exports the public API.
Keith Packard [Fri, 15 Sep 2006 07:23:40 +0000 (00:23 -0700)]
Reimplement FcConfigAppFontAddDir; function was lost in 2.4.0.
With the cache restructuring of 2.4.0, the ability to add
application-specific font files and directories was accidentally lost.
Reimplement this using by sharing the logic used to load configured font
directories.
Keith Packard [Thu, 14 Sep 2006 01:55:45 +0000 (18:55 -0700)]
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...)
Keith Packard [Sun, 10 Sep 2006 04:32:14 +0000 (21:32 -0700)]
Split much of the configuration into separate files. Renumber files
Most of the remaining elements in fonts.conf have been moved to separate
files. The numbering scheme for conf.d files has been documented in the
README and the files have been renumbered. Config files have been
validated against the DTD and a few minor errors fixed.
Keith Packard [Sat, 9 Sep 2006 23:41:58 +0000 (16:41 -0700)]
Insert newly created caches into reference data structure.
All caches used in the application must be in the cache reference list so
internal references can be tracked correctly. Failing to have newly created
caches in the list would cause the cache to be deallocated while references
were still present.
Keith Packard [Sat, 9 Sep 2006 17:04:42 +0000 (10:04 -0700)]
Accept locale environment variables that do not contain territory.
Locale environment variables (LC_ALL, LC_CTYPE, LANG) must contain language,
and may contain territory and encoding. Don't accidentally require territory
as that will cause fontconfig to fall back to 'en'.
Keith Packard [Thu, 7 Sep 2006 21:37:52 +0000 (14:37 -0700)]
Replace gnu-specific sed command with simple grep.
makealias was using a gnu-extension to sed addressing, replace that with a
simple (and more robuse) grep command. Also, found a bug in the public
header file that was leaving one symbol out of the process.
David Turner [Thu, 7 Sep 2006 21:29:35 +0000 (14:29 -0700)]
Replace character discovery loop with simpler, faster version.
The existing loop for discovering which characters map to glyphs is ugly and
inefficient. The replacement is functionally identical, but far cleaner and
faster.
Keith Packard [Thu, 7 Sep 2006 00:45:40 +0000 (17:45 -0700)]
Charset hashing depended on uniqueness of leaves.
Charset hashing actually use the value of the leaf pointers, which is
clearly wrong, especially now that charsets are not shared across multiple
font directories.
Keith Packard [Tue, 5 Sep 2006 09:24:01 +0000 (02:24 -0700)]
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