Blame 0001-Load-existing-font-file.patch

530388b
From 5e63b9ef263d519ffe12d1471874d2442eb3a591 Mon Sep 17 00:00:00 2001
eecc79d
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
eecc79d
Date: Sat, 2 Jun 2018 23:13:06 -0400
eecc79d
Subject: [PATCH] Load existing font file.
eecc79d
eecc79d
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
eecc79d
---
530388b
 R/load_showtext_fonts.R | 21 ++-------------------
530388b
 1 file changed, 2 insertions(+), 19 deletions(-)
eecc79d
eecc79d
diff --git a/R/load_showtext_fonts.R b/R/load_showtext_fonts.R
530388b
index 1d86255..23449b1 100644
eecc79d
--- a/R/load_showtext_fonts.R
eecc79d
+++ b/R/load_showtext_fonts.R
530388b
@@ -31,26 +31,9 @@ load_default_font = function()
eecc79d
     if(already_loaded("wqy-microhei"))
eecc79d
         return(invisible(NULL))
530388b
 
eecc79d
-    ## Extract font file
eecc79d
-    font_file = system.file("fonts", "wqy-microhei.ttc.zip", package = "showtextdb")
eecc79d
-    out_dir = tempdir()
eecc79d
-    out_file = file.path(out_dir, "wqy-microhei.ttc")
eecc79d
-    if(!file.exists(out_file))
530388b
-    {
530388b
-        ## Test for write permission
530388b
-        if(file.access(out_dir, mode = 2) < 0)
530388b
-        {
530388b
-            msg = paste("the temporary directory ", out_dir,
530388b
-                        " does not have write permission,\n",
530388b
-                        "failed to load the 'WenQuanYi Micro Hei' font", sep = "")
530388b
-            warning(msg)
530388b
-            return(invisible(NULL))
530388b
-        }
eecc79d
-        utils::unzip(font_file, exdir = out_dir, overwrite = FALSE)
530388b
-    }
530388b
-
eecc79d
     ## Add font to sysfonts
eecc79d
-    sysfonts::font_add("wqy-microhei", out_file)
530388b
+    font_file = system.file("fonts", "wqy-microhei.ttc", package = "showtextdb")
eecc79d
+    sysfonts::font_add("wqy-microhei", font_file)
530388b
 
eecc79d
     invisible(NULL)
eecc79d
 }
eecc79d
-- 
530388b
2.25.4
eecc79d