pdf-icon

产品上手指引

实时 AI 语音助手

火山引擎语音助手

Thread

Module Gateway H2

IoT 测量仪表

IoT 云端服务

Ethernet 摄像头

拨码开关&引脚切换

Module GPS v2.0

Module ExtPort For Core2

Module LoRa868 V1.2

vlw Font Creator

vlw Font Creator是一款在线vlw字体生成器, 用于生成自定义像素大小和字库范围的vlw字体文件, 方便开发者拓展显示字体样式和节约字体内存占用。

1.创建vlw字体

访问https://vlw-font-creator.m5stack.com/, 根据下图提示完成vlw字体创建。

2.使用vlw字体

参考以下案例程序, 引用vlw字体文件到你的项目中。

  1. 采用芯片内存存储vlw字体文件
  1. 采用MicroSD存储vlw字体文件
cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
#include <Arduino.h>
#include <SPI.h>
#include <SD.h>
#include <M5Unified.h>
#include <M5GFX.h>

#define SD_SPI_CS_PIN   4
#define SD_SPI_SCK_PIN  18
#define SD_SPI_MISO_PIN 19
#define SD_SPI_MOSI_PIN 23

void setup() {
  M5.begin();

  M5.Display.setTextFont(&fonts::Orbitron_Light_24);
  M5.Display.setTextSize(1);

  // SD Card Initialization
  SPI.begin(SD_SPI_SCK_PIN, SD_SPI_MISO_PIN, SD_SPI_MOSI_PIN, SD_SPI_CS_PIN);
  if (!SD.begin(SD_SPI_CS_PIN, SPI, 25000000)) {
    // Print a message if SD card initialization failed or if the SD card does not exist.
    M5.Display.print("\n SD card not detected\n");
    while (1)
      ;
  } else {
    M5.Display.print("\n SD card detected\n");
  }
  delay(1000);
  delay(1000);

  M5.Display.print("\n SD card read test...\n");
  if (SD.open("/Test.vlw", FILE_READ, false)) {
    M5.Display.print(" vlw detected\n");
  } else {
    M5.Display.print(" vlw not detected\n");
  }

  if (M5.Display.loadFont(SD, "/Test.vlw")) {
    M5.Display.print("\n↑↓←→☺\n");// Display some characters to test the font
  } else {
    M5.Display.print(" vlw not loaded\n");
  }
}

void loop() {
}    

例程效果如下:

On This Page