高通字库
版本 V1.0 · 更新于 2026-05-23

5.3 使用示例

完整代码示例:LCD 上显示中英文混合字符

以下示例演示从初始化字库芯片到在 LCD 屏幕上显示中英文混合字符串的完整流程。

main.c
/* ===== 完整示例:在 LCD 上显示汉字 ===== */

#include "gt_font_lib.h"
#include "lcd_driver.h"

void LCD_ShowString(uint16_t x, uint16_t y, const char *str, uint8_t fontSize)
{
  uint16_t unicode;
  uint8_t  buf[256];  // 最大 32×32 点阵 = 128 字节
  uint8_t  i, j;

  while (*str)
  {
    // 1. 获取字符 Unicode
    str = UTF8toUnicode(str, &unicode);

    // 2. 从字库芯片读取点阵
    FontChip_GetChar(unicode, buf, fontSize);

    // 3. 逐行绘制到 LCD
    for (i = 0; i < fontSize; i++)

    }

    x += fontSize;  // 移动到下一个字符位置
  }
}

int main(void)