insightsengineering / tern

Table, Listings, and Graphs (TLG) library for common outputs used in clinical trials
https://insightsengineering.github.io/tern/
Other
76 stars 21 forks source link

[Bug]: decorate_grob title/footnote do not wrap correctly #1096

Closed clarkliming closed 11 months ago

clarkliming commented 1 year ago

What happened?

decorate_grob title/footnote do not wrap correctly. title the wrapped is too long while footnote is too short

sessionInfo()

R version 4.2.2 Patched (2022-11-10 r83330)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.5 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] ggplot2_3.4.1

loaded via a namespace (and not attached):
 [1] pillar_1.8.1          compiler_4.2.2        rtables_0.6.4.9003   
 [4] tools_4.2.2           digest_0.6.31         jsonlite_1.8.4       
 [7] lifecycle_1.0.3       tibble_3.2.0          gtable_0.3.1         
[10] checkmate_2.1.0       lattice_0.20-45       pkgconfig_2.0.3      
[13] rlang_1.1.1           Matrix_1.5-3          cli_3.6.0            
[16] fastmap_1.1.0         withr_2.5.0           dplyr_1.1.0          
[19] generics_0.1.3        vctrs_0.5.2           grid_4.2.2           
[22] tidyselect_1.2.0      glue_1.6.2            R6_2.5.1             
[25] fansi_1.0.4           Rdpack_2.4            survival_3.5-3       
[28] tern_0.9.1.9002       farver_2.1.1          purrr_1.0.1          
[31] tidyr_1.3.0           magrittr_2.0.3        backports_1.4.1      
[34] scales_1.2.1          htmltools_0.5.4       formatters_0.5.3.9002
[37] rbibutils_2.2.13      splines_4.2.2         colorspace_2.1-0     
[40] labeling_0.4.2        utf8_1.2.3            munsell_0.5.0        
[43] broom_1.0.3

Relevant log output

library(ggplot2)

a <- ggplot(iris) +
  geom_point(aes(x = Sepal.Length, y = Sepal.Width))

png('abc.png')
b <- tern::decorate_grob(
  ggplotGrob(a),
  "this is title that is very long dasd asdas dasljdklasjdklasjlk dakldsj akldjakls jkald jaklsj dklsajklaj skldajkl jsakldjal jsadlk dasj lasjdlkasjkl ajskld asl jalksjd lkasjlk alkj dlkadlka sjd lakjsdl a",
  "this is footnotes that is super super supre long long asdad as dasd ad ada ad asdadkhasdalksjdlkaj kdlajskl dsajlkd ajldja lkdjas jdklas jdkasj dlasl;jd klasjdkl aldja lkjdlkaj lkfjalksd a",
)
grid::grid.draw(b)
dev.off()

Code of Conduct

Contribution Guidelines

Security Policy

clarkliming commented 1 year ago

abc