as_bm_font: Coerce to bitmap font objects

View source: R/bm_font.R

as_bm_fontR Documentation

Coerce to bitmap font objects

Description

as_bm_font() turns an existing object into a bm_font() object.

Usage

as_bm_font(x, ..., comments = NULL, properties = NULL)

## Default S3 method:
as_bm_font(x, ..., comments = NULL, properties = NULL)

## S3 method for class 'list'
as_bm_font(x, ..., comments = NULL, properties = NULL)

Arguments

x

An object that can reasonably be coerced to a bm_font() object.

...

Further arguments passed to or from other methods.

comments

An optional character vector of (global) font comments.

properties

An optional named list of font metadata.

Value

A bm_font() object.

See Also

bm_font()

Examples

  plus_sign <- matrix(0L, nrow = 9L, ncol = 9L)
  plus_sign[5L, 3:7] <- 1L
  plus_sign[3:7, 5L] <- 1L
  plus_sign_glyph <- bm_bitmap(plus_sign)

  space_glyph <- bm_bitmap(matrix(0L, nrow = 9L, ncol = 9L))

  l <- list()
  l[[str2ucp("+")]] <- plus_sign_glyph
  l[[str2ucp(" ")]] <- space_glyph
  font <- as_bm_font(l)
  is_bm_font(font)


trevorld/bittermelon documentation built on Dec. 24, 2024, 10:33 p.m.