yaff_font: Read and write yaff bitmap font files

Description Usage Arguments Value See Also Examples

Description

read_yaff() reads in yaff format bitmap font files as a bm_font() object while write_yaff() writes a bm_font() object as a yaff format bitmap font file.

Usage

1
2
3
read_yaff(con)

write_yaff(font, con = stdout())

Arguments

con

A connection object or a character string of a filename. See base::readLines() or base::writeLines() for more info. If it is a connection it will be explicitly closed.

font

A bm_font() object.

Value

read_yaff() returns a bm_font() object. write_yaff() returns invisibly a character vector of the contents of the yaff font file it wrote to con as a side effect.

See Also

bm_font() for information about bitmap font objects. For more information about yaff font format see https://github.com/robhagemans/monobit#the-yaff-format.

Examples

1
2
3
4
5
6
7
 font_file <- system.file("fonts/fixed/4x6.yaff.gz", package = "bittermelon")
 font <- read_yaff(font_file)
 capital_r <- font[[str2ucp("R")]]
 print(capital_r, px = c(".", "#"))

 filename <- tempfile(fileext = ".yaff")
 write_yaff(font, filename)

bittermelon documentation built on Nov. 2, 2021, 1:06 a.m.