From 9c73e0af033500165de4a5add9ee9d5f325f4bcb Mon Sep 17 00:00:00 2001 From: FreezyLemon Date: Sat, 3 Nov 2018 17:07:11 +0100 Subject: [PATCH] Add instructions --- osu.Game.Resources/Fonts/README.md | 26 ++++++++++++++++++++ osu.Game.Resources/osu.Game.Resources.csproj | 3 +++ 2 files changed, 29 insertions(+) create mode 100644 osu.Game.Resources/Fonts/README.md diff --git a/osu.Game.Resources/Fonts/README.md b/osu.Game.Resources/Fonts/README.md new file mode 100644 index 0000000..9c0d413 --- /dev/null +++ b/osu.Game.Resources/Fonts/README.md @@ -0,0 +1,26 @@ +# How to create binary font files + +There are two options: + +## When generating + +When using the official BMFont generator, there is a setting in "Export Options" that specifies the output file format. Just set that to "binary" to get the correct file format. Remember to use the file extension ".bin". + +## Converting existing fonts + +```csharp +using SharpFNT; + +string filename = "MyFont.fnt"; + +var font = BitmapFont.FromFile(filename); + +// This value is ignored for Unicode fonts, but serializing will fail +// if this is empty so just set it to ANSI (0 in binary) +if (font.Info.Charset == string.Empty) +{ + font.Info.Charset = "ANSI"; +} + +font.Save(Path.ChangeExtension(filename, "bin"), FormatHint.Binary); +``` \ No newline at end of file diff --git a/osu.Game.Resources/osu.Game.Resources.csproj b/osu.Game.Resources/osu.Game.Resources.csproj index 5cb326f..bec8678 100644 --- a/osu.Game.Resources/osu.Game.Resources.csproj +++ b/osu.Game.Resources/osu.Game.Resources.csproj @@ -14,4 +14,7 @@ + + + \ No newline at end of file