Skip to contents

bm_font() creates a bitmap font object.

Usage

bm_font(x = bm_list(), comments = NULL, properties = NULL)

Arguments

x

Named list of bm_bitmap() objects. Names must be coercible by Unicode::as.u_char().

comments

An optional character vector of (global) font comments.

properties

An optional named list of font metadata.

Value

A named list with a “bm_font” subclass.

Details

bm_font() is a named list. The names are of the form “U+HHHH” or “U+HHHHH”. where the H are appropriate hexadecimal Unicode code points. It is a subclass of bm_list().

Examples

 font_file <- system.file("fonts/spleen/spleen-8x16.hex.gz", package = "bittermelon")
 font <- read_hex(font_file)
 is_bm_font(font)
#> [1] TRUE

 # number of characters in font
 length(font)
#> [1] 837

 # print out "R"
 R_glyph <- font[[str2ucp("R")]]
 print(R_glyph)
#> ░░░░░░░░
#> ░░░░░░░░
#> ██████░░
#> ██░░░██░
#> ██░░░██░
#> ██░░░██░
#> ██████░░
#> ██░░░██░
#> ██░░░██░
#> ██░░░██░
#> ██░░░██░
#> ██░░░██░
#> ░░░░░░░░
#> ░░░░░░░░
#> ░░░░░░░░
#> ░░░░░░░░