Skip to content

Commit

Permalink
accept proposed changes from review
Browse files Browse the repository at this point in the history
  • Loading branch information
netique committed Apr 22, 2022
1 parent b410f97 commit 82a0b13
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions R/drawing-context.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ set_context_gp <- function(drawing_context, gp = NULL) {

# update the fontface of a drawing context
set_context_fontface <- function(drawing_context, fontface = "plain", overwrite = FALSE) {
fontface_old <- drawing_context$gp$font
font_old <- drawing_context$gp$font

# combine bold and italic if needed
if (!isTRUE(overwrite)) {
if (isTRUE(fontface == "italic") && isTRUE(fontface_old == 2)) { # see ?grid::gpar for fontface codes
if (isTRUE(fontface == "italic") && isTRUE(font_old == 2)) { # see ?grid::gpar for fontface codes
fontface <- "bold.italic"
} else if (isTRUE(fontface == "bold") && isTRUE(fontface_old == 3)) {
} else if (isTRUE(fontface == "bold") && isTRUE(font_old == 3)) {
fontface <- "bold.italic"
}
}
Expand Down
8 changes: 4 additions & 4 deletions R/text-details.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
#'
#' Calculate text details for a given text label
#' @param label Character vector containing the label. Can handle only one label at a time.
#' @param gp Grid graphical parameters defining the font (`fontfamily`, `font`, and
#' @param gp Grid graphical parameters defining the font (`fontfamily`, `fontface`, and
#' `fontsize` should be defined).
#' @examples
#' text_details("Hello world!", grid::gpar(fontfamily = "", font = "plain", fontsize = 12))
#' text_details("Hello world!", grid::gpar(fontfamily = "", font = "plain", fontsize = 24))
#' text_details("Hello world!", grid::gpar(fontfamily = "", fontface = "plain", fontsize = 12))
#' text_details("Hello world!", grid::gpar(fontfamily = "", fontface = "plain", fontsize = 24))
#' text_details(
#' "Hello world\nwith newline",
#' grid::gpar(fontfamily = "", font = "plain", fontsize = 12)
#' grid::gpar(fontfamily = "", fontface = "plain", fontsize = 12)
#' )
#' @noRd
text_details <- function(label, gp = gpar()) {
Expand Down

0 comments on commit 82a0b13

Please sign in to comment.