Open-Systems-Pharmacology / OSPSuite.ReportingEngine

R implementation of the reporting engine
https://www.open-systems-pharmacology.org/OSPSuite.ReportingEngine/
Other
5 stars 5 forks source link

failed to find or load PDF CID font #1283

Closed Yuri05 closed 3 weeks ago

Yuri05 commented 1 month ago

RE: 2.2.367 TLF: 1.5.170

Execute Evaluation/workflow.R Digoxin-Model.zip

20/09/2024 - 18:45:52
! Warning   failed to find or load PDF CID font
Configuration Plan Information:
Project: Digoxin
Simulation: Digoxin colon, 0.5 mg
SectionReference: ct-profiles-model-building
Plot: list(...)
PlotNumber: 0 (json numbering starting at 0);  1 (actual plot index)

> Error Trace
     ↪ createQualificationReport(qualificationRunnerFolder = "C:/CompletSetup_SBSuite/QualificationFramework/Version_3.1/QualificationRunner_11.1.130/", 
      ↪ workflow$runWorkflow()
       ↪ self[[plotTask]]$runTask(self$configurationPlan)
        ↪ self$getTaskResults(configurationPlan, self$settings)
         ↪ ifNotNull(timeProfilePlan$Plot$Type, plotQualificationPopulationTimeProfile(simulationAnalysis = timeProfilePlan$Plot$Analysis, 
          ↪ plotQualificationMeanTimeProfile(configurationPlanCurves = timeProfilePlan$Plot$Curves, 
           ↪ tlf::plotTimeProfile(data = simData, observedData = obsData, 
            ↪ getDualAxisPlot(leftPlotObject, rightPlotObject)
             ↪ cowplot::align_plots(leftPlotObject, rightPlotObject, align = "hv", 
              ↪ lapply(plots, function(x) {
               ↪ FUN(X[[i]], ...)
                ↪ as_gtable(x)
                 ↪ as_gtable.default(x)
                  ↪ as_grob(plot)
                   ↪ as_grob.ggplot(plot)
                    ↪ ggplot2::ggplotGrob(plot)
                     ↪ ggplot_gtable(ggplot_build(x))
                      ↪ ggplot_gtable.ggplot_built(ggplot_build(x))
                       ↪ layout$render(geom_grobs, data, theme, plot$labels)
                        ↪ render(..., self = self)
                         ↪ self$facet$draw_panels(panels, self$layout, self$panel_scales_x, 
                          ↪ draw_panels(...)
                           ↪ coord$render_axis_v(range, theme)
                            ↪ render_axis_v(...)
                             ↪ panel_guides_grob(panel_params$guides, position = "left", theme = theme, 
                              ↪ pair$guide$draw(theme, params = pair$params)
                               ↪ draw(..., self = self)
                                ↪ self$measure_grobs(grobs, params, elems)
                                 ↪ measure_grobs(...)
                                  ↪ unit(measure(grobs$labels), "cm")
                                   ↪ is.unit(x)
                                    ↪ measure(grobs$labels)
                                     ↪ vapply(x, width_cm, numeric(1))
                                      ↪ FUN(X[[i]], ...)
                                       ↪ convertWidth(grobWidth(x), "cm", TRUE)
                                        ↪ convertUnit(x, unitTo, "x", "dimension", "x", "dimension", valueOnly = valueOnly)
                                         ↪ grid.Call(C_convert, x, as.integer(whatfrom), as.integer(whatto), 
                                          ↪ (function (x) 
                                           ↪ widthDetails(x)
                                            ↪ widthDetails.text(x)
                                             ↪ grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, 
Error: failed to find or load PDF CID font
Configuration Plan Information:
Project: Digoxin
Simulation: Digoxin colon, 0.5 mg
SectionReference: ct-profiles-model-building
Plot: list(...)
PlotNumber: 0 (json numbering starting at 0);  1 (actual plot index)
In addition: Warning messages:
1: package ‘ospsuite’ was built under R version 4.4.1 
 Error: failed to find or load PDF CID font
Configuration Plan Information:
Project: Digoxin
Simulation: Digoxin colon, 0.5 mg
SectionReference: ct-profiles-model-building
Plot: list(...)
PlotNumber: 0 (json numbering starting at 0);  1 (actual plot index) 
8.
stop(errorCondition$message, call. = FALSE) 
7.
value[[3L]](cond) 
6.
tryCatchOne(expr, names, parentenv, handlers[[1L]]) 
5.
tryCatchList(expr, classes, parentenv, handlers) 
4.
tryCatch(withCallingHandlers(expr, error = function(errorCondition) {
    calls <- sys.calls()
    errorTrace <- "\n> Error Trace"
    if (requireNamespace("crayon", quietly = TRUE)) { ... 
3.
logCatch({
    mdFiles <- createSectionOutput(self$configurationPlan)
    if (self$simulate$active) {
        self$simulate$runTask(self$simulationStructures) ... 
2.
workflow$runWorkflow() at workflow.R#154
1.
createQualificationReport(qualificationRunnerFolder = "C:/CompletSetup_SBSuite/QualificationFramework/Version_3.1/QualificationRunner_11.1.130/", 
    maxSimulationsPerCore = 4, versionInfo = QualificationVersionInfo$new("1.0", 
        "11.3", "3.2")) 
Yuri05 commented 1 month ago
> sessionInfo()
R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale:
[1] LC_COLLATE=German_Germany.utf8  LC_CTYPE=German_Germany.utf8    LC_MONETARY=German_Germany.utf8 LC_NUMERIC=C                   
[5] LC_TIME=German_Germany.utf8    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ospsuite.reportingengine_2.2.367 tlf_1.5.170                      ospsuite_12.1.0.9003             rSharp_1.0.0                    

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.11           pillar_1.9.0          compiler_4.2.2        tools_4.2.2           sysfonts_0.8.8        jsonlite_1.8.8       
 [7] lifecycle_1.0.4       tibble_3.2.1          gtable_0.3.1          pkgconfig_2.0.3       rlang_1.1.3           cli_3.6.2            
[13] rstudioapi_0.15.0     commonmark_1.9.0      xfun_0.41             knitr_1.42            withr_3.0.0           dplyr_1.1.4          
[19] showtextdb_3.0        stringr_1.5.1         xml2_1.3.3            systemfonts_1.0.4     ospsuite.utils_1.5.37 generics_0.1.3       
[25] vctrs_0.6.5           cowplot_1.1.1         gridtext_0.1.5        ggtext_0.1.2          grid_4.2.2            tidyselect_1.2.0     
[31] glue_1.7.0            data.table_1.14.8     R6_2.5.1              textshaping_0.3.6     fansi_1.0.4           farver_2.1.1         
[37] tidyr_1.3.0           ggplot2_3.5.1         purrr_1.0.2           magrittr_2.0.3        scales_1.3.0          showtext_0.9-6       
[43] colorspace_2.1-0      ragg_1.2.5            labeling_0.4.2        utf8_1.2.3            stringi_1.7.12        munsell_0.5.0        
[49] markdown_1.12         crayon_1.5.2         
pchelle commented 1 month ago

@Yuri05 The issue comes from interactions between {showtext}, {ggtext} and {cowplot} in the dual axis plots: https://github.com/wilkelab/cowplot/issues/167

[!NOTE] The fix requires to point the device that is supposed to know where fonts are stored, eg cowplot::set_null_device("png")

Yuri05 commented 1 month ago

seems to fix the issue. So I assume cowplot::set_null_device("png") should be added somewhere during the initialization of the tlf package.

pchelle commented 1 month ago

seems to fix the issue. So I assume cowplot::set_null_device("png") should be added somewhere during the initialization of the tlf package.

Yes, exactly. I made a PR in tlf to fix the issue. Some tests currently fail, but once they pass. It should be good to merge.

PavelBal commented 3 weeks ago

Seems to be fixed?.

pchelle commented 3 weeks ago

Seems to be fixed?.

Yes, it seems so. The Digoxin test in RE-Test-Reports works.