Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: wilkelab/gridtext
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.1.0
Choose a base ref
...
head repository: wilkelab/gridtext
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Jan 24, 2020

  1. bump version post release

    clauswilke committed Jan 24, 2020
    Copy the full SHA
    351d539 View commit details

Commits on Feb 3, 2020

  1. Copy the full SHA
    6746a9e View commit details
  2. handle NAs.

    clauswilke committed Feb 3, 2020
    Copy the full SHA
    5cc4b40 View commit details

Commits on Feb 21, 2020

  1. Copy the full SHA
    1fe736a View commit details

Commits on Feb 24, 2020

  1. Copy the full SHA
    d8ea5cf View commit details
  2. Copy the full SHA
    d376ece View commit details

Commits on May 3, 2020

  1. Copy the full SHA
    bf752d0 View commit details

Commits on Sep 26, 2020

  1. Fix grob name forwarding

    forward `name` argument to gTree creation in `textbox_grob()`
    matthewstern authored Sep 26, 2020
    Copy the full SHA
    873125a View commit details

Commits on Sep 27, 2020

  1. Merge pull request #14 from matthewstern/master

    Fix grob name forwarding
    clauswilke authored Sep 27, 2020
    Copy the full SHA
    e12e676 View commit details

Commits on Nov 26, 2020

  1. switch over to testthat 3

    clauswilke committed Nov 26, 2020
    Copy the full SHA
    1347723 View commit details
  2. Copy the full SHA
    054b1b9 View commit details
  3. add github actions

    clauswilke committed Nov 26, 2020
    Copy the full SHA
    050bcbb View commit details
  4. Copy the full SHA
    b07e11d View commit details
  5. turn off vdiffr on devel

    clauswilke committed Nov 26, 2020
    Copy the full SHA
    115285b View commit details
  6. coverage test

    clauswilke committed Nov 26, 2020
    Copy the full SHA
    f6926e3 View commit details
  7. fix coverage workflow

    clauswilke committed Nov 26, 2020
    Copy the full SHA
    aad4857 View commit details
  8. env not needed

    clauswilke committed Nov 26, 2020
    Copy the full SHA
    ffcba72 View commit details

Commits on Nov 27, 2020

  1. rebuild website

    clauswilke committed Nov 27, 2020
    Copy the full SHA
    b45723f View commit details
  2. update documentation

    clauswilke committed Nov 27, 2020
    Copy the full SHA
    2ea738b View commit details
  3. rebuild site

    clauswilke committed Nov 27, 2020
    Copy the full SHA
    996cae5 View commit details

Commits on Dec 1, 2020

  1. Copy the full SHA
    9f93804 View commit details
  2. rebuild site

    clauswilke committed Dec 1, 2020
    Copy the full SHA
    909ba5f View commit details

Commits on Dec 10, 2020

  1. update to version 0.1.4

    clauswilke committed Dec 10, 2020
    Copy the full SHA
    519eea2 View commit details
  2. forgot to add

    clauswilke committed Dec 10, 2020
    Copy the full SHA
    0237bd5 View commit details
  3. bump version post release

    clauswilke committed Dec 10, 2020
    Copy the full SHA
    0baa935 View commit details

Commits on Jul 27, 2021

  1. Copy the full SHA
    7eb9869 View commit details
  2. Undo Version bump

    mrcaseb committed Jul 27, 2021
    Copy the full SHA
    2443c2d View commit details
  3. add test for get_file()

    mrcaseb committed Jul 27, 2021
    Copy the full SHA
    823f71b View commit details
  4. skip new test on cran

    mrcaseb committed Jul 27, 2021
    Copy the full SHA
    4cd43a2 View commit details

Commits on Jul 28, 2021

  1. use new test image

    mrcaseb committed Jul 28, 2021
    Copy the full SHA
    73c41fc View commit details
  2. Merge pull request #20 from mrcaseb/transition-to-curl-package

    Drop RCurl dependency and use curl instead
    clauswilke authored Jul 28, 2021
    Copy the full SHA
    8c8fb73 View commit details

Commits on Apr 21, 2022

  1. use font instead of fontface

    netique committed Apr 21, 2022
    Copy the full SHA
    ef5f1aa View commit details
  2. Copy the full SHA
    bad2607 View commit details
  3. Copy the full SHA
    b410f97 View commit details

Commits on Apr 22, 2022

  1. Copy the full SHA
    12f520b View commit details
  2. Copy the full SHA
    82a0b13 View commit details
  3. add NEWS bullet

    netique committed Apr 22, 2022
    Copy the full SHA
    13f28b7 View commit details
  4. Merge pull request #26 from MichaelChirico/patch-1

    inline function definition in header
    clauswilke authored Apr 22, 2022
    Copy the full SHA
    6d6c03e View commit details
  5. Merge pull request #25 from netique/master

    Solve #24 – use `font` gpar instead of `fontface` to work with R 4.2.0
    clauswilke authored Apr 22, 2022
    Copy the full SHA
    6192174 View commit details

Commits on Sep 15, 2022

  1. Update CRAN version

    bwiernik committed Sep 15, 2022
    Copy the full SHA
    4993c3c View commit details
  2. Copy the full SHA
    09d71ab View commit details

Commits on Feb 28, 2024

  1. Typo

    kylebutts authored Feb 28, 2024
    Copy the full SHA
    69fb0c3 View commit details
  2. Copy the full SHA
    391684c View commit details
Showing with 1,433 additions and 892 deletions.
  1. +1 −0 .Rbuildignore
  2. +83 −0 .github/workflows/R-CMD-check.yaml
  3. +48 −0 .github/workflows/test-coverage.yaml
  4. +0 −22 .travis.yml
  5. +0 −2 CRAN-RELEASE
  6. +20 −14 DESCRIPTION
  7. +24 −0 NEWS.md
  8. +0 −6 R/catch-routine-registration.R
  9. +5 −5 R/drawing-context.R
  10. +1 −1 R/read-image.R
  11. +3 −1 R/richtext-grob.R
  12. +11 −11 R/text-details.R
  13. +5 −2 R/textbox-grob.R
  14. +9 −8 README.Rmd
  15. +11 −15 README.md
  16. +0 −52 appveyor.yml
  17. +5 −12 cran-comments.md
  18. +148 −0 docs/404.html
  19. +35 −12 docs/ISSUE_TEMPLATE.html
  20. +36 −13 docs/LICENSE-text.html
  21. +35 −12 docs/LICENSE.html
  22. +30 −13 docs/authors.html
  23. +60 −0 docs/bootstrap-toc.css
  24. +159 −0 docs/bootstrap-toc.js
  25. +128 −121 docs/index.html
  26. +64 −24 docs/news/index.html
  27. +148 −17 docs/pkgdown.css
  28. +4 −11 docs/pkgdown.js
  29. +3 −2 docs/pkgdown.yml
  30. BIN docs/reference/Rplot001.png
  31. BIN docs/reference/Rplot002.png
  32. BIN docs/reference/Rplot003.png
  33. BIN docs/reference/Rplot004.png
  34. BIN docs/reference/figures/README-unnamed-chunk-4-1.png
  35. BIN docs/reference/figures/README-unnamed-chunk-5-1.png
  36. BIN docs/reference/figures/README-unnamed-chunk-6-1.png
  37. BIN docs/reference/figures/README-unnamed-chunk-7-1.png
  38. BIN docs/reference/figures/README-unnamed-chunk-8-1.png
  39. +34 −19 docs/reference/gridtext.html
  40. +38 −17 docs/reference/index.html
  41. BIN docs/reference/richtext_grob-1.png
  42. BIN docs/reference/richtext_grob-2.png
  43. +90 −75 docs/reference/richtext_grob.html
  44. BIN docs/reference/textbox_grob-1.png
  45. BIN docs/reference/textbox_grob-2.png
  46. BIN docs/reference/textbox_grob-3.png
  47. +134 −114 docs/reference/textbox_grob.html
  48. BIN man/figures/README-unnamed-chunk-4-1.png
  49. BIN man/figures/README-unnamed-chunk-5-1.png
  50. BIN man/figures/README-unnamed-chunk-6-1.png
  51. BIN man/figures/README-unnamed-chunk-7-1.png
  52. BIN man/figures/README-unnamed-chunk-8-1.png
  53. +1 −1 man/richtext_grob.Rd
  54. +5 −3 src/RcppExports.cpp
  55. +5 −11 src/grid.cpp
  56. +1 −1 src/raster-box.h
  57. +0 −20 src/test-layout.cpp
  58. +0 −32 src/test-line-breaker.cpp
  59. +0 −7 src/test-runner.cpp
  60. +1 −1 tests/figs/deps.txt
  61. +0 −41 tests/figs/rich-text-grob/aligned-heights.svg
  62. +0 −41 tests/figs/rich-text-grob/aligned-widths.svg
  63. +0 −47 tests/figs/rich-text-grob/various-text-boxes.svg
  64. BIN tests/figs/test_image.png
  65. +0 −53 tests/figs/text-box-grob/box-spanning-entire-viewport-with-margins.svg
  66. +4 −0 tests/testthat/helper-vdiffr.R
  67. +0 −5 tests/testthat/test-cpp.R
  68. +10 −0 tests/testthat/test-get_file.R
  69. +0 −2 tests/testthat/test-grid-constructors.R
  70. +4 −4 tests/testthat/test-grid-renderer.R
  71. +0 −2 tests/testthat/test-null-box.R
  72. +0 −2 tests/testthat/test-raster-box.R
  73. +0 −2 tests/testthat/test-rect-box.R
  74. +14 −5 tests/testthat/test-richtext-grob.R
  75. +0 −2 tests/testthat/test-text-details.R
  76. +16 −7 tests/testthat/test-textbox-grob.R
  77. +0 −2 tests/testthat/test-vbox.R
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
^\.Rproj\.user$
^\.travis\.yml$
^\.codecov\.yml$
^\.github$
^_pkgdown\.yml$
^README\.Rmd$
^cran-comments\.md$
83 changes: 83 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: windows-latest, r: 'release', vdiffr: true}
- {os: macOS-latest, r: 'release', vdiffr: true}
- {os: ubuntu-20.04, r: 'release', vdiffr: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: 'devel', vdiffr: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
VDIFFR_RUN_TESTS: ${{ matrix.config.vdiffr }}
VDIFFR_LOG_PATH: "../vdiffr.Rout.fail"

steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v1
with:
r-version: ${{ matrix.config.r }}

- uses: r-lib/actions/setup-pandoc@v1

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}

- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Install system dependencies
if: runner.os == 'Linux'
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
shell: Rscript {0}

- name: Check
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
48 changes: 48 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master

name: test-coverage

jobs:
test-coverage:
runs-on: macOS-latest

steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v1

- uses: r-lib/actions/setup-pandoc@v1

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}

- name: Cache R packages
uses: actions/cache@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Install dependencies
run: |
install.packages(c("remotes"))
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("covr")
shell: Rscript {0}

- name: Test coverage
run: covr::codecov()
shell: Rscript {0}

22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

2 changes: 0 additions & 2 deletions CRAN-RELEASE

This file was deleted.

34 changes: 20 additions & 14 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,30 +1,39 @@
Package: gridtext
Type: Package
Title: Improved Text Rendering Support for 'Grid' Graphics
Version: 0.1.0
Version: 0.1.5
Authors@R:
person(
given = "Claus O.",
family = "Wilke",
role = c("aut", "cre"),
email = "wilke@austin.utexas.edu",
comment = c(ORCID = "0000-0002-7470-9261")
c(
person(
given = "Claus O.",
family = "Wilke",
role = c("aut"),
email = "wilke@austin.utexas.edu",
comment = c(ORCID = "0000-0002-7470-9261")
),
person(
given = "Brenton M.",
family = "Wiernik",
role = c("aut", "cre"),
email = "brenton@wiernik.org",
comment = c(ORCID = "0000-0001-9560-6336", Twitter = "@bmwiernik")
)
)
Description: Provides support for rendering of formatted text using 'grid' graphics. Text can be
formatted via a minimal subset of 'Markdown', 'HTML', and inline 'CSS' directives, and it can be
rendered both with and without word wrap.
URL: https://wilkelab.org/gridtext
URL: https://wilkelab.org/gridtext/
BugReports: https://github.com/wilkelab/gridtext/issues
License: MIT + file LICENSE
Depends:
R (>= 3.5)
Imports:
curl,
grid,
grDevices,
markdown,
rlang,
Rcpp,
RCurl,
png,
jpeg,
stringr,
@@ -36,11 +45,8 @@ Suggests:
testthat,
vdiffr
LinkingTo:
Rcpp,
testthat
Rcpp
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.0.2
RoxygenNote: 7.1.1
Roxygen: list(markdown = TRUE)
SystemRequirements: C++11

24 changes: 24 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
# gridtext 0.1.5

- Transition to curl package and drop RCurl dependency
- Fix fontface not being processed and words spaced properly in R 4.2.0
- Maintainer changes to Brenton Wiernik
- Removed LazyData from package DESCRIPTION to fix CRAN NOTE

# gridtext 0.1.4

- Make sure tests don't fail if vdiffr is missing.

# gridtext 0.1.3

- Remove unneeded systemfonts dependency.

# gridtext 0.1.2

- Fix build for testthat 3.0.

# gridtext 0.1.1

- `richtext_grob()` and `textbox_grob()` now gracefully handle empty strings
and NAs.

# gridtext 0.1.0

First public release. Provides the two grobs `richtext_grob()` and `textbox_grob()` for formatted text rendering without and with word wrapping, respectively.
6 changes: 0 additions & 6 deletions R/catch-routine-registration.R

This file was deleted.

10 changes: 5 additions & 5 deletions R/drawing-context.R
Original file line number Diff line number Diff line change
@@ -46,8 +46,8 @@ set_style <- function(drawing_context, style = NULL) {
update_gpar <- function(gp, gp_new) {
names_new <- names(gp_new)
names_old <- names(gp)
gp[c(intersect(names_old, names_new), "font")] <- NULL
gp_new["font"] <- NULL
gp[c(intersect(names_old, names_new), "fontface")] <- NULL
gp_new["fontface"] <- NULL
do.call(gpar, c(gp, gp_new))
}

@@ -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
font_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(font_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(font_old == 3)) {
fontface <- "bold.italic"
}
}
2 changes: 1 addition & 1 deletion R/read-image.R
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ read_image <- function(path) {

get_file <- function(path) {
if (is_url(path)) {
RCurl::getBinaryURL(path)
curl::curl_fetch_memory(path)$content
} else {
path
}
4 changes: 3 additions & 1 deletion R/richtext-grob.R
Original file line number Diff line number Diff line change
@@ -98,6 +98,8 @@ richtext_grob <- function(text, x = unit(0.5, "npc"), y = unit(0.5, "npc"),

# make sure we can handle input text even if provided as factor
text <- as.character(text)
# convert NAs to empty strings
text <- ifelse(is.na(text), "", text)

# make sure margin and padding are of length 4
margin <- rep(margin, length.out = 4)
@@ -222,7 +224,7 @@ make_inner_box <- function(text, halign, valign, use_markdown, gp) {
if (use_markdown) {
text <- markdown::markdownToHTML(text = text, options = c("use_xhtml", "fragment_only"))
}
doctree <- read_html(text)
doctree <- read_html(paste0("<!DOCTYPE html>", text))

drawing_context <- setup_context(gp = gp, halign = halign, word_wrap = FALSE)
boxlist <- process_tags(xml2::as_list(doctree)$html$body, drawing_context)
Loading