title: Azure ML Studio saved plots have boxes instead of characters
body: <p><strong>Context &amp; Update:</strong> I've rewritten this post to reflect latest findings (problem as yet unresolved)</p>
  <p>Using Azure Machine Learning Studio to run an &quot;Execute R script&quot; task. Using a compute cluster, which shuts down after running the pipeline (so no console access but can save files as logs to view after shutdown). Environment is Ubuntu and R version it loads is 3.5.1 (Session Info). I am creating plots <code>png</code> and then saving them into an Excel workbook <code>openxlsx</code>, and finally saving and retrieving this in Azure file storage. This file management is done with the <code>azuremlsdk</code> library</p>
  <p><strong>The issue I am having is that the characters on the plots are &quot;squares&quot; or &quot;boxes&quot;, also seen referred as &quot;glyphs&quot;</strong></p>
  <p><a href="https://i.stack.imgur.com/NXVS6.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NXVS6.jpg" alt="png imported into excel clip" /></a></p>
  <p>I've provided a code sample (although not completely reproducible as it requires Azure) to show the simple test I am running</p>
  <pre><code>library(ggplot2)
  library(openxlsx)
  imageName &lt;- &quot;testplot.png&quot;
  png(imageName)
  plot(price ~ carat, data = diamonds, main = &quot;Price vs Carat&quot;)
  dev.off()
  wb &lt;- createWorkbook()
  addWorksheet(wb, &quot;testplotsheet&quot;, gridLines = TRUE)
  insertImage(wb, &quot;testplotsheet&quot;, imageName)
  saveWorkbook(wb, file = xlName, overwrite = TRUE)
  </code></pre>
  <p>sessioninfo &amp; capabilities outputs</p>
  <pre><code>R version 3.5.1 (2018-07-02)
  Platform: x86_64-conda_cos6-linux-gnu (64-bit)
  Running under: Ubuntu 18.04.6 LTS
  
  Matrix products: default
  BLAS: /azureml-envs/azureml_6ff64eff0a652bbe0bb1d84fc0884554/lib/R/lib/libRblas.so
  LAPACK: /azureml-envs/azureml_6ff64eff0a652bbe0bb1d84fc0884554/lib/R/lib/libRlapack.so
  
  locale:
   [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8       
   [4] LC_COLLATE=C.UTF-8     LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
   [7] LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C          
  [10] LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
  [1] tibble_3.0.1      ggplot2_3.3.0     azuremlsdk_1.10.0 openxlsx_4.2.5   
  [5] dplyr_0.8.5       jsonlite_1.6.1    reticulate_1.12  
  
  loaded via a namespace (and not attached):
   [1] Rcpp_1.0.8       magrittr_1.5     tidyselect_1.0.0 munsell_0.5.0   
   [5] colorspace_1.4-1 lattice_0.20-41  R6_2.4.1         rlang_1.0.1     
   [9] tools_3.5.1      grid_3.5.1       gtable_0.3.0     withr_2.2.0     
  [13] ellipsis_0.3.0   assertthat_0.2.1 lifecycle_0.2.0  crayon_1.3.4    
  [17] Matrix_1.2-18    zip_2.2.0        purrr_0.3.4      vctrs_0.2.4     
  [21] glue_1.4.0       stringi_1.4.3    compiler_3.5.1   pillar_1.4.3    
  [25] scales_1.1.0     pkgconfig_2.0.3 
  
            name value
  1         jpeg  TRUE
  2          png  TRUE
  3         tiff  TRUE
  4        tcltk  TRUE
  5          X11 FALSE
  6         aqua FALSE
  7     http/ftp  TRUE
  8      sockets  TRUE
  9       libxml  TRUE
  10        fifo  TRUE
  11      cledit FALSE
  12       iconv  TRUE
  13         NLS  TRUE
  14     profmem  TRUE
  15       cairo  TRUE
  16         ICU  TRUE
  17 long.double  TRUE
  18     libcurl  TRUE
  
  </code></pre>
  <p>From another post on stackoverflow: <strong>Boxes show up when there is a mismatch between Unicode characters in the document and those supported by the font. Specifically, the boxes represent characters not supported by the selected font.</strong></p>
  <p>Results from various things I have tried:</p>
  <p><code>Cairo</code> : can't install because missing &quot;cairo.h&quot;</p>
  <p><code>par(family =&quot;Ubuntu Mono&quot;)</code> (used <em>after</em> runing <code>png</code> as suggested) didn't change anything</p>
  <p><code>Sys.setlocale(&quot;LC_ALL&quot;, 'en_US.UTF-8')</code> (suggested on ms forum) didn't change the LC settings, but also does not seem supported based on checking available locales on the system <code>system(&quot;locale -a&quot;, intern = TRUE)</code></p>
  <pre><code>[1] &quot;C&quot;       &quot;C.UTF-8&quot; &quot;POSIX&quot;  
  </code></pre>
  <p>I've seen a suggestion to use <code>iconv</code>, but don't know how to incorporate this into the code above. How could I use this or is it irrelevant?</p>
  <p>This seemed significant:</p>
  <p><strong><code>sysfonts</code> is not installed, and can't install it due to missing <code>zlib</code>. This also prevents me from installing <code>showtext</code></strong></p>
  <ul>
  <li>do <code>png</code> and other graphics device rely on <code>sysfonts</code> to create characters in images?</li>
  <li>is this  why the <code>family</code> and <code>type</code> global settings or parameters in <code>plot</code>, <code>png</code> etc do nothing?</li>
  </ul>
  <p>Are there any fonts available I wondered? <code>font.families</code>, <code>font.files</code>, <code>font_families</code> &amp; <code>font_files</code> all blank or error</p>
  <p>I did manage to locate some <code>*.ttf</code> files on the system, (not in any recognised fonts folder location), so thought perhaps I can load them or force R to use them for the <code>png</code> device</p>
  <p><code>extrafont</code> tried to use this to add fonts.  however because <code>font_import</code> function requires responding to a y/n prompt, not sure if it loads. I saved the output for <code>fonts()</code> but blank, so probably not</p>
  <ul>
  <li>Any other way to force <code>png</code> to use one of these <code>ttf</code> font files?</li>
  </ul>
  <p><code>pdf</code> this actually works! I can get characters to display saving the same output in <code>pdf</code>, does this use its own fonts? This seems to imply that it should be possible to get characters to display on <code>png</code></p>
  <p>At this point I am seeing if our Engineers can access a different compute because all these problems seem to stem from an outdated/inadequate R and Ubuntu environment. However, if there are any other ideas to get these characters to display, I welcome suggestions!</p>