aboutsummaryrefslogtreecommitdiff
path: root/fontconfig
diff options
context:
space:
mode:
Diffstat (limited to 'fontconfig')
-rw-r--r--fontconfig/conf.d/30-metric-aliases.conf50
-rw-r--r--fontconfig/configure.in4
-rw-r--r--fontconfig/doc/fccache.fncs9
-rw-r--r--fontconfig/doc/fcconfig.fncs2
-rw-r--r--fontconfig/fc-cache/fc-cache.c73
-rw-r--r--fontconfig/fontconfig/fontconfig.h11
-rw-r--r--fontconfig/src/fccache.c85
-rw-r--r--fontconfig/src/fccfg.c2
-rw-r--r--fontconfig/src/fcint.h3
-rw-r--r--fontconfig/src/fcstr.c2
10 files changed, 148 insertions, 93 deletions
diff --git a/fontconfig/conf.d/30-metric-aliases.conf b/fontconfig/conf.d/30-metric-aliases.conf
index 4202ae92e..ccc3e246d 100644
--- a/fontconfig/conf.d/30-metric-aliases.conf
+++ b/fontconfig/conf.d/30-metric-aliases.conf
@@ -29,10 +29,14 @@
Albany AMT
Thorndale AMT
Cumberland AMT
+ Google CrOS Core fonts:
+ Arimo
+ Cousine
+ Tinos
Of these, URW fonts are design compatible with PostScrict fonts,
- and the Liberation, StarOffice, and AMT ones are compatible with
- Microsoft fonts.
+ and the Liberation, StarOffice, AMT and CrOS Core ones are
+ compatible with Microsoft fonts.
We want for each of them to fallback to any of these
available, but in an order preferring similar designs
@@ -75,6 +79,13 @@
<!-- Microsoft -->
<alias binding="same">
+ <family>Arimo</family>
+ <default>
+ <family>Arial</family>
+ </default>
+ </alias>
+
+ <alias binding="same">
<family>Liberation Sans</family>
<default>
<family>Arial</family>
@@ -96,6 +107,13 @@
</alias>
<alias binding="same">
+ <family>Tinos</family>
+ <default>
+ <family>Times New Roman</family>
+ </default>
+ </alias>
+
+ <alias binding="same">
<family>Liberation Serif</family>
<default>
<family>Times New Roman</family>
@@ -117,6 +135,13 @@
</alias>
<alias binding="same">
+ <family>Cousine</family>
+ <default>
+ <family>Courier New</family>
+ </default>
+ </alias>
+
+ <alias binding="same">
<family>Liberation Mono</family>
<default>
<family>Courier New</family>
@@ -219,27 +244,30 @@
<alias binding="same">
<family>Arial</family>
<accept>
- <family>Liberation Sans</family>
- <family>Albany</family>
- <family>Albany AMT</family>
+ <family>Arimo</family>
+ <family>Liberation Sans</family>
+ <family>Albany</family>
+ <family>Albany AMT</family>
</accept>
</alias>
<alias binding="same">
<family>Times New Roman</family>
<accept>
- <family>Liberation Serif</family>
- <family>Thorndale</family>
- <family>Thorndale AMT</family>
+ <family>Tinos</family>
+ <family>Liberation Serif</family>
+ <family>Thorndale</family>
+ <family>Thorndale AMT</family>
</accept>
</alias>
<alias binding="same">
<family>Courier New</family>
<accept>
- <family>Liberation Mono</family>
- <family>Cumberland</family>
- <family>Cumberland AMT</family>
+ <family>Cousine</family>
+ <family>Liberation Mono</family>
+ <family>Cumberland</family>
+ <family>Cumberland AMT</family>
</accept>
</alias>
diff --git a/fontconfig/configure.in b/fontconfig/configure.in
index 9bb0988ec..62bc25e4a 100644
--- a/fontconfig/configure.in
+++ b/fontconfig/configure.in
@@ -138,11 +138,9 @@ AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr strtol
#
# regex
#
-use_regex=0
if test "x$ac_cv_func_regcomp" = "xyes" -a "x$ac_cv_func_regerror" = "xyes" -a "x$ac_cv_func_regexec" = "xyes" -a "x$ac_cv_func_regfree"; then
- use_regex=1
+ AC_DEFINE(USE_REGEX,,[Use regex])
fi
-AC_DEFINE_UNQUOTED(USE_REGEX,$use_regex,[Use regex.])
#
# Checks for iconv
diff --git a/fontconfig/doc/fccache.fncs b/fontconfig/doc/fccache.fncs
index 2f5fa4766..ca8ffa03c 100644
--- a/fontconfig/doc/fccache.fncs
+++ b/fontconfig/doc/fccache.fncs
@@ -75,3 +75,12 @@ FcCacheCopySet.
This tries to clean up the cache directory of <parameter>cache_dir</parameter>.
This returns FcTrue if the operation is successfully complete. otherwise FcFalse.
@@
+
+@RET@ void
+@FUNC@ FcCacheCreateTagFile
+@TYPE1@ const FcConfig * @ARG1@ config
+@PURPOSE@ Create CACHEDIR.TAG at cache directory.
+@DESC@
+This tries to create CACHEDIR.TAG file at the cache directory registered
+to <parameter>config</parameter>.
+@@
diff --git a/fontconfig/doc/fcconfig.fncs b/fontconfig/doc/fcconfig.fncs
index 9b9f66e1f..10028b465 100644
--- a/fontconfig/doc/fcconfig.fncs
+++ b/fontconfig/doc/fcconfig.fncs
@@ -154,7 +154,7 @@ simply returns NULL to indicate that no per-user file exists.
@RET@ FcStrList *
@FUNC@ FcConfigGetCacheDirs
-@TYPE1@ FcConfig * @ARG1@ config
+@TYPE1@ const FcConfig * @ARG1@ config
@PURPOSE@ return the list of directories searched for cache files
@DESC@
<function>FcConfigGetCacheDirs</function> returns a string list containing
diff --git a/fontconfig/fc-cache/fc-cache.c b/fontconfig/fc-cache/fc-cache.c
index b42fd3545..9fb383be0 100644
--- a/fontconfig/fc-cache/fc-cache.c
+++ b/fontconfig/fc-cache/fc-cache.c
@@ -42,14 +42,6 @@
#include <dirent.h>
#include <string.h>
-#ifndef FC_DIR_SEPARATOR_S
-# ifdef _WIN32
-# define FC_DIR_SEPARATOR_S "\\"
-# else
-# define FC_DIR_SEPARATOR_S "/"
-# endif
-#endif
-
#if defined (_WIN32)
#define STRICT
#include <windows.h>
@@ -122,69 +114,6 @@ usage (char *program, int error)
static FcStrSet *processed_dirs;
-/* Create CACHEDIR.TAG */
-static FcBool
-create_tag_file (FcConfig *config, FcBool verbose)
-{
- FcChar8 *cache_tag;
- FcChar8 *cache_dir = NULL;
- FcStrList *list;
- int fd;
- FILE *fp;
- FcAtomic *atomic;
- static const FcChar8 cache_tag_contents[] =
- "Signature: 8a477f597d28d172789f06886806bc55\n"
- "# This file is a cache directory tag created by fontconfig.\n"
- "# For information about cache directory tags, see:\n"
- "# http://www.brynosaurus.com/cachedir/\n";
- static size_t cache_tag_contents_size = sizeof (cache_tag_contents) - 1;
- FcBool ret = FcTrue;
-
- list = FcConfigGetCacheDirs(config);
- if (!list)
- return FcFalse;
-
- while ((cache_dir = FcStrListNext (list)))
- {
- if (access ((char *) cache_dir, W_OK|X_OK) == 0)
- {
- if (verbose)
- printf ("Create CACHEDIR.TAG at %s\n", cache_dir);
- /* Create CACHEDIR.TAG */
- cache_tag = FcStrPlus (cache_dir, (const FcChar8 *) FC_DIR_SEPARATOR_S "CACHEDIR.TAG");
- if (!cache_tag)
- return FcFalse;
- atomic = FcAtomicCreate ((FcChar8 *)cache_tag);
- if (!atomic)
- goto bail1;
- if (!FcAtomicLock (atomic))
- goto bail2;
- fd = open((char *)FcAtomicNewFile (atomic), O_RDWR | O_CREAT, 0644);
- if (fd == -1)
- goto bail3;
- fp = fdopen(fd, "wb");
- if (fp == NULL)
- goto bail3;
-
- fwrite(cache_tag_contents, cache_tag_contents_size, sizeof (FcChar8), fp);
- fclose(fp);
-
- if (!FcAtomicReplaceOrig(atomic))
- goto bail3;
-
- bail3:
- FcAtomicUnlock (atomic);
- bail2:
- FcAtomicDestroy (atomic);
- bail1:
- FcStrFree (cache_tag);
- }
- }
- FcStrListDone (list);
-
- return ret;
-}
-
static int
scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force, FcBool verbose, int *changed)
{
@@ -435,7 +364,7 @@ main (int argc, char **argv)
* This expects the fontconfig cache directory already exists.
* If it doesn't, it won't be simply created.
*/
- create_tag_file (config, verbose);
+ FcCacheCreateTagFile (config);
FcStrSetDestroy (processed_dirs);
diff --git a/fontconfig/fontconfig/fontconfig.h b/fontconfig/fontconfig/fontconfig.h
index 0e2ca509d..e4d57088d 100644
--- a/fontconfig/fontconfig/fontconfig.h
+++ b/fontconfig/fontconfig/fontconfig.h
@@ -112,9 +112,9 @@ typedef int FcBool;
#define FC_DECORATIVE "decorative" /* Bool - true if style is a decorative variant */
#define FC_LCD_FILTER "lcdfilter" /* Int */
-#define FC_CACHE_SUFFIX ".cache-"FC_CACHE_VERSION
-#define FC_DIR_CACHE_FILE "fonts.cache-"FC_CACHE_VERSION
-#define FC_USER_CACHE_FILE ".fonts.cache-"FC_CACHE_VERSION
+#define FC_CACHE_SUFFIX ".cache-" FC_CACHE_VERSION
+#define FC_DIR_CACHE_FILE "fonts.cache-" FC_CACHE_VERSION
+#define FC_USER_CACHE_FILE ".fonts.cache-" FC_CACHE_VERSION
/* Adjust outline rasterizer */
#define FC_CHAR_WIDTH "charwidth" /* Int */
@@ -331,6 +331,9 @@ FcDirCacheValid (const FcChar8 *cache_file);
FcPublic FcBool
FcDirCacheClean (const FcChar8 *cache_dir, FcBool verbose);
+FcPublic void
+FcCacheCreateTagFile (const FcConfig *config);
+
/* fccfg.c */
FcPublic FcChar8 *
FcConfigHome (void);
@@ -378,7 +381,7 @@ FcPublic FcBlanks *
FcConfigGetBlanks (FcConfig *config);
FcPublic FcStrList *
-FcConfigGetCacheDirs (FcConfig *config);
+FcConfigGetCacheDirs (const FcConfig *config);
FcPublic int
FcConfigGetRescanInterval (FcConfig *config);
diff --git a/fontconfig/src/fccache.c b/fontconfig/src/fccache.c
index d3842ddff..d1fa7783b 100644
--- a/fontconfig/src/fccache.c
+++ b/fontconfig/src/fccache.c
@@ -931,6 +931,8 @@ FcDirCacheWrite (FcCache *cache, FcConfig *config)
if (FcMakeDirectory (test_dir))
{
cache_dir = test_dir;
+ /* Create CACHEDIR.TAG */
+ FcDirCacheCreateTagFile (cache_dir);
break;
}
}
@@ -940,6 +942,8 @@ FcDirCacheWrite (FcCache *cache, FcConfig *config)
else if (chmod ((char *) test_dir, 0755) == 0)
{
cache_dir = test_dir;
+ /* Try to create CACHEDIR.TAG too */
+ FcDirCacheCreateTagFile (cache_dir);
break;
}
}
@@ -1409,6 +1413,87 @@ static void MD5Transform(FcChar32 buf[4], FcChar32 in[16])
buf[2] += c;
buf[3] += d;
}
+
+FcBool
+FcDirCacheCreateTagFile (const FcChar8 *cache_dir)
+{
+ FcChar8 *cache_tag;
+ int fd;
+ FILE *fp;
+ FcAtomic *atomic;
+ static const FcChar8 cache_tag_contents[] =
+ "Signature: 8a477f597d28d172789f06886806bc55\n"
+ "# This file is a cache directory tag created by fontconfig.\n"
+ "# For information about cache directory tags, see:\n"
+ "# http://www.brynosaurus.com/cachedir/\n";
+ static size_t cache_tag_contents_size = sizeof (cache_tag_contents) - 1;
+ FcBool ret = FcFalse;
+
+ if (!cache_dir)
+ return FcFalse;
+
+ if (access ((char *) cache_dir, W_OK|X_OK) == 0)
+ {
+ /* Create CACHEDIR.TAG */
+ cache_tag = FcStrPlus (cache_dir, (const FcChar8 *) FC_DIR_SEPARATOR_S "CACHEDIR.TAG");
+ if (!cache_tag)
+ return FcFalse;
+ atomic = FcAtomicCreate ((FcChar8 *)cache_tag);
+ if (!atomic)
+ goto bail1;
+ if (!FcAtomicLock (atomic))
+ goto bail2;
+ fd = open((char *)FcAtomicNewFile (atomic), O_RDWR | O_CREAT, 0644);
+ if (fd == -1)
+ goto bail3;
+ fp = fdopen(fd, "wb");
+ if (fp == NULL)
+ goto bail3;
+
+ fwrite(cache_tag_contents, cache_tag_contents_size, sizeof (FcChar8), fp);
+ fclose(fp);
+
+ if (!FcAtomicReplaceOrig(atomic))
+ goto bail3;
+
+ ret = FcTrue;
+ bail3:
+ FcAtomicUnlock (atomic);
+ bail2:
+ FcAtomicDestroy (atomic);
+ bail1:
+ FcStrFree (cache_tag);
+ }
+
+ if (FcDebug () & FC_DBG_CACHE)
+ {
+ if (ret)
+ printf ("Created CACHEDIR.TAG at %s\n", cache_dir);
+ else
+ printf ("Unable to create CACHEDIR.TAG at %s\n", cache_dir);
+ }
+
+ return ret;
+}
+
+void
+FcCacheCreateTagFile (const FcConfig *config)
+{
+ FcChar8 *cache_dir = NULL;
+ FcStrList *list;
+
+ list = FcConfigGetCacheDirs (config);
+ if (!list)
+ return;
+
+ while ((cache_dir = FcStrListNext (list)))
+ {
+ if (FcDirCacheCreateTagFile (cache_dir))
+ break;
+ }
+ FcStrListDone (list);
+}
+
#define __fccache__
#include "fcaliastail.h"
#undef __fccache__
diff --git a/fontconfig/src/fccfg.c b/fontconfig/src/fccfg.c
index bd1dc34d7..0d0b778d2 100644
--- a/fontconfig/src/fccfg.c
+++ b/fontconfig/src/fccfg.c
@@ -471,7 +471,7 @@ FcConfigAddCacheDir (FcConfig *config,
}
FcStrList *
-FcConfigGetCacheDirs (FcConfig *config)
+FcConfigGetCacheDirs (const FcConfig *config)
{
if (!config)
{
diff --git a/fontconfig/src/fcint.h b/fontconfig/src/fcint.h
index 1e39fecd1..e45df5351 100644
--- a/fontconfig/src/fcint.h
+++ b/fontconfig/src/fcint.h
@@ -544,6 +544,9 @@ FcDirCacheBuild (FcFontSet *set, const FcChar8 *dir, struct stat *dir_stat, FcSt
FcPrivate FcBool
FcDirCacheWrite (FcCache *cache, FcConfig *config);
+FcPrivate FcBool
+FcDirCacheCreateTagFile (const FcChar8 *cache_dir);
+
FcPrivate void
FcCacheObjectReference (void *object);
diff --git a/fontconfig/src/fcstr.c b/fontconfig/src/fcstr.c
index a6f0ba766..ae37ff00a 100644
--- a/fontconfig/src/fcstr.c
+++ b/fontconfig/src/fcstr.c
@@ -306,7 +306,7 @@ _FcStrRegexCmp (const FcChar8 *s, const FcChar8 *regex, int cflags, int eflags)
return ret == 0 ? FcTrue : FcFalse;
}
#else
-# define _FcStrRegexCmp(_s_, _regex_) (FcFalse)
+# define _FcStrRegexCmp(_s_, _regex_, _cflags_, _eflags_) (FcFalse)
#endif
FcBool