My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

genallfont.sh 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. #
  30. # Locate the bdf2u8g command
  31. #
  32. EXEC_BDF2U8G=`which bdf2u8g`
  33. [ -x "${EXEC_BDF2U8G}" ] || EXEC_BDF2U8G="${DN_EXEC}/bdf2u8g"
  34. [ -x "${EXEC_BDF2U8G}" ] || EXEC_BDF2U8G="${PWD}/bdf2u8g"
  35. [ -x "${EXEC_BDF2U8G}" ] || { EOL=$'\n' ; echo "ERR: Can't find bdf2u8g!${EOL}See uxggenpages.md for bdf2u8g build instructions." >&2 ; exit 1; }
  36. #
  37. # Get language arguments
  38. #
  39. LANG_ARG="$@"
  40. #
  41. # Use 6x12 combined font data for Western languages
  42. #
  43. FN_FONT="${DN_EXEC}/marlin-6x12-3.bdf"
  44. #
  45. # Change to working directory 'Marlin'
  46. #
  47. OLDWD=`pwd`
  48. [[ $(basename "$OLDWD") != 'Marlin' && -d "Marlin" ]] && cd Marlin
  49. [[ -f "Configuration.h" ]] || { echo -n "cd to the 'Marlin' folder to run " ; basename $0 ; exit 1; }
  50. #
  51. # Compile the 'genpages' command in-place
  52. #
  53. (cd ${DN_EXEC}; gcc -o genpages genpages.c getline.c)
  54. #
  55. # By default loop through all languages
  56. #
  57. LANGS_DEFAULT="an bg ca cz da de el el_gr en es eu fi fr gl hr hu it jp_kana ko_KR nl pl pt pt_br ru sk tr uk vi zh_CN zh_TW test"
  58. #
  59. # Generate data for language list MARLIN_LANGS or all if not provided
  60. #
  61. for LANG in ${LANG_ARG:=$LANGS_DEFAULT} ; do
  62. echo "Generating Marlin language data for '${LANG}'" >&2
  63. case "$LANG" in
  64. zh_* ) FONTFILE="wenquanyi_12pt" ;;
  65. ko_* ) FONTFILE="${DN_EXEC}/NanumGothic.bdf" ;;
  66. * ) FONTFILE="${DN_EXEC}/marlin-6x12-3.bdf" ;;
  67. esac
  68. DN_WORK=`mktemp -d`
  69. cp Configuration.h ${DN_WORK}/
  70. cp src/lcd/language/language_${LANG}.h ${DN_WORK}/
  71. cd "${DN_WORK}"
  72. ${EXEC_WXGGEN} "${FONTFILE}"
  73. 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
  74. cd - >/dev/null
  75. mv ${DN_WORK}/fontutf8-data.h src/lcd/dogm/fontdata/langdata_${LANG}.h
  76. rm -rf ${DN_WORK}
  77. done
  78. #
  79. # Generate default ASCII font (char range 0-255):
  80. # Marlin/src/lcd/dogm/fontdata/fontdata_ISO10646_1.h
  81. #
  82. #if [ "${MARLIN_LANGS}" == "${LANGS_DEFAULT}" ]; then
  83. if [ 1 = 1 ]; then
  84. DN_WORK=`mktemp -d`
  85. cd ${DN_WORK}
  86. ${EXEC_BDF2U8G} -b 1 -e 127 ${FN_FONT} ISO10646_1_5x7 tmp1.h >/dev/null
  87. ${EXEC_BDF2U8G} -b 1 -e 255 ${FN_FONT} ISO10646_1_5x7 tmp2.h >/dev/null
  88. TMP1=$(cat tmp1.h)
  89. TMP2=$(cat tmp2.h)
  90. cd - >/dev/null
  91. rm -rf ${DN_WORK}
  92. cat <<EOF >src/lcd/dogm/fontdata/fontdata_ISO10646_1.h
  93. /**
  94. * Marlin 3D Printer Firmware
  95. * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  96. *
  97. * This program is free software: you can redistribute it and/or modify
  98. * it under the terms of the GNU General Public License as published by
  99. * the Free Software Foundation, either version 3 of the License, or
  100. * (at your option) any later version.
  101. *
  102. * This program is distributed in the hope that it will be useful,
  103. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  104. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  105. * GNU General Public License for more details.
  106. *
  107. * You should have received a copy of the GNU General Public License
  108. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  109. *
  110. */
  111. #include <U8glib.h>
  112. #if defined(__AVR__) && ENABLED(NOT_EXTENDED_ISO10646_1_5X7)
  113. // reduced font (only symbols 1 - 127) - saves about 1278 bytes of FLASH
  114. $TMP1
  115. #else
  116. // extended (original) font (symbols 1 - 255)
  117. $TMP2
  118. #endif
  119. EOF
  120. fi
  121. (cd ${DN_EXEC}; rm genpages)
  122. cd "$OLDWD"