diff options
author | Pierre-Yves Rollo <dev@pyrollo.com> | 2017-12-19 21:52:49 +0100 |
---|---|---|
committer | Pierre-Yves Rollo <dev@pyrollo.com> | 2017-12-19 21:55:06 +0100 |
commit | 46d2ce085ea47f7f9b86ec74858c6cc1317b04a6 (patch) | |
tree | 59cc09832d87fbf1d832b32f3f32278019040017 /font_lib/tools | |
parent | ce8e21440062677df64095cc630d62d57173a07e (diff) | |
download | display_modpack-46d2ce085ea47f7f9b86ec74858c6cc1317b04a6.tar.gz display_modpack-46d2ce085ea47f7f9b86ec74858c6cc1317b04a6.tar.bz2 display_modpack-46d2ce085ea47f7f9b86ec74858c6cc1317b04a6.zip |
Multiple fonts and UTF chars support
Diffstat (limited to 'font_lib/tools')
-rwxr-xr-x | font_lib/tools/make_font_lua.sh | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/font_lib/tools/make_font_lua.sh b/font_lib/tools/make_font_lua.sh new file mode 100755 index 0000000..b751612 --- /dev/null +++ b/font_lib/tools/make_font_lua.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +scriptname=$0 +identify="identify" + +font_name=default + +for f in textures/font_${font_name}_????.png +do + if [[ $f =~ textures/font_${font_name}_([0-9a-fA-F]{4}).png ]] + then + code=$((16#${BASH_REMATCH[1]})) + size=$(identify $f | cut -d " " -f 3) + w=$(echo $size | cut -d "x" -f 1) + h=$(echo $size | cut -d "x" -f 2) + + if [ -z "$font_height" ] + then + font_height=$h + else + if [ $font_height -ne $h ] + then + echo "Error : $f as height of $h pixels, previous textures have a height of $font_height pixels. All textures should have the same height." + fi + fi + + if [ -z "$font_widths" ] + then + font_widths="[$code]=$w" + else + font_widths="$font_widths, [$code]=$w" + fi + fi +done + +echo "--[[ + +$luafile generated by $scriptname $(date) + +--]] + +font_lib.register_font( + '$font_name', + $font_height, + { $font_widths } +); +" > font_$font_name.lua + |