/// <summary> /// Decompose the Doom 3 font into individual character images. /// It also applies The Dark Mod's code page conversion. /// To ignore any conversions and use iso-8859-1 code page choose "english" language. /// </summary> /// <param name="d3FontInputFileName">Doom 3 .dat font file.</param> /// <param name="dirWithFontTextures">Path to directory containing font textures, like "arial_0_48.dds".</param> /// <param name="lang">The Dark Mod's language to use. Can be "english", "polish", "german", etc.</param> /// <param name="dirWithLangMaps">Optional: Directory containing The Dark Mod's code page remapping maps, like "polish.map".</param> /// <param name="zeroSizeImage">Optional: image that have 0x0 size.</param> /// <param name="bmConfigFile">File to output BMFont's external image configuration to.</param> /// <param name="imageOutputDir">Directory into which output character images.</param> public static void decomposeD3(DecomposeD3Options options) { D3Font d3Font = new D3Font(); d3Font.Load(options.d3FontInputFileName); if (!File.Exists(options.bmConfigFile)) { File.Create(options.bmConfigFile).Dispose(); } IList<string> bmIcons = D3FontDecompose.Decompose( d3Font, options.dirWithFontTextures, options.langs, options.dirWithLangMaps, options.zeroSizeImage, options.imageOutputDir ); IList<string> bmConfig = File.ReadAllLines(options.bmConfigFile).ToList(); var noIconsConfig = from line in bmConfig where !line.StartsWith("icon=") select line; var newConfig = (options.bmConfigAppend ? bmConfig : noIconsConfig).Union(bmIcons); File.WriteAllLines(options.bmConfigFile, newConfig); }
/// <summary> /// Decompose the Doom 3 font into individual character images. /// It also applies The Dark Mod's code page conversion. /// To ignore any conversions and use iso-8859-1 code page choose "english" language. /// </summary> /// <param name="d3FontInputFileName">Doom 3 .dat font file.</param> /// <param name="dirWithFontTextures">Path to directory containing font textures, like "arial_0_48.dds".</param> /// <param name="lang">The Dark Mod's language to use. Can be "english", "polish", "german", etc.</param> /// <param name="dirWithLangMaps">Optional: Directory containing The Dark Mod's code page remapping maps, like "polish.map".</param> /// <param name="zeroSizeImage">Optional: image that have 0x0 size.</param> /// <param name="bmConfigFile">File to output BMFont's external image configuration to.</param> /// <param name="imageOutputDir">Directory into which output character images.</param> public static void decomposeD3(DecomposeD3Options options) { D3Font d3Font = new D3Font(); d3Font.Load(options.d3FontInputFileName); if (!File.Exists(options.bmConfigFile)) { File.Create(options.bmConfigFile).Dispose(); } IList <string> bmIcons = D3FontDecompose.Decompose( d3Font, options.dirWithFontTextures, options.langs, options.dirWithLangMaps, options.zeroSizeImage, options.imageOutputDir ); IList <string> bmConfig = File.ReadAllLines(options.bmConfigFile).ToList(); var noIconsConfig = from line in bmConfig where !line.StartsWith("icon=") select line; var newConfig = (options.bmConfigAppend ? bmConfig : noIconsConfig).Union(bmIcons); File.WriteAllLines(options.bmConfigFile, newConfig); }
public static void SaveFakeD3Font(this BMFont font, string fileName, float glyphScale = 1.0f) { D3Font d3font = new D3Font(); d3font.Load(font, true, glyphScale); d3font.Save(fileName); }
private D3FontDecompose(D3Font font, string dirWithFontTextures, string[] langs, string dirWithLangMaps, string zeroSizeImage, string imageOutputDir) { this.font = font; this.dirWithFontTextures = dirWithFontTextures; this.langs = langs; this.dirWithLangMaps = dirWithLangMaps; this.imageOutputDir = imageOutputDir; this.zeroSizeImage = zeroSizeImage; Directory.CreateDirectory(imageOutputDir); foreach (string lang in langs) { baseCodePageEncodings[lang] = BaseCodePageEncodingForLang(lang); LoadRemapTableForLang(lang); } }
/// <summary> /// Decompose the Doom 3 font into individual character images. /// It also applies The Dark Mod's code page conversion. /// To ignore any conversions and use iso-8859-1 code page choose "english" language. /// </summary> /// <param name="font">Doom 3 font</param> /// <param name="dirWithFontTextures">Path to directory containing font textures, like "arial_0_48.dds".</param> /// <param name="lang">The Dark Mod's language to use. Can be "english", "polish", "german", etc.</param> /// <param name="dirWithLangMaps">Optional: Directory containing The Dark Mod's code page remapping maps, like "polish.map".</param> /// <param name="zeroSizeImage">Optional: image that have 0x0 size.</param> /// <param name="bmConfigFile">File to output BMFont's external image configuration to.</param> /// <param name="imageOutputDir">Directory into which output character images.</param> public static IList <string> Decompose(D3Font font, string dirWithFontTextures, string[] langs, string dirWithLangMaps, string zeroSizeImage, string imageOutputDir) { var fontDecomposer = new D3FontDecompose(font, dirWithFontTextures, langs, dirWithLangMaps, zeroSizeImage, imageOutputDir); return(fontDecomposer.Decompose()); }
/// <summary> /// Decompose the Doom 3 font into individual character images. /// It also applies The Dark Mod's code page conversion. /// To ignore any conversions and use iso-8859-1 code page choose "english" language. /// </summary> /// <param name="font">Doom 3 font</param> /// <param name="dirWithFontTextures">Path to directory containing font textures, like "arial_0_48.dds".</param> /// <param name="lang">The Dark Mod's language to use. Can be "english", "polish", "german", etc.</param> /// <param name="dirWithLangMaps">Optional: Directory containing The Dark Mod's code page remapping maps, like "polish.map".</param> /// <param name="zeroSizeImage">Optional: image that have 0x0 size.</param> /// <param name="bmConfigFile">File to output BMFont's external image configuration to.</param> /// <param name="imageOutputDir">Directory into which output character images.</param> public static IList<string> Decompose(D3Font font, string dirWithFontTextures, string[] langs, string dirWithLangMaps, string zeroSizeImage, string imageOutputDir) { var fontDecomposer = new D3FontDecompose(font, dirWithFontTextures, langs, dirWithLangMaps, zeroSizeImage, imageOutputDir); return fontDecomposer.Decompose(); }