read_monobit {bittermelon} | R Documentation |
read_monobit()
reads in bitmap font file as a bm_font()
object while write_monobit()
writes a bm_font()
object as a bitmap font file.
It uses the file extension to determine the appropriate bitmap font format to use.
update_monobit()
downloads an updated version of monobit
.
read_monobit(
file,
quietly = FALSE,
monobit_path = getOption("bittermelon.monobit_path", NULL)
)
write_monobit(
font,
file,
quietly = FALSE,
monobit_path = getOption("bittermelon.monobit_path", NULL)
)
update_monobit(site = FALSE)
file |
A character string of a filename. |
quietly |
If |
monobit_path |
Which directory containing |
font |
A |
site |
If |
read_monobit()
and write_monobit()
require Python v3.6 or greater available on the system.
read_monobit()
and write_monobit()
uses monobit
's convert.py
script to convert to/from
the yaff font format which this package can natively read/write from/to.
This package embeds an older, smaller version of monobit
.
Use update_monobit()
to download a newer, better version of monobit
(which unfortunately is too large to embed within this package).
read_monobit()
returns a bm_font()
object. write_monobit()
returns NULL
invisibly and
as a side effect writes file
.
bm_font()
for more information about bitmap font objects.
read_hex()
, write_hex()
, read_yaff()
, write_yaff()
for pure R bitmap font readers and writers.
For more information about monobit
see https://github.com/robhagemans/monobit.
if (findpython::can_find_python_cmd(minimum_version = "3.6")) {
try({
font_file <- system.file("fonts/spleen/spleen-8x16.hex.gz", package = "bittermelon")
tempfile <- tempfile(fileext = ".hex")
writeLines(readLines(font_file), tempfile)
font <- read_monobit(tempfile)
capital_r <- font[[str2ucp("R")]]
print(capital_r, px = c(".", "#"))
filename <- tempfile(fileext = ".yaff")
write_monobit(font, filename)
})
}