# Create a random font collection
fonts <- system_fonts()
plain <- sample(which(!fonts$italic & fonts$weight <= 'normal'), 1)
bold <- sample(which(!fonts$italic & fonts$weight > 'normal'), 1)
italic <- sample(which(fonts$italic & fonts$weight <= 'normal'), 1)
bolditalic <- sample(which(fonts$italic & fonts$weight > 'normal'), 1)
register_font(
'random',
plain = list(fonts$path[plain], fonts$index[plain]),
bold = list(fonts$path[bold], fonts$index[bold]),
italic = list(fonts$path[italic], fonts$index[italic]),
bolditalic = list(fonts$path[bolditalic], fonts$index[bolditalic])
)
# Look at your creation
registry_fonts()
# Reset
clear_registry()
Run the code above in your browser using DataLab