Skip to content

Instantly share code, notes, and snippets.

@sarah-j-smith
Created February 26, 2015 01:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sarah-j-smith/e6adf564886aa1f001a1 to your computer and use it in GitHub Desktop.
Save sarah-j-smith/e6adf564886aa1f001a1 to your computer and use it in GitHub Desktop.
GlyphDesigner Cocos2D SpriteBuilder bmftonts script
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: $0 BmFontName"
exit 1
fi
FONT_NAME="$1"
FONT_NAME=$(basename $FONT_NAME .GlyphProject)
if hash gdcl 2>/dev/null; then
echo "Found Glyph Designer command-line, creating fonts..."
else
echo "Glyph Designer command-line not found."
exit 1
fi
mkdir -p "$FONT_NAME.bmfont"
FONT_SCALE=""
for SUBDIR in tablethd tablet phonehd phone; do
mkdir -p "$FONT_NAME.bmfont/resources-$SUBDIR"
if [ "$SUBDIR" = "tablet" -o "$SUBDIR" = "phonehd" ]; then
FONT_SCALE="-rfs 0.5"
elif [ "$SUBDIR" = "phone" ]; then
FONT_SCALE="-rfs 0.25"
fi
echo "gdcl $FONT_NAME.GlyphProject $FONT_NAME.bmfont/resources-$SUBDIR/$FONT_NAME $FONT_SCALE -fo PlainText-fnt"
gdcl $FONT_NAME.GlyphProject $FONT_NAME.bmfont/resources-$SUBDIR/$FONT_NAME $FONT_SCALE -fo PlainText-fnt
done
@daaa57150
Copy link

Saved me some headaches, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment