Skip to content

Commit

Permalink
retrieve font, not fontface in set_context_fontface, change fontface …
Browse files Browse the repository at this point in the history
…char to font int
  • Loading branch information
netique committed Apr 21, 2022
1 parent bad2607 commit b410f97
Showing 1 changed file with 3 additions and 3 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$fontface
fontface_old <- drawing_context$gp$font

# combine bold and italic if needed
if (!isTRUE(overwrite)) {
if (isTRUE(fontface == "italic") && isTRUE(fontface_old == "bold")) {
if (isTRUE(fontface == "italic") && isTRUE(fontface_old == 2)) { # see ?grid::gpar for fontface codes
fontface <- "bold.italic"
} else if (isTRUE(fontface == "bold") && isTRUE(fontface_old == "italic")) {
} else if (isTRUE(fontface == "bold") && isTRUE(fontface_old == 3)) {
fontface <- "bold.italic"
}
}
Expand Down

0 comments on commit b410f97

Please sign in to comment.