Skip to contents

Resize generic layouts to fit a desired textblock width, and filter out layouts that are too large for the specified stock paper.

Usage

fit_layouts_to_text_width(
  target_text_width,
  fontsize = c("10pt", "11pt", "12pt"),
  max_page_height = 8.5,
  max_page_width = 5.5
)

Arguments

target_text_width

desired textblock width in inches

fontsize

base font size for document, used to estimate the number of lines of text the textblock can accommodate

max_page_height, max_page_width

maximum page dimensions (default assumes layout is printed on letter paper folded in half)

Value

Returns layouts plus three additional columns: font_size, min_lines, & max_lines.

Examples

str(fit_layouts_to_text_width(4))
#> tibble [91 × 26] (S3: tbl_df/tbl/data.frame)
#>  $ page_ratio    : Factor w/ 13 levels "unison","minor 2nd",..: 6 6 6 6 6 6 8 7 7 3 ...
#>  $ page_2up_ratio: Factor w/ 13 levels "unison","inverse minor 2nd",..: 8 8 8 8 8 8 5 6 6 11 ...
#>  $ text_ratio    : Factor w/ 14 levels "minor 2nd","major 2nd",..: 6 6 6 6 6 6 6 5 5 5 ...
#>  $ text_2up_ratio: Factor w/ 24 levels "unison","minor 2nd",..: 13 13 13 13 13 13 13 18 18 18 ...
#>  $ bt_ratio      : Factor w/ 13 levels "minor 2nd","major 2nd",..: 6 6 6 8 12 12 12 11 13 11 ...
#>  $ oi_ratio      : Factor w/ 16 levels "unison","minor 2nd",..: 13 12 5 13 13 7 1 13 6 13 ...
#>  $ ot_ratio      : Factor w/ 14 levels "unison","minor 2nd",..: 11 11 11 12 13 13 1 1 6 14 ...
#>  $ ob_ratio      : Factor w/ 26 levels "unison","minor 2nd",..: 8 8 8 6 1 1 25 23 25 22 ...
#>  $ ti_ratio      : Factor w/ 14 levels "unison","minor 2nd",..: 2 1 8 1 8 13 1 12 1 13 ...
#>  $ bi_ratio      : Factor w/ 14 levels "unison","minor 2nd",..: 8 7 1 9 12 7 13 14 14 1 ...
#>  $ oii_ratio     : Factor w/ 16 levels "unison","inverse minor 2nd",..: 1 2 9 1 1 6 14 1 8 1 ...
#>  $ tii_ratio     : Factor w/ 14 levels "unison","inverse minor 2nd",..: 11 12 13 12 13 14 12 1 12 14 ...
#>  $ bii_ratio     : Factor w/ 14 levels "unison","inverse minor 2nd",..: 5 6 14 4 1 6 7 13 13 14 ...
#>  $ text_pct      : num [1:91] 0.595 0.609 0.685 0.595 0.595 ...
#>  $ page_height   : num [1:91] 7.33 7.25 6.83 7.33 7.33 ...
#>  $ page_width    : num [1:91] 5.5 5.44 5.12 5.5 5.5 ...
#>  $ text_height   : num [1:91] 6 6 6 6 6 ...
#>  $ text_width    : num [1:91] 4 4 4 4 4 4 4 4 4 4 ...
#>  $ b_mar         : num [1:91] 0.8 0.75 0.5 0.833 1 ...
#>  $ t_mar         : num [1:91] 0.533 0.5 0.333 0.5 0.333 ...
#>  $ o_mar         : num [1:91] 1 0.937 0.625 1 1 ...
#>  $ i_mar         : num [1:91] 0.5 0.5 0.5 0.5 0.5 ...
#>  $ error         : num [1:91] 5.02e-09 6.29e-09 4.14e-09 5.02e-09 5.02e-09 ...
#>  $ font_size     : int [1:91] 10 10 10 10 10 10 10 10 10 10 ...
#>  $ min_lines     : num [1:91] 37 37 37 37 37 37 37 33 33 33 ...
#>  $ max_lines     : num [1:91] 43 43 43 43 43 43 43 38 38 38 ...