コード例 #1
0
ファイル: LibGFX_Tools.cs プロジェクト: brand7n/eGFX
        public void CheckFontConfig(String PathToFontFolder, Font F)
        {
            FontBuilderConfig MyFontBuilderConfig;


            if (File.Exists(Path.Combine(PathToFontFolder, "FontConfiguration.jsx")) == false)
            {
                MessagePost("Building Configuration...");

                MyFontBuilderConfig = new FontBuilderConfig();
                FileInfo fInfo = new FileInfo(Path.Combine(PathToFontFolder, "FontConfiguration.jsx"));
                MyFontBuilderConfig.CombinedOutputName = fInfo.Directory.Name;

                Directory.CreateDirectory(Path.Combine(PathToFontFolder, "SrcImages"));

                MyFontBuilderConfig.InterCharacterSpacing = 1;
                MyFontBuilderConfig.SpacesPerTab          = 4;

                if (F != null)
                {
                    MyFontBuilderConfig.Ascent      = (int)((double)F.Size * (double)F.FontFamily.GetCellAscent(F.Style) / (double)F.FontFamily.GetEmHeight(F.Style)) * 256;
                    MyFontBuilderConfig.Descent     = (int)((double)F.Size * (double)F.FontFamily.GetCellDescent(F.Style) / (double)F.FontFamily.GetEmHeight(F.Style)) * 256;
                    MyFontBuilderConfig.LineSpacing = (int)((double)F.Size * (double)F.FontFamily.GetLineSpacing(F.Style) / (double)F.FontFamily.GetEmHeight(F.Style)) * 256;
                }
                else
                {
                    MyFontBuilderConfig.Ascent      = 0;
                    MyFontBuilderConfig.Descent     = 0;
                    MyFontBuilderConfig.LineSpacing = 0;
                }

                Serializer   MySerializer = new Serializer(typeof(FontBuilderConfig));
                StreamWriter SR           = new StreamWriter(Path.Combine(PathToFontFolder, "FontConfiguration.jsx"));
                MySerializer.Serialize(MyFontBuilderConfig, SR);
                SR.Close();
            }
            else
            {
                MessagePost("Font configuration file found...");
            }
        }
コード例 #2
0
ファイル: LibGFX_Tools.cs プロジェクト: brand7n/eGFX
        public void GenerateFontConfigFile(String PathToFontFolder, Font F, TextRenderingHint TRH)
        {
            FontBuilderConfig MyFontBuilderConfig;

            MessagePost("Building Configuration...");

            MyFontBuilderConfig = new FontBuilderConfig();
            FileInfo fInfo = new FileInfo(Path.Combine(PathToFontFolder, "FontConfiguration.jsx"));

            MyFontBuilderConfig.CombinedOutputName = fInfo.Directory.Name;

            MyFontBuilderConfig.InterCharacterSpacing = 1;

            MyFontBuilderConfig.SpacesPerTab = 4;

            Serializer   MySerializer = new Serializer(typeof(FontBuilderConfig));
            StreamWriter SR           = new StreamWriter(Path.Combine(PathToFontFolder, "FontConfiguration.jsx"));

            MySerializer.Serialize(MyFontBuilderConfig, SR);
            SR.Close();
        }
コード例 #3
0
ファイル: LibGFX_Tools.cs プロジェクト: brand7n/eGFX
        public void GenerateFontConfigFile(String PathToFontFolder, Font F, TextRenderingHint TRH)
        {
            FontBuilderConfig MyFontBuilderConfig;

                MessagePost("Building Configuration...");

                MyFontBuilderConfig = new FontBuilderConfig();
                FileInfo fInfo = new FileInfo(Path.Combine(PathToFontFolder, "FontConfiguration.jsx"));
                MyFontBuilderConfig.CombinedOutputName = fInfo.Directory.Name;

                MyFontBuilderConfig.InterCharacterSpacing = 1;

                MyFontBuilderConfig.SpacesPerTab = 4;

                Serializer MySerializer = new Serializer(typeof(FontBuilderConfig));
                StreamWriter SR = new StreamWriter(Path.Combine(PathToFontFolder, "FontConfiguration.jsx"));
                MySerializer.Serialize(MyFontBuilderConfig, SR);
                SR.Close();
        }
コード例 #4
0
ファイル: LibGFX_Tools.cs プロジェクト: brand7n/eGFX
        public void CheckFontConfig(String PathToFontFolder,Font F)
        {
            FontBuilderConfig MyFontBuilderConfig;

            if (File.Exists(Path.Combine(PathToFontFolder, "FontConfiguration.jsx")) == false)
            {
                MessagePost("Building Configuration...");

                MyFontBuilderConfig = new FontBuilderConfig();
                FileInfo fInfo = new FileInfo(Path.Combine(PathToFontFolder, "FontConfiguration.jsx"));
                MyFontBuilderConfig.CombinedOutputName = fInfo.Directory.Name;

                Directory.CreateDirectory(Path.Combine(PathToFontFolder, "SrcImages"));

                MyFontBuilderConfig.InterCharacterSpacing = 1;
                MyFontBuilderConfig.SpacesPerTab = 4;

                if (F != null)
                {
                    MyFontBuilderConfig.Ascent = (int)((double)F.Size * (double)F.FontFamily.GetCellAscent(F.Style) / (double)F.FontFamily.GetEmHeight(F.Style))*256;
                    MyFontBuilderConfig.Descent = (int)((double)F.Size * (double)F.FontFamily.GetCellDescent(F.Style) / (double)F.FontFamily.GetEmHeight(F.Style))*256;
                    MyFontBuilderConfig.LineSpacing = (int)((double)F.Size * (double)F.FontFamily.GetLineSpacing(F.Style) / (double)F.FontFamily.GetEmHeight(F.Style))*256;
                }
                else
                {
                    MyFontBuilderConfig.Ascent = 0;
                    MyFontBuilderConfig.Descent = 0;
                    MyFontBuilderConfig.LineSpacing = 0;
                }

                Serializer MySerializer = new Serializer(typeof(FontBuilderConfig));
                StreamWriter SR = new StreamWriter(Path.Combine(PathToFontFolder, "FontConfiguration.jsx"));
                MySerializer.Serialize(MyFontBuilderConfig, SR);
                SR.Close();
            }
            else
            {
                MessagePost("Font configuration file found...");
            }
        }