# Much faster to load only the subset of GNU Unifont one needs
# Mandarin Chinese
if (require("bittermelon")) {
s <- "\uff32\u5f88\u68d2\uff01"
font <- unifont(ucp = str2ucp(s))
bm <- as_bm_bitmap(s, font = font)
print(bm, px = px_ascii)
}
# Emoji
if (require("bittermelon")) {
s <- "\U0001f42d\U0001f432\U0001f435"
font <- unifont(ucp = str2ucp(s))
bm <- as_bm_bitmap(s, font = font)
print(bm, px = px_ascii)
}
# Will take more than 5s on CRAN machines
# Compiling the entire font from the hex files takes a long time
system.time(font <- unifont(cache = FALSE))
prettyNum(length(font), big.mark = ",") # number of glyphs
# It is usually much faster to use a cached version of the font
if (file.exists(hexfont:::unifont_cache_filename())) {
system.time({font_from_cache <- unifont(cache = TRUE)})
}
Run the code above in your browser using DataLab