Esempio n. 1
0
    /// <summary>
    /// Makes the atlas.
    /// </summary>
    protected void MakeAtlas(string lang, ref LocalizationFontConfig.FontConfig config)
    {
        string filename = System.IO.Path.Combine(_toolDirectory, ToolAtlasMaker);
        string path     = LocalizationEditorUtils.CreateDirectoryIfNotExist(_workDirectory, "Fonts", lang);

        config._atlasFile = System.IO.Path.Combine(path, config._fontName + ".png");

        LocalizationCommand cmd = new LocalizationCommand("python");

        cmd.SetRequiredParams(filename, config._imagesDir, config._atlasFile);
        cmd.AddOptionalParams("-p", config._padding);

        cmd.Execute();


        _buildProgress += _buildstep;
        EditorUtility.DisplayCancelableProgressBar("Fonts maker", "Building...", _buildProgress);
    }
Esempio n. 2
0
    /// <summary>
    /// Creates the images.
    /// </summary>
    protected void CreateImages(string lang, ref LocalizationFontConfig.FontConfig config, string charsetFile)
    {
        string filename = System.IO.Path.Combine(_toolDirectory, ToolTTF2Images);

        LocalizationCommand cmd = new LocalizationCommand(filename);

        config._imagesDir = LocalizationEditorUtils.CreateDirectoryIfNotExist(_toolDirectory, "Temp", lang, config._fontName);
        config._font_info = System.IO.Path.Combine(config._imagesDir, "font_info.txt");

        cmd.SetRequiredParams(config._ttfFile, config._fontSize, config._imagesDir);

        cmd.AddOptionalParams("-p", config._border);
        cmd.AddOptionalParams("-C", charsetFile);

        cmd.Execute();


        _buildProgress += _buildstep;
        EditorUtility.DisplayCancelableProgressBar("Fonts maker", "Building...", _buildProgress);
    }
Esempio n. 3
0
    /// <summary>
    /// Generates the fnt.
    /// </summary>
    protected void GenerateFnt(string lang, ref LocalizationFontConfig.FontConfig config)
    {
        string filename = System.IO.Path.Combine(_toolDirectory, ToolFntMaker);
        string path     = LocalizationEditorUtils.CreateDirectoryIfNotExist(_workDirectory, "Fonts", lang);
        string fntFile  = System.IO.Path.Combine(path, config._fontName + ".fnt");
        string txfFile  = System.IO.Path.Combine(path, config._fontName + ".txt");

        path = System.IO.Path.Combine(path, config._fontName + ".config");

        LocalizationCommand cmd = new LocalizationCommand("python");

        cmd.SetRequiredParams(filename, path, config._atlasFile, config._font_info);

        cmd.Execute();

        // Rename *.fnt to *.txt
        System.IO.File.Delete(txfFile);
        System.IO.File.Move(fntFile, txfFile);

        _buildProgress += _buildstep;
        EditorUtility.DisplayCancelableProgressBar("Fonts maker", "Building...", _buildProgress);
    }
Esempio n. 4
0
    protected void ReplaceCustomImages(string lang, ref LocalizationFontConfig.FontConfig config)
    {
        if (config._customImagesPath == "")
        {
            return;
        }

        if (!System.IO.Directory.Exists(config._customImagesPath))
        {
            return;
        }

        string filename         = System.IO.Path.Combine(_toolDirectory, ToolCustomImages);
        LocalizationCommand cmd = new LocalizationCommand("python");

        cmd.SetRequiredParams(filename, config._imagesDir, config._imagesDir, config._customImagesPath);

        cmd.Execute();


        _buildProgress += _buildstep;
        EditorUtility.DisplayCancelableProgressBar("Fonts maker", "Building...", _buildProgress);
    }