tests/testthat/test-str_metrics.R

context("font file metric info")


test_that("a string has positive dimensions", {
  skip_if_not_installed("fontquiver")
  file <- fontquiver::font("Bitstream Vera", "Sans", "Bold")$ttf
  value <- str_metrics(x = "Hello World", fontsize = 12, fontfile = file )
  expect_true( value["width"] > 0)
  expect_true( value["ascent"] > 0 )
  expect_false( value["descent"] < 0 )
})

Try the gdtools package in your browser

Any scripts or data that you put into this service are public.

gdtools documentation built on Oct. 15, 2023, 5:07 p.m.