My Marlin configs for Fabrikator Mini and CTC i3 Pro B
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

genallfont.sh 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #!/usr/bin/env bash
  2. #####################################################################
  3. # genallfont.sh for Marlin
  4. #
  5. # This script generates font data for language headers
  6. #
  7. # Copyright 2015-2018 Yunhui Fu <yhfudev@gmail.com>
  8. # License: GPL/BSD
  9. #####################################################################
  10. my_getpath() {
  11. local PARAM_DN="$1"
  12. shift
  13. #readlink -f
  14. local DN="${PARAM_DN}"
  15. local FN=
  16. if [ ! -d "${DN}" ]; then
  17. FN=$(basename "${DN}")
  18. DN=$(dirname "${DN}")
  19. fi
  20. cd "${DN}" > /dev/null 2>&1
  21. DN=$(pwd)
  22. cd - > /dev/null 2>&1
  23. echo -n "${DN}"
  24. [[ -z "$FN" ]] || echo -n "/${FN}"
  25. }
  26. #DN_EXEC=`echo "$0" | ${EXEC_AWK} -F/ '{b=$1; for (i=2; i < NF; i ++) {b=b "/" $(i)}; print b}'`
  27. DN_EXEC=$(dirname $(my_getpath "$0") )
  28. EXEC_WXGGEN="${DN_EXEC}/uxggenpages.sh"
  29. EXEC_BDF2U8G=`which bdf2u8g`
  30. [ -x "${EXEC_BDF2U8G}" ] || EXEC_BDF2U8G="${DN_EXEC}/bdf2u8g"
  31. [ -x "${EXEC_BDF2U8G}" ] || EXEC_BDF2U8G="${PWD}/bdf2u8g"
  32. [ -x "${EXEC_BDF2U8G}" ] || { EOL=$'\n' ; echo "ERR: Can't find bdf2u8g!${EOL}See uxggenpages.md for bdf2u8g build instructions." >&2 ; exit 1; }
  33. #FN_FONT="${1:-}"
  34. FN_FONT="${DN_EXEC}/marlin-6x12-3.bdf"
  35. [ "$1" = "" ] || FN_FONT="$1"
  36. DN_FONT0=`dirname ${FN_FONT}`
  37. DN_FONT="$(my_getpath ${DN_FONT0})"
  38. FN_FONT="$(my_getpath "${DN_FONT}")/"`basename ${FN_FONT}`
  39. [ -z "${FN_FONT}" ] && FN_FONT=${DN_DATA}/../${FN_FONT_BASE}.bdf
  40. [ -f "${FN_FONT}" ] || FN_FONT=${DN_EXEC}/${FN_FONT_BASE}.bdf
  41. [ -f "${FN_FONT}" ] || FN_FONT="$FONTHOME/wenquanyi/${FN_FONT_BASE}.bdf"
  42. [ -f "${FN_FONT}" ] || FN_FONT="$FONTHOME/X11/misc/${FN_FONT_BASE}.bdf"
  43. [ -f "${FN_FONT}" ] || FN_FONT="$FONTHOME/misc/${FN_FONT_BASE}.bdf"
  44. #echo "genallfont.sh: FN_FONT=${FN_FONT}"
  45. DN_WORK=./tmp1
  46. (cd ${DN_EXEC}; gcc -o genpages genpages.c getline.c)
  47. LANGS_DEFAULT="an bg ca zh_CN zh_TW cz da de el el-gr en es eu fi fr gl hr it jp-kana nl pl pt pt-br ru sk tr uk test"
  48. for LANG in ${MARLIN_LANGS:=$LANGS_DEFAULT} ; do
  49. echo "Generating Marlin language data for '${LANG}'" >&2
  50. rm -rf ${DN_WORK}/
  51. mkdir -p ${DN_WORK}
  52. cp Configuration.h ${DN_WORK}/
  53. cp src/lcd/language/language_${LANG}.h ${DN_WORK}/
  54. cd ${DN_WORK}/
  55. ${EXEC_WXGGEN} "${FN_FONT}"
  56. sed -i fontutf8-data.h -e 's|fonts//|fonts/|g' -e 's|fonts//|fonts/|g' -e 's|[/0-9a-zA-Z_\-]*buildroot/share/fonts|buildroot/share/fonts|' 2>/dev/null
  57. cd ../
  58. mv ${DN_WORK}/fontutf8-data.h src/lcd/dogm/language_data_${LANG}.h
  59. rm -rf ${DN_WORK}/
  60. done
  61. #
  62. # Generate default ASCII font (char range 0-255):
  63. # Marlin/src/lcd/dogm/dogm_font_data_ISO10646_1.h
  64. #
  65. #if [ "${MARLIN_LANGS}" == "${LANGS_DEFAULT}" ]; then
  66. if [ 1 = 1 ]; then
  67. rm -rf ${DN_WORK}/
  68. mkdir -p ${DN_WORK}
  69. cd ${DN_WORK}/
  70. ${EXEC_BDF2U8G} -b 1 -e 127 ${FN_FONT} ISO10646_1_5x7 tmp1.h >/dev/null
  71. ${EXEC_BDF2U8G} -b 1 -e 255 ${FN_FONT} ISO10646_1_5x7 tmp2.h >/dev/null
  72. TMP1=$(cat tmp1.h) ; rm tmp1.h
  73. TMP2=$(cat tmp2.h) ; rm tmp2.h
  74. cat <<EOF >../src/lcd/dogm/dogm_font_data_ISO10646_1.h
  75. /**
  76. * Marlin 3D Printer Firmware
  77. * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  78. *
  79. * Based on Sprinter and grbl.
  80. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
  81. *
  82. * This program is free software: you can redistribute it and/or modify
  83. * it under the terms of the GNU General Public License as published by
  84. * the Free Software Foundation, either version 3 of the License, or
  85. * (at your option) any later version.
  86. *
  87. * This program is distributed in the hope that it will be useful,
  88. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  89. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  90. * GNU General Public License for more details.
  91. *
  92. * You should have received a copy of the GNU General Public License
  93. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  94. *
  95. */
  96. #include <U8glib.h>
  97. #if defined(__AVR__) && ENABLED(NOT_EXTENDED_ISO10646_1_5X7)
  98. // reduced font (only symbols 1 - 127) - saves about 1278 bytes of FLASH
  99. $TMP1
  100. #else
  101. // extended (original) font (symbols 1 - 255)
  102. $TMP2
  103. #endif
  104. EOF
  105. rmdir ../${DN_WORK}
  106. cd - >/dev/null
  107. fi