2019-10-29 01:42:10 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
function create_code_file ()
|
|
|
|
{
|
|
|
|
ucs2any -d "$FONTFILE" "$MAP" "${REGISTRY}-${ENCODING}"
|
|
|
|
|
|
|
|
(
|
|
|
|
echo -e "// ${1}\\n"
|
|
|
|
echo -e "#ifndef ${INCLUDE_GUARD}"
|
|
|
|
echo -e "#define ${INCLUDE_GUARD}\\n"
|
|
|
|
echo -e "namespace finalcut\\n{\\n"
|
|
|
|
echo -e "namespace fc\\n{\\n"
|
2020-09-18 17:13:52 +02:00
|
|
|
echo -e "constexpr unsigned char ${NAME}[] =\\n{"
|
2019-10-29 01:42:10 +01:00
|
|
|
|
|
|
|
grep -A"${HEIGHT}" "^BITMAP" "$NEWFONTFILE" \
|
|
|
|
| tr '\n' ',' \
|
|
|
|
| sed -e 's/BITMAP,//g' \
|
|
|
|
| sed -e 's/--,/\n/g' \
|
|
|
|
| tr '[:upper:]' '[:lower:]' \
|
|
|
|
| sed -e 's/,/, /g' \
|
|
|
|
| sed -e 's/\([0-9a-f][0-9a-f]\)/0x\1/g' \
|
|
|
|
| sed -e 's/^0/ 0/g' \
|
|
|
|
| sed -e '$s/, $/ \n/' \
|
|
|
|
| while IFS=$'\n'; read -r LINE
|
|
|
|
do
|
|
|
|
echo "$LINE /* $N */"
|
|
|
|
(( N++ ))
|
|
|
|
done
|
|
|
|
|
|
|
|
echo -e "};"
|
|
|
|
echo -e "\\n} // namespace fc"
|
|
|
|
echo -e "\\n} // namespace finalcut"
|
|
|
|
echo -e "\\n#endif // ${INCLUDE_GUARD}"
|
|
|
|
) > "${1}"
|
|
|
|
|
|
|
|
rm -f "$NEWFONTFILE"
|
|
|
|
}
|
|
|
|
|
2019-11-03 23:34:47 +01:00
|
|
|
#------------------------------#
|
|
|
|
# Convert newfont 8x16 to code #
|
|
|
|
#------------------------------#
|
2019-10-29 01:42:10 +01:00
|
|
|
N=0
|
|
|
|
HEIGHT=16
|
|
|
|
FONTFILE="8x16graph.bdf"
|
|
|
|
MAP="map-newfont"
|
|
|
|
REGISTRY="nf"
|
|
|
|
ENCODING="fontspecific"
|
2019-11-03 23:34:47 +01:00
|
|
|
INCLUDE_GUARD="FNEWFONT_8x16_H"
|
2019-10-29 01:42:10 +01:00
|
|
|
NAME="__8x16graph"
|
|
|
|
NEWFONTFILE="8x16graph-nf-fontspecific.bdf"
|
|
|
|
|
2019-11-03 23:34:47 +01:00
|
|
|
create_code_file "newfont_8x16.h"
|
|
|
|
|
|
|
|
#------------------------------#
|
|
|
|
# Convert newfont 9x16 to code #
|
|
|
|
#------------------------------#
|
|
|
|
N=0
|
|
|
|
HEIGHT=16
|
|
|
|
FONTFILE="9x16graph.bdf"
|
|
|
|
MAP="map-newfont"
|
|
|
|
REGISTRY="nf"
|
|
|
|
ENCODING="fontspecific"
|
|
|
|
INCLUDE_GUARD="FNEWFONT_9x16_H"
|
|
|
|
NAME="__9x16graph"
|
|
|
|
NEWFONTFILE="9x16graph-nf-fontspecific.bdf"
|
|
|
|
|
|
|
|
./bdfmerge.sh 8x16graph.bdf 9x16graph_patch.bdf >9x16graph.bdf
|
|
|
|
create_code_file "newfont_9x16.h"
|
|
|
|
rm -f 9x16graph.bdf
|
2019-10-29 01:42:10 +01:00
|
|
|
|
|
|
|
#--------------------------#
|
|
|
|
# Convert VGA font to code #
|
|
|
|
#--------------------------#
|
|
|
|
N=0
|
|
|
|
HEIGHT=16
|
|
|
|
FONTFILE="8x16graph.bdf"
|
|
|
|
MAP="map-vga"
|
|
|
|
REGISTRY="cp437"
|
|
|
|
ENCODING="1"
|
|
|
|
INCLUDE_GUARD="FVGAFONT_H"
|
|
|
|
NAME="__8x16std"
|
|
|
|
NEWFONTFILE="8x16graph-cp437-1.bdf"
|
|
|
|
|
|
|
|
create_code_file "vgafont.h"
|
2019-11-03 23:34:47 +01:00
|
|
|
|