原文鏈接:https://github.com/libgdx/libgdx/wiki/Bitmap-fonts
譯者:重慶好爸爸 game4kids@163.com
謝絕轉載
LibGDX 使用bitmap files(pngs)來渲染字體。字體中的每個字形都具有相應的紋理區域。
BitmapFont class (code)
BitmapFont在LibGdx 1.5.6版本進行了重構. This blog post 有關于變化的細節,還有一個小例子展示了如何從1.5.6之前的代碼移動到新的API。
有關使用BitmapFont的教程可在LibGDX.info上獲得
字體文件的格式規范 File format specifications for the font file
參考文獻指出,bmFont最初由AndreasJ?nsson在AngelCode創建
BMFont - BMFont - 文件格式的原始規范。
Glyph Designer - 有關輸出的詳細信息,包括二進制格式。
創建Bitmaps的工具 Tools for Creating Bitmaps
Hiero - 用于將系統字體轉換為位圖的實用程序
ShoeBox - 允許您從圖像加載自定義字形,然后從中創建位圖字體。 有一個使用它與libgdx的偉大教程
Glyph Designer - 一種商業位圖字體工具,可用于陰影,漸變,筆觸等各種選項。
Littera - 在線位圖字體生成器,具有大量的自定義(需要Adobe Flash)。
其他工具 Other Tools
FreeTypeFontGenerator - 為字體生成位圖,而不是提供由Hiero等實用程序制作的預渲染位圖
Examples : (more)
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("data/unbom.ttf"));
FreeTypeFontParameter parameter = new FreeTypeFontParameter();
parameter.size = 18;
parameter.characters = "???/????";
BitmapFont koreanFont = generator.generateFont(parameter);
parameter.characters = FreeTypeFontGenerator.DEFAULT_CHARS;
generator = new FreeTypeFontGenerator(Gdx.files.internal("data/russkij.ttf"));
BitmapFont cyrillicFont = generator.generateFont(parameter);
generator.dispose();
Distance field fonts - 可用于縮放/旋轉字體,而不會有丑陋的文物
gdx-smart-font - 非官方的libgdx插件,用于根據屏幕大小自動生成和緩存位圖字體. (Uses FreeTypeFontGenerator)