根据类名称在画布上绘制Font Awesome图标

问题描述

我希望能够:

  1. 获取任何给定的Font Awesome类名(@GetMapping(value = "/users/copy",params = {"type=OLD"}) public ResponseEntity<UserDto> copyUserWithTypeOld(@RequestParam UserTypeEnum type) { ... } @GetMapping(value = "/users/copy",params = {"type=NEW"}) public ResponseEntity<UserDto> copyUserWithTypeNew(@RequestParam UserTypeEnum type) { ... } 等)的Font Awesome 5 Unicode字符
  2. 将该unicode字符绘制到html5画布上

我将如何去做?

解决方法

要获取Font Awesome 5图标类的正确unicode字符和其他重要数据,然后将其绘制到html5画布上:

fas fa-check-circle

执行此操作时,请确保在绘制图形时确实加载了Font Awesome 5字体。我在测试时犯了只画一次的错误,结果只显示一个盒子。加载图标后,它应如下所示:

icon rendered in canvas