Created
June 17, 2026 06:18
-
-
Save naoki-mizuno/cbafefd47f55cbf585b29c933d331582 to your computer and use it in GitHub Desktop.
Generate font file for Project Aura
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| REPO="$(pwd)" | |
| STRINGS="src/ui/strings/UiStrings.ja.inc" | |
| FONT="../NotoSansJP/static/NotoSansJP-Regular.ttf" | |
| cd "$REPO" 2>/dev/null || { echo "Run from repo root or place script there"; exit 1; } | |
| [[ -f "$STRINGS" ]] || { echo "Not found: $STRINGS"; exit 1; } | |
| [[ -f "$FONT" ]] || { echo "Not found: $FONT"; exit 1; } | |
| # Extract all non-ASCII chars from the strings file, deduplicated and sorted | |
| SYMBOLS=$(python3 -c " | |
| import re, sys | |
| text = open('$STRINGS', encoding='utf-8').read() | |
| strings = re.findall(r'\"((?:[^\"\\\]|\\\\.)*?)\"', text) | |
| chars = sorted(set(c for s in strings for c in s if ord(c) > 126)) | |
| print(''.join(chars) + '©°³µ∞≈≤?', end='') | |
| ") | |
| echo "Symbols: ${#SYMBOLS} chars" | |
| for SIZE in 14 18; do | |
| NAME="ui_font_noto_sans_jp_reg_${SIZE}" | |
| OUT="src/ui/${NAME}.c" | |
| echo -n "Generating ${OUT} ... " | |
| npx lv_font_conv \ | |
| --bpp 4 --size "$SIZE" --no-compress \ | |
| --font "$FONT" \ | |
| --symbols "${SYMBOLS}語" \ | |
| --range 32-126 \ | |
| --format lvgl \ | |
| --lv-font-name "$NAME" \ | |
| -o "$OUT" | |
| echo "done" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment