Commit Graph

834 Commits

Author SHA1 Message Date
Keith Packard 28a4ea7f71 Fix parallel build in fontconfig/docs (bug 10481). 2007-10-25 01:09:11 -07:00
Keith Packard 79641a3b0c Handle UltraBlack weight.
UltraBlack is weight 950 on the CSS scale; handle this by name and value
encoding it as fontconfig weight 215.
2007-10-25 01:03:40 -07:00
Keith Packard d02f6a70f1 Oops. Left debugging printf in previous commit. 2007-10-25 01:02:58 -07:00
Keith Packard 61139cf638 Spelling errors in documentation. (bug 10879).
Thanks to David <ssdk@ispras.ru> for spotting these.
2007-10-25 00:49:19 -07:00
Keith Packard feecc86cea There is no U+1257 (bug 10899).
The Eritrean Tigrinya orthography mistakenly included this unicode value.
2007-10-25 00:46:41 -07:00
Keith Packard 4657944d0c FcInit should return FcFalse when FcInitLoadConfigAndFonts fails. (bug 10976)
Thanks to David <ssdk@ispras.ru> for spotting this error.
2007-10-25 00:41:28 -07:00
Tilman Sauerbeck 28baf72736 Store FcVendorFoundries in read-only memory.
Create fixed size strings for vendor and foundry.
2007-10-25 00:38:44 -07:00
Tilman Sauerbeck 481f6c2307 Store FcNoticeFoundries in read-only memory.
Use a single character array and a separate table of integer indices.
2007-10-25 00:36:37 -07:00
Keith Packard a72ef35ce6 Replace makealias pattern with something supported by POSIX grep (bug 11083)
The suggested replacement in the bug was not supported by GNU grep, so I
created something that should be supported everywhere (famous last words).
2007-10-25 00:22:04 -07:00
Keith Packard 369b6b5bfb Add BRAILLE PATTERN BLANK to list of blank glyphs.
Braille pattern blank is often imaged as a blank glyph.
2007-10-24 21:59:33 -07:00
Keith Packard 007cae508c Move <cachedir> elements to the end of fonts.conf.
This allows users to select alternate directories for cache files, ahead of
the 'standard' directories.
2007-10-24 21:52:56 -07:00
Keith Packard d50cfeb805 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.
2007-10-24 21:47:40 -07:00
Keith Packard 1bd0b5ba73 Eliminate relocations from FcCodePageRange structure (bug 10982).
FcCodePageRange was using char pointers; replace them with char arrays.
2007-10-18 09:48:31 -07:00
Keith Packard 96925b99c0 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.
2007-10-18 09:43:22 -07:00
Keith Packard bc5e8adb4d 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.
2007-10-18 09:41:00 -07:00
Keith Packard e85789a997 Place language name in constant array instead of pointer.
Constant char array of 8 bytes is the same size as a pointer plus a short
string, so this actually saves memory and eliminates a pile of relocations.
2007-10-18 08:58:14 -07:00
Keith Packard 26437d4924 FcConfigParseAndLoad doc was missing the last param.
Typo lost the last param to this function.
2007-10-18 08:56:42 -07:00
Mike FABIAN 07e646cc84 Avoid crashes if config files contain junk.
If ~/.fonts.conf contains:

  <edit mode="assign_replace" name="spacing">
     <int>mono</int>
       </edit>

fontconfig crashes:

    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.
2007-10-18 05:44:28 -07:00
Hideki Yamane fa9a7448d8 Handle Japanese fonts better. (debian bug #435971)
Add some commonly available Japanese fonts to the standard aliases.
2007-10-18 05:17:36 -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
Keith Packard f7da903d37 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.
2007-10-18 04:31:33 -07:00
Keith Packard 144ca87831 Comment about mmaping cache files was misleading. 2007-10-18 04:29:13 -07:00
Keith Packard db6f19f13b 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.
2007-10-18 04:13:51 -07:00
Keith Packard 00268a50e8 Fix ChangeLog generation to avoid circular make dependency 2007-10-18 03:52:29 -07:00
Keith Packard 3ae9258f9e Free temporary string in FcDirCacheUnlink (Bug #11758)
In FcDirCacheUnlink(), the line

  cache_hashed = FcStrPlus (cache_dir, cache_base);

allocates memory in cache_hashed that is never free()'d before the function
exits.

Reported by Ben Combee.
2007-08-05 12:31:03 -07:00
Keith Packard c80a08d6bf 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).
2007-03-12 10:32:23 -07:00
Keith Packard fa741cd4ff rehash increment could be zero, causing rehash infinite loop.
Bump the rehash value by one so that it is always positive.
2007-03-12 10:30:51 -07:00
Stephan Kulow 9b74b78fe8 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.
2007-03-12 10:21:35 -07:00
Keith Packard 2373f90426 Update for version 2.4.2 2006-12-02 16:09:47 -08:00
Peter Breitenlohner e3b65ee068 Fix fc-cat documentation (bug 8935).
Adapt documentation to reality.

(1) The fc-cat usage message should reflect the
options accepted by the program.

(2) The fc-cat.1 manpage was fairly broken (unreadable).
2006-12-02 15:09:57 -08:00
Keith Packard 61895ed16c Add space between type and formal in devel man pages (bug 8935)
Most parameters are pointers and have '*' in the type; for those
which do not, use '%' to mark where a space needs to be inserted.
2006-12-02 15:06:13 -08:00
Peter Breitenlohner b1aa20098f Use <literal> instead of <sgmltag> when documenting fonts.conf. Bug 8935. 2006-12-02 14:28:03 -08:00
Peter Breitenlohner 2cae0512cd A VPATH build of fontconfig-2.4.1 fails for various reasons. Bug 8933.
VPATH builds without doctools breaks as it cannot find the distributed
pre-formatted documentation.
2006-12-02 14:18:11 -08:00
Keith Packard 0f963b0d3e 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.
2006-12-02 13:57:45 -08:00
Kean Johnston c9c6875014 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.
2006-12-02 13:36:56 -08:00
Keith Packard 72ffe6536a Add FcFreeTypeQueryFace external API. Bug #7311.
Expose ability to build an FcPattern directly from an FT_Face
object.
2006-12-02 13:22:27 -08:00
Keith Packard 5e234d9e76 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.
2006-12-02 13:14:23 -08:00
Keith Packard 2b77216ee2 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.
2006-12-02 13:04:05 -08:00
Keith Packard 64d7e303df 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.
2006-12-02 12:14:49 -08:00
Keith Packard 253ec7609c 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.
2006-12-02 11:47:07 -08:00
Keith Packard b5803016d7 FcStrCanonAbsoluteFilename should be static. 2006-11-12 17:15:55 -08:00
Keith Packard bae5db78dd Add sparc64 architecture string. 2006-11-12 17:15:24 -08: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
Han-Wen Nienhuys 0596d7296c More fixes for Win32 building (bug 8311)
Our build system barfs on autogen.sh, which ignores --noconfigure. Configure
needs a host of options to make the cross compile work in our case.

Fix typo in fccache.c
2006-09-17 17:03:33 -07: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 cc104e6a91 Detect and use available random number generator (bug 8308)
Prefer random over lrand48 over rand
2006-09-17 14:20:18 -07:00