Commit Graph

136 Commits

Author SHA1 Message Date
Akira TAGOH 791762d8b7 fc-cache: Show font directories to generate cache with -v 2019-04-03 12:02:09 +00:00
Keith Packard c4324f54ee Replace UUID file mechanism with per-directory 'map' attribute [v2]
The UUID files would be placed in each font directory to provide the
unique cache name, independent of path, for that directory. The UUID
files are undesireable for a couple of reasons:

 1) They must be placed in the font directories to be useful. This
    requires modifying the font directories themselves, introducing
    potential visible timestamp changes when running multiple
    applications, and makes the cache processing inconsistent between
    applications with permission to write to the font directories and
    applications without such permission.

 2) The UUID contents were generated randomly, which makes the font
    cache not reproducible across multiple runs.

One proposed fix for 2) is to make the UUID dependent on the font
directory path, but once we do that, we can simply use the font
directory path itself as the key as the original MD5-based font cache
naming mechanism did.

The goal of the UUID file mechanism was to fix startup time of
flatpaks; as the font path names inside the flatpak did not match the
font path names in the base system, the font cache would need to be
reconstructed the first time the flatpak was launched.

The new mechanism for doing this is to allow each '<dir>' element in
the configuration include a 'map' attribute. When looking for a cache
file for a particular directory, if the directory name starts with the
contents of the <dir> element, that portion of the name will be
replaced with the value of the 'map' attribute.

Outside of the flatpak, nothing need change -- fontconfig will build
cache files using real directory names.

Inside the flatpak, the custom fonts.conf file will now include
mappings such as this:

	<dir map="/usr/share/fonts">/run/host/fonts</dir>

When scanning the directory /run/host/fonts/ttf, fontconfig will
use the name /usr/share/fonts/ttf as the source for building the cache
file name.

The existing FC_FILE replacement code used for the UUID-based
implementation continues to correctly adapt font path names seen by
applications.

v2:
	Leave FcDirCacheCreateUUID stub around to avoid removing
	public API function.

	Document 'map' attribute of <dir> element in
	fontconfig-user.sgml

	Suggested-by: Akira TAGOH <akira@tagoh.org>

Signed-off-by: Keith Packard <keithp@keithp.com>
2019-04-03 12:02:09 +00:00
Chris McDonald 3c75a5a935 Lowered temporary rooted_dir variable inside loop 2018-11-26 11:46:21 -07:00
Chris McDonald d36f977c76 Respect sysroot option for file path passed to stat 2018-11-19 15:19:19 -07:00
Akira TAGOH 2938e4d72d call setlocale 2018-03-15 12:54:02 +09:00
Akira TAGOH 34b5c949d5 Do not mix up font dirs into the list of config dirs 2018-02-05 12:47:01 +09:00
Akira TAGOH dd21876e64 Update .uuid only when -r is given but not -f. 2017-12-18 12:11:21 +09:00
Akira TAGOH 3c55ef4b27 missing an open parenthesis 2017-11-08 22:03:49 +09:00
Akira TAGOH 9a0fcb948f Add the ruleset description support
Trying to address what these configuration files really do.
This change allows to see the short description that mention
the purpose of the content in the config file and obtain
them through API.

This change also encourage one who want to make some UI for
the user-specific configuration management. it is the main
purpose of this change for me though.

Aside from that, I've also made programs translatable. so
we see more dependencies on the build time for gettext,
and itstool to generate PO from xml.
2017-11-07 15:24:54 +09:00
Akira TAGOH ad9f588050 Fix the broken cache more.
Take a look at the nano second in the mtime to figure out
if the cache needs to be updated if available.
and do the mutex lock between scanning and writing a cache
to avoid the conflict.

Also we don't need to scan directories again after writing
caches. so getting rid of the related code as well.

https://bugs.freedesktop.org/show_bug.cgi?id=69845

and for reference:

https://bugzilla.redhat.com/show_bug.cgi?id=1236034
2015-08-14 17:19:29 +09:00
Akira TAGOH 78ed920e2b Fix a typo in docs 2015-01-19 19:48:50 +09:00
Akira TAGOH 456937cd15 fc-cache: Add an option to raise an error if no fonts found
and get back the behavior.
2014-12-24 18:53:41 +09:00
Akira TAGOH db64c71408 fc-cache: make a fail if no fonts processed on a given path 2014-12-16 20:43:02 +09:00
Akira TAGOH d17f556153 Read the config files and fonts on the sysroot when --sysroot is given to fc-cache
Fix for e96d776088

https://bugs.freedesktop.org/show_bug.cgi?id=59456
2014-06-17 20:11:02 +09:00
Akira TAGOH f44157c809 Fix fc-cache fail with -r
Do not unlink the cache even if --really-force is given.
because re-scanning process expects the cache exists.

https://bugs.freedesktop.org/show_bug.cgi?id=77252
2014-04-10 19:27:55 +09:00
Akira TAGOH 7a6622f25c Improve the performance issue on rescanning directories 2013-12-20 11:57:16 +09:00
Ross Burton a5fd7912ff fc-cache: --sysroot option takes an argument
The getopt_long option definitions say that sysroot doesn't take an argument,
when it in fact does.

Signed-off-by: Ross Burton <ross.burton@intel.com>
2013-11-28 15:27:04 +09:00
Akira TAGOH a4443e64c8 Re-scan font directories only when it contains subdirs
Somewhat improves the performance but still need to think about for the situation
where both directories and fonts are in.
2013-11-05 20:30:35 +09:00
Akira TAGOH 0203055520 Workaround the race condition issue on updating cache 2013-10-02 16:34:34 +09:00
Sebastian Freundt 18bf57c70a build-chain, replace INCLUDES directive by AM_CPPFLAGS
As of automake-13.1 the INCLUDES directive is no longer supported.
An automake run will return with an error.

This changeset simply follows automake's advice to replace INCLUDES
by AM_CPPFLAGS.
2013-04-08 11:40:58 +09:00
Akira TAGOH e96d776088 Bug 59456 - Adding a --sysroot like option to fc-cache
Add an ability to set the system root to generate the caches.
In order to do this, new APIs, FcConfigGetSysRoot() and
FcConfigSetSysRoot() is available.
2013-03-05 18:38:50 +09:00
Behdad Esfahbod ed41b23765 Switch .gitignore to git.mk 2013-01-02 00:36:12 -06:00
Akira TAGOH 36265aeebd Remove the dead code 2012-12-11 11:37:23 +09:00
Akira TAGOH 038aa930ae Use automake variable instead of cleaning files in clean-local
just for git.mk coming up from Behdad's threadsafe branch
2012-10-26 14:31:23 +09:00
Akira TAGOH 06d6b7c312 Create CACHEDIR.TAG when fc-cache is run or only when the cache directory is created at the runtime.
Also add FcCacheCreateTagFile() API to do create CACHEDIR.TAG on the cache
directory.
2012-04-23 11:26:32 +09:00
Akira TAGOH dd2a3d3520 Bug 25151 - Move cleanCacheDirectory() from fc-cache.c into
the library

Add FcDirCacheScan() API to clean up the cache files in the directory.
2012-04-18 12:55:23 +09:00
Akira TAGOH 1db3e9cdd8 fc-cache: improvement of the fix for Bug#39914.
Use sizeof() instead of strlen() and use stdio.
2012-03-22 12:36:34 +09:00
Akira TAGOH 4f7f3bf9f7 Bug 39914 - Please tag the cache directory with CACHEDIR.TAG
fc-cache: Create CACHEDIR.TAG at the top of the cache directory.

Reviewed-by: Josh Triplett <josh@joshtriplett.org>
2012-03-21 16:06:37 +09:00
Jeremy Huddleston 8cc4498122 fcarch: Check for architecture signature at compile time rather than configure time
https://bugs.freedesktop.org/show_bug.cgi?id=20208

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-03-21 11:59:01 +09:00
Akira TAGOH 93460f93e9 Fix a build issue due to the use of non-portable variables
$< isn't supported in BSD make say. $(RM) is pre-defined in GNU make
though, not in BSD make say. so changed to check on configure if it's
pre-defined by make, otherwise set the appropriate command to $(RM).

This would be a workaround until it has the certain pre-defined value.
2012-03-16 16:34:37 +09:00
Akira TAGOH a5b609196f Revert "Fix a build fail on some environment."
This reverts commit 0fdfddf2ac.

Conflicts:

	doc/Makefile.am
2012-03-16 11:55:30 +09:00
Akira TAGOH 0fdfddf2ac Fix a build fail on some environment. 2012-03-10 23:30:30 +09:00
Behdad Esfahbod d1a0fca316 Make fc-arch stuff cross-compiling-safe
Fixes:
Bug 32679 - fontconfig-2.8.0 does not cross compile
Bug 25462 - Cross-compilation doesn't work
2010-12-28 01:22:34 -06: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 ba7b50ab33 Add fc-pattern cmdline tool 2010-04-20 23:18:00 -04:00
Behdad Esfahbod 111e5b6d69 Bug 25152 Don't sleep(2) if all caches were uptodate 2010-02-26 01:47:56 -05:00
Behdad Esfahbod 38bd85b83b [fc-cache] Document -r argument in man page 2009-11-20 18:44:04 -05:00
Behdad Esfahbod 35c5181151 [fc-cache] Remove obsolete sentence from man page 2009-06-24 13:52:10 -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 98d765a53b Cleanup all manpage.* files
Recent doc2man generates files called manpage.log.  This was breaking build.
2009-02-13 16:55:08 -08:00
Behdad Esfahbod 6bffe1a95b Add fc-scan too that runs FcFileScan/FcDirScan
This is quite similar to fc-query, but calling FcFileScan/FcDirScan instead
of FcFreeTypeQuery.
2009-02-13 16:54:06 -08:00
Behdad Esfahbod 1439c8f21a Handle -h and --help according to GNU Coding Standards (#17104)
Added -h instead of -?.  And upon -h and --help, write usave to stdout
instead of stdin, and return 0 instead of 1.

-? still works like before as that's what getopt returns upon unknown
arguments.
2009-02-13 16:53:59 -08:00
Behdad Esfahbod e690fbb20e Get rid of $Id$ tags 2009-02-13 16:53:57 -08:00
Behdad Esfahbod 77c0d8bce8 Add fc-query (#13019) 2009-02-13 16:53:56 -08:00
Behdad Esfahbod d5b6085c3e Update man pages 2009-02-13 16:53:56 -08:00
Behdad Esfahbod 317b849215 Replace RCS Id tags with the file name 2009-02-13 16:53:55 -08:00
Keith Packard c6c9400d67 Call FcFini to make memory debugging easier
FcFini frees all libary data structures so valgrind should report 0
allocations in use when the program exits.
2008-05-04 01:25:04 -07:00
Eric Anholt ba88459913 Fix build with !ENABLE_DOCS and no built manpages. 2008-04-18 11:52:41 -07:00
Keith Packard 32fed45727 Eliminate references to freetype from utility Makefile.am's
The utility programs don't use any freetype interfaces, so they
don't need to directly refer to freetype headers or libraries.
2008-01-08 12:34:19 -08:00
Tor Lillqvist 8a3dc4880c 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.
2007-11-13 16:41:55 -08:00