Introducing Glyph Designer Command Line (GDCL) Get Glyph Designer

Posted on 10 December 2012

We are pleased to announce the release of Glyph Designer Command Line (GDCL). We have had many requests to provide a command line tool that can be used to generate Glyph Designer output during the build process and that is exactly what GDCL is designed to do. It also allows the size of the font being generated to be specified as well. The idea is that you design the largest font you need in Glyph Designer and then use that project with GDCL but specify the font size you would like. This allows you to then generate the fonts you need for both SD and HD from just a single project file. More on that later.

By providing GDCL with the location and name of a Glyph Designer project file and the location and name of the output, GDCL uses the same render pipeline as Glyph Designer to create both the control file and texture atlas file. Below is a basic example of how to use GDCL from the command line.

./GDCL ~/Desktop/MikesProject ~/Desktop/MikesFont

Typing in the above will cause a control file called MikesFont.fnt and a texture atlas called MikesFont.png to be generated at the location provided. All the settings that have been stored in the project file will be used to generate the output. This includes the export settings such as export type. If you want to override the export type then you can provide an extra switch on the command like

-f outputFormat

The output format specified can be one of the following:

PlainText-fnt

This format is commonly used with Cocos2D and generates a plain text control file that has the .fnt extension

PlainText-txt

This format is commonly used with Unity modules and generates a plain text control file that has the .txt extension

XML-fnt

This format is commonly used with Sparrow and Starling and generates an XML control file that has the .fnt extension

LUA-lua

This format is commonly used with Corona or Text Candy and generates a LUA control file that has the .lua extension

As I mentioned earlier, it's also possible to define the size you want the font to be. If you don't provide a font size then the font size defined in the project will be used. When defining a font size it can be any size smaller than the default size in the project. GDCL uses the difference between the native font size and new font size to work out how to adjust the effects that have been applied to the text, such as the shadow and outline. GDCL calculates the control file values and generates the texture at the requested size using the adjustments calculated for the effects. It doesn't just scale the full size font image which can cause visual artefacts and rounding problems.

If you create a font in Glyph Designer that has a size of 100, you can easily export that font at size 65 with the same appearance as shown below

./GDCL ~/Desktop/MyLargeFont ~/Desktop/SmallerFont -fs 65

That is all that's needed to generate the font at size 65.

Another option for resizing the font is to use the -rfs switch. This takes a relative size for the font e.g. 0.5 will generate a font that is 50% the size of the font in the project file. This approach means you don't even need to know the size of te font in the project file and still generate the sizes you need.

An example workflow using GDCL would see the font designer creating a Glyph Designer Project that contains the largest version of the font to be used. They don't need to generate output and send that to the developer, they just send the developer the project file.

The developer then adds a script phase to the build process in Xcode, before the copy phase. In that script the developer can run GDCL as many times as necessary using the supplied project file and specifying all the output names and sizes you need. The following script assumes that GDCL is on the Desktop, although you can place GDCL anywhere you wish. It also assumes that the project file is on the desktop.

cd ~/Desktop

./GDCL MyGameFontHD ~/Desktop/MyFonts/MyGameFont-ipadhd

./GDCL MyGameFontHD ~/Desktop/MyFonts/MyGameFont-hd -fs 50

./GDCL MyGameFontHD ~/Desktop/MyFonts/MyGameFont -fs 25

In the copy phase you then make sure that these files get copied to the app bundle and that's it. Every time you build your project you will also build the fonts you need at the different sizes you need for your project. Should a new project file have been provided and placed in the correct location, the fonts generated will now use the new font.

 There a few other switches that are available too.

-ol Overrides the projects settings and generates a second texture atlas that has a red box around each glyph. This is handy if you want to edit the glyphs in an external app and want to easily see the bounds of the glyphs.

-su Overrides the projects settings and causes any glyphs within the included glyphs in the project that aren't supported in the projects font to be substituted with another font automatically.

-v Causes verbose output

With GDCL in your build process driven by the Glyph Designer project file and the ability to automatically generate different font sizes, it should really help to streamline your font asset management.

To run GDCL you will need to have Glyph Designer installed on your machine with a valid license. GDCL will work when there is no license, such as when trying out the trial download, but a watermark is placed over the top of any generated texture atlases.

There is an installer built into the latest version of Glyph Designer, 1.7.4 (3745), in the main Glyph Designer menu. This is the recommended way to install GDCL as it will always then be kept up to date when you download any other version of Glyph Designer going forward.

We are really excited to get this into the hands of our users and hope that you find it useful. We have even more plans for the command line tool in Glyph Designer 2.0 :)

Mike

blog comments powered by Disqus