subset_fonts.sh 1.4 KB

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh
  2. # Regenerate the checked-in UI font subsets. Requires pyftsubset (fonttools)
  3. # and the Croscore/Liberation source fonts; normal builds use the checked-in
  4. # files and do not run this script.
  5. set -e
  6. cd "$(dirname "$0")/.."
  7. U='U+0020-00FF,U+20AC,U+2013-2014,U+2018-2019,U+201C-201D,U+2022,U+2026,U+00A0'
  8. SUB=${PYFTSUBSET:-pyftsubset}
  9. "$SUB" /usr/share/fonts/croscore/Arimo-Regular.ttf --unicodes="$U" \
  10. --layout-features='' --output-file=fonts/sans.ttf
  11. "$SUB" /usr/share/fonts/croscore/Arimo-Bold.ttf --unicodes="$U" \
  12. --layout-features='' --output-file=fonts/sans-b.ttf
  13. "$SUB" /usr/share/fonts/croscore/Arimo-Italic.ttf --unicodes="$U" \
  14. --layout-features='' --output-file=fonts/sans-i.ttf
  15. "$SUB" /usr/share/fonts/croscore/Arimo-BoldItalic.ttf --unicodes="$U" \
  16. --layout-features='' --output-file=fonts/sans-bi.ttf
  17. "$SUB" /usr/share/fonts/liberation/LiberationMono-Regular.ttf --unicodes="$U" \
  18. --layout-features='' --output-file=fonts/mono.ttf
  19. # Monochrome Noto Emoji subset for ngui's UTF-8 fallback face. The checked-in
  20. # emoji-unicodes.txt is curated to glyphs that fit ufont's 256-point / 16-
  21. # contour rasterizer. Point NOTO_EMOJI_TTF at a monochrome Noto Emoji TTF.
  22. EMOJI=${NOTO_EMOJI_TTF:-}
  23. if [ -n "$EMOJI" ] && [ -f "$EMOJI" ]; then
  24. "$SUB" "$EMOJI" --unicodes-file=fonts/emoji-unicodes.txt \
  25. --layout-features='' --output-file=fonts/emoji.ttf
  26. else
  27. echo "note: set NOTO_EMOJI_TTF to regenerate fonts/emoji.ttf"
  28. fi