diff --git a/NEWS.md b/NEWS.md index 7a3e7a5..6ffae0f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # gridify 0.7.6.9000 +* Updated `README.md` file. +* Updated description how to convert points to pixels, example in `README.md` file. * Removed `rtables` examples as installation of `rtables.officer` requires R >= 4.4.0. # gridify 0.7.6 diff --git a/R/layout_issues.R b/R/layout_issues.R index 4684135..472177f 100644 --- a/R/layout_issues.R +++ b/R/layout_issues.R @@ -71,7 +71,7 @@ #' unit pixels (`px`), whilst the `grid` package, on which `gridify` is built, #' assumes points (`pt`). As a result, even if you set the font sizes in both #' `gt` and `gridify` (using `grid::gpar()`) to the same number, they may -#' still appear different. To convert point size to pixel size, multiply the point size by 4/3. +#' still appear different. To convert point size to pixel size, multiply the point size by `96 / 72`. #' #' @name layout_issue NULL diff --git a/README.md b/README.md index 5b30a93..453d973 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,10 @@ tab <- gt::gt(head(mtcars, n = 10)) |> table.width = gt::pct(100), data_row.padding = gt::px(10), table_body.hlines.color = "white", - table.font.size = 12 + # gt font size is in pixels + # Multiply points by 96/72 to get pixels + table.font.size = 10 * 96 / 72, + table.font.names = "sans" ) # Use `gridify()` to create a `gridify` object @@ -84,7 +87,7 @@ gridify_object <- gridify( # Choose a layout (predefined or custom) layout = pharma_layout_base( margin = grid::unit(c(0.5, 0.5, 0.5, 0.5), "inches"), - global_gpar = grid::gpar(fontfamily = "serif", fontsize = 10) + global_gpar = grid::gpar(fontfamily = "sans", fontsize = 10) ) ) # Print the `gridify` object to see empty cells diff --git a/man/complex_layout.Rd b/man/complex_layout.Rd index 3b83f47..8d109ae 100644 --- a/man/complex_layout.Rd +++ b/man/complex_layout.Rd @@ -118,7 +118,7 @@ When specifying font sizes, the \code{gt} package interprets values as having th unit pixels (\code{px}), whilst the \code{grid} package, on which \code{gridify} is built, assumes points (\code{pt}). As a result, even if you set the font sizes in both \code{gt} and \code{gridify} (using \code{grid::gpar()}) to the same number, they may -still appear different. To convert point size to pixel size, multiply the point size by 4/3. +still appear different. To convert point size to pixel size, multiply the point size by \code{96 / 72}. } \examples{ complex_layout() diff --git a/man/figures/README-example-1.png b/man/figures/README-example-1.png index 0a55e48..4186d0a 100644 Binary files a/man/figures/README-example-1.png and b/man/figures/README-example-1.png differ diff --git a/man/layout_issue.Rd b/man/layout_issue.Rd index 6d67cd9..561b179 100644 --- a/man/layout_issue.Rd +++ b/man/layout_issue.Rd @@ -75,5 +75,5 @@ When specifying font sizes, the \code{gt} package interprets values as having th unit pixels (\code{px}), whilst the \code{grid} package, on which \code{gridify} is built, assumes points (\code{pt}). As a result, even if you set the font sizes in both \code{gt} and \code{gridify} (using \code{grid::gpar()}) to the same number, they may -still appear different. To convert point size to pixel size, multiply the point size by 4/3. +still appear different. To convert point size to pixel size, multiply the point size by \code{96 / 72}. } diff --git a/man/pharma_layout.Rd b/man/pharma_layout.Rd index 74a06b0..ae060b1 100644 --- a/man/pharma_layout.Rd +++ b/man/pharma_layout.Rd @@ -78,7 +78,7 @@ When specifying font sizes, the \code{gt} package interprets values as having th unit pixels (\code{px}), whilst the \code{grid} package, on which \code{gridify} is built, assumes points (\code{pt}). As a result, even if you set the font sizes in both \code{gt} and \code{gridify} (using \code{grid::gpar()}) to the same number, they may -still appear different. To convert point size to pixel size, multiply the point size by 4/3. +still appear different. To convert point size to pixel size, multiply the point size by \code{96 / 72}. } \section{Available Layouts}{ diff --git a/man/pharma_layout_A4.Rd b/man/pharma_layout_A4.Rd index 2e245c6..4a7cf50 100644 --- a/man/pharma_layout_A4.Rd +++ b/man/pharma_layout_A4.Rd @@ -103,7 +103,7 @@ When specifying font sizes, the \code{gt} package interprets values as having th unit pixels (\code{px}), whilst the \code{grid} package, on which \code{gridify} is built, assumes points (\code{pt}). As a result, even if you set the font sizes in both \code{gt} and \code{gridify} (using \code{grid::gpar()}) to the same number, they may -still appear different. To convert point size to pixel size, multiply the point size by 4/3. +still appear different. To convert point size to pixel size, multiply the point size by \code{96 / 72}. } \examples{ pharma_layout_A4() diff --git a/man/pharma_layout_base.Rd b/man/pharma_layout_base.Rd index cbf7224..3eaea02 100644 --- a/man/pharma_layout_base.Rd +++ b/man/pharma_layout_base.Rd @@ -107,7 +107,7 @@ When specifying font sizes, the \code{gt} package interprets values as having th unit pixels (\code{px}), whilst the \code{grid} package, on which \code{gridify} is built, assumes points (\code{pt}). As a result, even if you set the font sizes in both \code{gt} and \code{gridify} (using \code{grid::gpar()}) to the same number, they may -still appear different. To convert point size to pixel size, multiply the point size by 4/3. +still appear different. To convert point size to pixel size, multiply the point size by \code{96 / 72}. } \examples{ # Create a general pharma layout with default settings diff --git a/man/pharma_layout_letter.Rd b/man/pharma_layout_letter.Rd index a16bda3..c512312 100644 --- a/man/pharma_layout_letter.Rd +++ b/man/pharma_layout_letter.Rd @@ -103,7 +103,7 @@ When specifying font sizes, the \code{gt} package interprets values as having th unit pixels (\code{px}), whilst the \code{grid} package, on which \code{gridify} is built, assumes points (\code{pt}). As a result, even if you set the font sizes in both \code{gt} and \code{gridify} (using \code{grid::gpar()}) to the same number, they may -still appear different. To convert point size to pixel size, multiply the point size by 4/3. +still appear different. To convert point size to pixel size, multiply the point size by \code{96 / 72}. } \examples{ pharma_layout_letter() diff --git a/man/simple_layout.Rd b/man/simple_layout.Rd index 5857b00..af8dabf 100644 --- a/man/simple_layout.Rd +++ b/man/simple_layout.Rd @@ -114,7 +114,7 @@ When specifying font sizes, the \code{gt} package interprets values as having th unit pixels (\code{px}), whilst the \code{grid} package, on which \code{gridify} is built, assumes points (\code{pt}). As a result, even if you set the font sizes in both \code{gt} and \code{gridify} (using \code{grid::gpar()}) to the same number, they may -still appear different. To convert point size to pixel size, multiply the point size by 4/3. +still appear different. To convert point size to pixel size, multiply the point size by \code{96 / 72}. } \examples{ simple_layout()