yaff_font: Read and write yaff bitmap font files

read_yaffR Documentation

Read and write yaff bitmap font files

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

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

 # May take more than 5 seconds on CRAN servers
 font_file <- system.file("fonts/fixed/4x6.yaff.gz", package = "bittermelon")
 font <- read_yaff(font_file)
 capital_r <- font[[str2ucp("R")]]
 print(capital_r)

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

bittermelon documentation built on June 25, 2024, 5:09 p.m.