Behdad Esfahbod [Wed, 31 Dec 2008 23:06:07 +0000 (18:06 -0500)]
Fix comparison of family names to ignore leading space properly
Previously fc-match "xxx,nazli" matched Nazli, but "xxx, nazli" didn't.
This was because of a bug in FcCompareFamily's short-circuit check
that forgot to ignore spaces.
Behdad Esfahbod [Mon, 29 Dec 2008 23:58:29 +0000 (18:58 -0500)]
Remove special-casing of FC_FILE in FcPatternPrint()
I can't understand why the special case is needed. Indeed, removing it
does not make any difference in the "fc-match --verbose" output, and
that's the only time fc-match uses FcPatternPrint.
Behdad Esfahbod [Sun, 28 Dec 2008 21:54:44 +0000 (16:54 -0500)]
Explicitly chmod() directories (bug #18934)
Two changes:
- after mkdir(), we immediately chmod(), such that we are not affected
by stupid umask's.
- if a directory we want to use is not writable but exists, we try a
chmod on it. This is to recover from stupid umask's having affected
us with older versions.
Chris Wilson [Wed, 23 Apr 2008 08:07:28 +0000 (09:07 +0100)]
Reduce number of allocations during FcSortWalk().
The current behaviour of FcSortWalk() is to create a new FcCharSet on
each iteration that is the union of the previous iteration with the next
FcCharSet in the font set. This causes the existing FcCharSet to be
reproduced in its entirety and then allocates fresh leaves for the new
FcCharSet. In essence the number of allocations is quadratic wrt the
number of fonts required.
By introducing a new method for merging a new FcCharSet with an existing
one we can change the behaviour to be effectively linear with the number
of fonts - allocating no more leaves than necessary to cover all the
fonts in the set.
The savings are even more significant for applications like firefox-3.0b5
which need to switch between large number of fonts.
Before:
FcCharSetFindLeafCreate 4461192142758144
FcCharSetPutLeaf 1124536451574172
After:
FcCharSetFindLeafCreate 80359 2571488
FcCharSetPutLeaf 18940 9720522
Out of interest, the next most frequent allocations are
FcPatternObjectAddWithBinding 526029 10520580
tt_face_load_eblc 42103 2529892
Behdad Esfahbod [Fri, 22 Aug 2008 21:49:02 +0000 (17:49 -0400)]
Document when config can be NULL (#17105)
Note that this also fixes a bug with FcFontList() where previously
it was NOT checking whether the config is up-to-date. May want to
keep the old behavior and document that ScanInterval is essentially
unused internally (FcFontSetList uses it, but we can remove that
too).
Behdad Esfahbod [Wed, 13 Aug 2008 06:24:42 +0000 (02:24 -0400)]
Implement fc-list --verbose (#13015)
A private FcObjectGetSet() is implemented that provides an
FcObjectSet of all registered elements. FcFontSetList() is
then modified to use the object set from FcObjectGetSet() if
provided object-set is NULL.
Alternatively FcObjectGetSet() can be made public. In that
case fc-list can use that as a base if --verbose is included,
and also add any elements provided by the user (though that has
no effect, as all elements from the cache are already registered).
Currently fc-list ignores user-provided elements if --verbose
is specified.
Behdad Esfahbod [Tue, 12 Aug 2008 19:10:04 +0000 (15:10 -0400)]
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.
FcConfigUptoDate breaks if directory mtime is in the future. Bug 14424.
At OLPC, we came across a bug where the Browse activity (based on xulrunner)
took 100% CPU after an upgrade/. It turns out the Mozilla uses
FcConfigUptoDate() to check if new fonts have been added to the system, and
this function was always returning FcFalse since we have the mtimes of some
font directories set in the future. The attached patch makes
FcConfigUptoDate() print a warning and return FcTrue if mtime of directories
are in the future.
Glen Low [Sat, 24 May 2008 22:59:35 +0000 (15:59 -0700)]
Fix Win32 build error: install tries to run fc-cache locally (bug 15928).
When building in Win32 e.g. with MinGW, the install tries to run fc-cache
locally but the required DLL's are not in the path. I've included a patch for
this to fix Makefile.in to run fc-cache from bindir but obviously this should
be applied to Makefile.am instead.
(the second part of this patch was already in the tree)
Description of FcStrDirname is absent in the official documentation of
fontconfig-2.5.92. At the same time the source documentation contains
description of the function.
The problem is a consequence of a misprint in the format of the source
documentation file 'fcstring.fncs'. The finish mark of description of the
previous function is absent.
Keith Packard [Mon, 5 May 2008 02:08:31 +0000 (19:08 -0700)]
Freetype 2.3.5 (2007-jul-02) fixes indic font hinting. re-enable (bug 15822)
Autohinting for Indic fonts has been disabled since freetype could not handle
it properly. But since freetype-2.3.5, the hinting problems for indic fonts
have been fixed. Thus this is a request to enable the autohinting in
fontconfig again for all the indic fonts.
Keith Packard [Sun, 4 May 2008 03:07:35 +0000 (20:07 -0700)]
Use of ":=" in src/Makefile.am is unportable (bug 14420)
Building 2.5.91 on Solaris with the native make(1) yields
...
Making all in src
make: Fatal error in reader: Makefile, line 313: Unexpected end of line seen
Current working directory /tmp/fontconfig-2.5.91/src
*** Error code 1
This is due to the following line (src/Makefile.am:143):
CLEANFILES := $(ALIAS_FILES)
Changing that to a standard assignment ("=") fixes the problem.
I believe the ":=" is a typo. ALIAS_FILES is just a statically assigned
variable; it's not like evaluating it more than once would be a problem.
Dennis Schridde [Sun, 4 May 2008 02:45:31 +0000 (19:45 -0700)]
Proper config path for static libraries in win32
Since fontconfig didn't have special handling for paths in static Windows
libraries, I've created a patch which should fix this.
Basically it does this:
fccfg.c:
If fontconfig_path was uninitialised it tries to get the directory the exe is
in and uses a fonts/ dir inside that.
fcxml.c:
In case the fonts.conf lists a <dir>CUSTOMFONTDIR</dir>, it searches for a
fonts/ directory where the exe is located.
Changwoo Ryu [Sun, 4 May 2008 02:39:56 +0000 (19:39 -0700)]
Korean font in the default config - replacing baekmuk with un (bug 13569)
I propose to replace the default Baekmuk Korean fonts with Un fonts.
Some people don't agree but most Korean people prefer Un fonts to Baekmuk
ones. Un fonts just look better, at least in the most common Linux desktops
(antialiased, GNOME or KDE, high resolution).
Sylvain Pasche [Sun, 4 May 2008 02:33:45 +0000 (19:33 -0700)]
Fontconfig options for freetype sub-pixel filter configuration
David Turner has modified FreeType to be able to render sub-pixel decimated
glyphs using different methods of filtering. Fontconfig needs new
configurables to support selecting these new filtering options. A patch
follows that would correspond to one available for Cairo in bug 10301.
Keith Packard [Sun, 4 May 2008 00:19:43 +0000 (17:19 -0700)]
Work around for bitmap-only TrueType fonts that are missing the glyf table.
Bitmap-only TrueType fonts without a glyf table will not load a glyph when
FT_LOAD_NO_SCALE is set. Work around this by identifying TrueType fonts that have no
glyphs and select a single strike to measure the glyph map with.
Hongbo Zhao [Thu, 13 Dec 2007 05:47:33 +0000 (21:47 -0800)]
Not_contain should use strstr, not strcmp on strings. (bug 13632)
For Version 2.5.0, (same for previous version 2.4.2), in source file fccfg.c,
on line 700,
Original:
ret = FcStrCmpIgnoreCase (left.u.s, right.u.s) == 0;
Should change to:
ret = FcStrStrIgnoreCase (left.u.s, right.u.s) == 0;
I think this is just a mistake when copy-n-paste similar codes in the same
function. Apparently, return for "Not_contain" should be just the inverse of
"Contain", not the same as "Equal".
Tor Lillqvist [Wed, 14 Nov 2007 00:41:55 +0000 (16:41 -0800)]
Workaround for stat() brokenness in Microsoft's C library (bug 8526)
Fix a couple of longstanding problems with fontconfig on Windows that
manifest themselves especially in GIMP. The root cause to the problems is in
Microsoft's incredibly stupid stat() implementation. Basically, stat()
returns wrong timestamp fields for files on NTFS filesystems on machines
that use automatic DST switching.
See for instance http://bugzilla.gnome.org/show_bug.cgi?id=154968 and
http://www.codeproject.com/datetime/dstbugs.asp
As fccache.c now looks at more fields in the stat struct I fill in them all.
I noticed that fstat() is used only on a fd just after opening it, so on
Win32 I just call my stat() replacement before opening instead...
Implementing a good replacement for fstat() would be harder because the code
in fccache.c wants to compare inode numbers. There are no (readily
accessible) inode numbers on Win32, so I fake it with the hash of the full
file name, in the case as it is on disk. And fstat() doesn't know the full
file name, so it would be rather hard to come up with a inode number to
identify the file.
The patch also adds similar handling for the cache directory as for the fonts
directory: If a cachedir element in fonts.conf contains the magic string
"WINDOWSTEMPDIR_FONTCONFIG_CACHE" it is replaced at runtime with a path under
the machine's (or user's) temp folder as returned by GetTempPath(). I don't
want to hardcode any pathnames in a fonts.conf intended to be distributed to
end-users, most of which who wouldn't know how to edit it anyway. And
requiring an installer to edit it gets complicated.