Skip to content

Commit

Permalink
fix: revert flextable_dim latest modification
Browse files Browse the repository at this point in the history
- onbrand and officedown use these names and R-cmd-check complained
  • Loading branch information
davidgohel committed Jan 18, 2024
1 parent 52bf080 commit f47063d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions R/flextable_sizes.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fit_to_width <- function(x, max_width, inc = 1L, max_iter = 20, unit = "in") {
for (i in seq_len(max_iter)) {
fdim <- flextable_dim(x)
do_stop <- FALSE
if (fdim$width > max_width) {
if (fdim$widths > max_width) {
if (nrow_part(x, part = "body") > 0) {
new_font_sizes <- x$body$styles$text$font.size$data - inc
if (all(new_font_sizes > 0)) {
Expand Down Expand Up @@ -233,7 +233,7 @@ height_all <- function(x, height, part = "all", unit = "in") {
#' aspect ratio of a flextable in a named list.
#' The aspect ratio is the ratio corresponding to `height/width`.
#'
#' Names of the list are `width`, `height` and `aspect_ratio`.
#' Names of the list are `widths`, `heights` and `aspect_ratio`.
#' @param x a flextable object
#' @param unit unit for returned values, one of "in", "cm", "mm".
#' @examples
Expand All @@ -245,7 +245,6 @@ height_all <- function(x, height, part = "all", unit = "in") {
flextable_dim <- function(x, unit = "in") {
dims <- lapply(dim(x), function(x) convin(unit = unit, x = sum(x)))
dims$aspect_ratio <- dims$heights / dims$widths
names(dims) <- c("width", "height", "aspect_ratio")
dims
}

Expand Down
2 changes: 1 addition & 1 deletion man/flextable_dim.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f47063d

Please sign in to comment.