Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 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);
 }