]> git.wh0rd.org - fontconfig.git/blobdiff - fc-cache/fc-cache.c
fc-cache: convert
[fontconfig.git] / fc-cache / fc-cache.c
index 59a24bbb324e5c98dfc1e1de3a686125395ff055..9bac25d7f3e6db825d85ef7a7be111df3a6cfb72 100644 (file)
@@ -67,6 +67,7 @@
 #define _GNU_SOURCE
 #include <getopt.h>
 const struct option longopts[] = {
+    {"convert", 0, 0, 'c'},
     {"force", 0, 0, 'f'},
     {"really-force", 0, 0, 'r'},
     {"root", 1, 0, 'R'},
@@ -386,13 +387,18 @@ main (int argc, char **argv)
 #if HAVE_GETOPT_LONG || HAVE_GETOPT
     int                c;
 
+FcBool convert = FcFalse;
+
 #if HAVE_GETOPT_LONG
-    while ((c = getopt_long (argc, argv, "frR:sVvh", longopts, NULL)) != -1)
+    while ((c = getopt_long (argc, argv, "cfrR:sVvh", longopts, NULL)) != -1)
 #else
-    while ((c = getopt (argc, argv, "frR:sVvh")) != -1)
+    while ((c = getopt (argc, argv, "cfrR:sVvh")) != -1)
 #endif
     {
        switch (c) {
+       case 'c':
+           convert = FcTrue;
+           break;
        case 'r':
            really_force = FcTrue;
            /* fall through */
@@ -423,6 +429,20 @@ main (int argc, char **argv)
     i = 1;
 #endif
 
+    if (convert)
+    {
+       const FcChar8 *src_cache, *dst_cache, *src_type, *dst_type;
+
+       src_cache = (const FcChar8 *) argv[i++];
+       src_type = (const FcChar8 *) argv[i++];
+       dst_cache = (const FcChar8 *) argv[i++];
+       dst_type = (const FcChar8 *) argv[i++];
+
+       FcDirCacheConvert (src_cache, src_type, dst_cache, dst_type);
+
+       return 0;
+    }
+
     if (systemOnly)
        FcConfigEnableHome (FcFalse);
     config = FcInitLoadConfig ();