OSDN Git Service

#xxxxx 2018/3/8のコミットをrevertした。道州制の副作用で、DPI設定によってフォントサイズが変わって見えるようになってしまったため。
authoryyagi <yyagi.dtxmania@gmail.com>
Thu, 23 Aug 2018 14:06:29 +0000 (23:06 +0900)
committeryyagi <yyagi.dtxmania@gmail.com>
Thu, 23 Aug 2018 14:06:29 +0000 (23:06 +0900)
DTXMania/コード/ステージ/04.コンフィグ/CActConfigKeyAssign.cs
DTXMania/コード/ステージ/04.コンフィグ/CStageコンフィグ.cs
DTXMania/コード/ステージ/05.選曲/CActSelectArtistComment.cs
DTXMania/コード/ステージ/05.選曲/CActSelect曲リスト.cs
DTXMania/コード/ステージ/05.選曲/CActShowSongPath.cs
DTXMania/コード/ステージ/05.選曲/CStage選曲.cs
DTXMania/コード/全体/CPrivateFastFont.cs
DTXMania/コード/全体/CPrivateFont.cs

index 1d9dbe9..e08b1ba 100644 (file)
@@ -113,11 +113,13 @@ namespace DTXMania
                        {
                                string fontname = CDTXMania.Instance.Resources.Explanation("strCfgConfigurationKeyAssignFontFileName");
                                string path = Path.Combine(@"Graphics\fonts", fontname);
-                               this.pf項目名 = new CPrivateFastFont(CSkin.Path(path), (int)(18 * Scale.Y));   // t項目リストの設定 の前に必要
+                               this.prvFont = new CPrivateFastFont(CSkin.Path(path), (int)(18 * Scale.Y));
+                               //this.prvFont = new CPrivateFastFont(CSkin.Path(@"Graphics\fonts\mplus-1p-heavy.ttf"), (int)(18 * Scale.Y)); // t項目リストの設定 の前に必要
                                this.txカーソル = TextureFactory.tテクスチャの生成(CSkin.Path(@"Graphics\ScreenConfig menu cursor.png"), false);
 
                                #region [ Hit key to assign ダイアログイメージ作成 ]
-                               this.pfダイアログ = new CPrivateFastFont(CSkin.Path(Path.Combine(@"Graphics\fonts\", fontname)), 30, FontStyle.Bold);
+                               string fontPath = CDTXMania.Instance.Resources.Explanation("strCfgBaseFontFileName");
+                               var prvFont = new CPrivateFastFont(CSkin.Path(Path.Combine(@"Graphics\fonts\", fontPath)), 30, FontStyle.Bold);
                                var bmp = new Bitmap(CSkin.Path(@"Graphics\ScreenConfig hit key to assign dialog.png"));
 
                                string strHitKey = CDTXMania.Instance.Resources.Explanation("strCfgHitKeyToAssign");
@@ -129,16 +131,16 @@ namespace DTXMania
                                foreach (var s in strComments)
                                {
                                        string ss = s.Trim();
-                                       var b = pfダイアログ.DrawPrivateFont(ss, Color.White);
+                                       var b = prvFont.DrawPrivateFont(ss, Color.White);
                                        int x = (bmp.Width - b.Width) / 2;
                                        g.DrawImage(b, x, y);
                                        b.Dispose();
 
-                                       y += pfダイアログ.RectStrings.Height;
+                                       y += prvFont.RectStrings.Height;
                                }
                                g.Dispose();
-                               //prvFont.Dispose();
-                               //prvFont = null;
+                               prvFont.Dispose();
+                               prvFont = null;
 
                                this.txHitKeyダイアログ = TextureFactory.tテクスチャの生成(bmp, false);
 
@@ -154,8 +156,7 @@ namespace DTXMania
                {
                        if (base.b活性化してる)
                        {
-                               TextureFactory.t安全にDisposeする(ref pfダイアログ);
-                               TextureFactory.t安全にDisposeする(ref pf項目名);
+                               TextureFactory.t安全にDisposeする(ref prvFont);
                        }
                }
 
@@ -203,7 +204,7 @@ namespace DTXMania
                                int num5 = 20;
                                int x = 0x134;
                                int y = 0x40;
-                               using (Bitmap bmpStr = pf項目名.DrawPrivateFont(this.strパッド名, Color.White, Color.Black))
+                               using (Bitmap bmpStr = prvFont.DrawPrivateFont(this.strパッド名, Color.White, Color.Black))
                                {
                                        CTexture txStr = TextureFactory.tテクスチャの生成(bmpStr);
                                        txStr.vc拡大縮小倍率 = new Vector3(0.75f, 0.75f, 1f);
@@ -239,8 +240,8 @@ namespace DTXMania
                                                        strParam = string.Format("{0,2}.", i + 1);
                                                        b強調 = (ptr == i);
                                                        using (Bitmap bmpStr = b強調 ?
-                                                                       pf項目名.DrawPrivateFont(strParam, Color.White, Color.Black, Color.Yellow, Color.OrangeRed) :
-                                                                       pf項目名.DrawPrivateFont(strParam, Color.White, Color.Black))
+                                                                       prvFont.DrawPrivateFont(strParam, Color.White, Color.Black, Color.Yellow, Color.OrangeRed) :
+                                                                       prvFont.DrawPrivateFont(strParam, Color.White, Color.Black))
                                                        {
                                                                CTexture txStr = TextureFactory.tテクスチャの生成(bmpStr, false);
                                                                txStr.vc拡大縮小倍率 = new Vector3(0.75f, 0.75f, 1f);
@@ -255,8 +256,8 @@ namespace DTXMania
                                strParam = "Reset All Assign";
                                b強調 = (ptr == CConfigXml.AssignableCodes - 2);
                                using (Bitmap bmpStr = b強調 ?
-                                               pf項目名.DrawPrivateFont(strParam, Color.White, Color.Black, Color.Yellow, Color.OrangeRed) :
-                                               pf項目名.DrawPrivateFont(strParam, Color.White, Color.Black))
+                                               prvFont.DrawPrivateFont(strParam, Color.White, Color.Black, Color.Yellow, Color.OrangeRed) :
+                                               prvFont.DrawPrivateFont(strParam, Color.White, Color.Black))
                                {
                                        CTexture txStr = TextureFactory.tテクスチャの生成(bmpStr, false);
                                        txStr.vc拡大縮小倍率 = new Vector3(0.75f, 0.75f, 1f);
@@ -268,8 +269,8 @@ namespace DTXMania
                                strParam = "<< Returnto List";
                                b強調 = (ptr == CConfigXml.AssignableCodes - 1);
                                using (Bitmap bmpStr = b強調 ?
-                                               pf項目名.DrawPrivateFont(strParam, Color.White, Color.Black, Color.Yellow, Color.OrangeRed) :
-                                               pf項目名.DrawPrivateFont(strParam, Color.White, Color.Black))
+                                               prvFont.DrawPrivateFont(strParam, Color.White, Color.Black, Color.Yellow, Color.OrangeRed) :
+                                               prvFont.DrawPrivateFont(strParam, Color.White, Color.Black))
                                {
                                        CTexture txStr = TextureFactory.tテクスチャの生成(bmpStr, false);
                                        txStr.vc拡大縮小倍率 = new Vector3(0.75f, 0.75f, 1f);
@@ -444,7 +445,7 @@ namespace DTXMania
                private string strパッド名;
                private CTexture txHitKeyダイアログ;
                private CTexture txカーソル;
-               private CPrivateFastFont pf項目名, pfダイアログ;
+               private CPrivateFastFont prvFont;
 
                private void tアサインコードの描画_Joypad(int line, int x, int y, int nID, int nCode, bool b強調)
                {
@@ -491,8 +492,8 @@ namespace DTXMania
                                        break;
                        }
                        using (Bitmap bmpStr = b強調 ?
-                                       pf項目名.DrawPrivateFont(str, Color.White, Color.Black, Color.Yellow, Color.OrangeRed) :
-                                       pf項目名.DrawPrivateFont(str, Color.White, Color.Black))
+                                       prvFont.DrawPrivateFont(str, Color.White, Color.Black, Color.Yellow, Color.OrangeRed) :
+                                       prvFont.DrawPrivateFont(str, Color.White, Color.Black))
                        {
                                CTexture txStr = TextureFactory.tテクスチャの生成(bmpStr, false);
                                txStr.vc拡大縮小倍率 = new Vector3(0.75f, 0.75f, 1f);
@@ -518,8 +519,8 @@ namespace DTXMania
                        }
 
                        using (Bitmap bmpStr = b強調 ?
-                                       pf項目名.DrawPrivateFont(str, Color.White, Color.Black, Color.Yellow, Color.OrangeRed) :
-                                       pf項目名.DrawPrivateFont(str, Color.White, Color.Black))
+                                       prvFont.DrawPrivateFont(str, Color.White, Color.Black, Color.Yellow, Color.OrangeRed) :
+                                       prvFont.DrawPrivateFont(str, Color.White, Color.Black))
                        {
                                CTexture txStr = TextureFactory.tテクスチャの生成(bmpStr, false);
                                txStr.vc拡大縮小倍率 = new Vector3(0.75f, 0.75f, 1f);
@@ -532,8 +533,8 @@ namespace DTXMania
                {
                        string str = string.Format("{0,2}. MidiIn #{1} code.{2}", line, nID, nCode);
                        using (Bitmap bmpStr = b強調 ?
-                                       pf項目名.DrawPrivateFont(str, Color.White, Color.Black, Color.Yellow, Color.OrangeRed) :
-                                       pf項目名.DrawPrivateFont(str, Color.White, Color.Black))
+                                       prvFont.DrawPrivateFont(str, Color.White, Color.Black, Color.Yellow, Color.OrangeRed) :
+                                       prvFont.DrawPrivateFont(str, Color.White, Color.Black))
                        {
                                CTexture txStr = TextureFactory.tテクスチャの生成(bmpStr, false);
                                txStr.vc拡大縮小倍率 = new Vector3(0.75f, 0.75f, 1f);
@@ -546,8 +547,8 @@ namespace DTXMania
                {
                        string str = string.Format("{0,2}. Mouse Button{1}", line, nCode);
                        using (Bitmap bmpStr = b強調 ?
-                                       pf項目名.DrawPrivateFont(str, Color.White, Color.Black, Color.Yellow, Color.OrangeRed) :
-                                       pf項目名.DrawPrivateFont(str, Color.White, Color.Black))
+                                       prvFont.DrawPrivateFont(str, Color.White, Color.Black, Color.Yellow, Color.OrangeRed) :
+                                       prvFont.DrawPrivateFont(str, Color.White, Color.Black))
                        {
                                CTexture txStr = TextureFactory.tテクスチャの生成(bmpStr, false);
                                txStr.vc拡大縮小倍率 = new Vector3(0.75f, 0.75f, 1f);
index 26d4ae2..44371c7 100644 (file)
@@ -31,7 +31,7 @@ namespace DTXMania
                CTextureAf tx上部パネル;
                CTexture tx説明文パネル;
                CTexture tx背景;
-               CPrivateFastFont prvFont, prvFont_Description;
+               CPrivateFastFont prvFont;
                CTexture[,] txMenuItemLeft;
                STDGBSValue<float> fDisplayLagTimeBaseMs;
 
@@ -131,11 +131,7 @@ namespace DTXMania
                                try
                                {
                                        this.n現在のメニュー番号 = 0;
-                                       string fontname = CDTXMania.Instance.Resources.Explanation("strCfgConfigurationDescriptionFontFileName");
-                                       string path = Path.Combine(@"Graphics\fonts", fontname);
-                                       this.prvFont_Description = new CPrivateFastFont(CSkin.Path(path), (int)(26f/3.5 * Scale.Y));
-
-                                       this.ftフォント = this.prvFont_Description.font;    //new Font("MS PGothic", 26f / 2 * Scale.Y, FontStyle.Bold, GraphicsUnit.Pixel);            //
+                                       this.ftフォント = new Font("MS PGothic", 26f / 2 * Scale.Y, FontStyle.Bold, GraphicsUnit.Pixel);            //
                                        for (int i = 0; i < 4; i++)
                                        {
                                                this.ctキー反復用[i] = new CCounter(0, 0, 0, CDTXMania.Instance.Timer);
@@ -180,8 +176,6 @@ namespace DTXMania
                                        CDTXMania.Instance.ConfigIni.nJudgeLinePosOffset.Guitar.Value = (int)(fDisplayLagTimeBaseMs.Guitar * (CDTXMania.Instance.ConfigIni.nScrollSpeed.Guitar + 1));
                                        CDTXMania.Instance.ConfigIni.nJudgeLinePosOffset.Bass.Value = (int)(fDisplayLagTimeBaseMs.Bass * (CDTXMania.Instance.ConfigIni.nScrollSpeed.Bass + 1));
 
-                                       prvFont_Description.Dispose();
-
                                        base.On非活性化();
                                }
                                catch (UnauthorizedAccessException e)
index e848524..6678f6e 100644 (file)
@@ -3,7 +3,6 @@ using System.Collections.Generic;
 using System.Text;
 using System.Drawing;
 using System.Diagnostics;
-using System.IO;
 using SharpDX;
 using FDK;
 
@@ -25,14 +24,13 @@ namespace DTXMania
                        if (cスコア != null)
                        {
                                Bitmap image = new Bitmap(1, 1);
-                               #region [ ARTISTテクスチャ生成 ]
                                TextureFactory.tテクスチャの解放(ref this.txArtist);
                                this.strArtist = cスコア.譜面情報.アーティスト名;
                                if ((this.strArtist != null) && (this.strArtist.Length > 0))
                                {
                                        Graphics graphics = Graphics.FromImage(image);
                                        graphics.PageUnit = GraphicsUnit.Pixel;
-                                       SizeF ef = graphics.MeasureString(this.strArtist, this.ftArtist描画用フォント);
+                                       SizeF ef = graphics.MeasureString(this.strArtist, this.ft描画用フォント);
                                        graphics.Dispose();
                                        if (ef.Width > SampleFramework.GameWindowSize.Width)
                                        {
@@ -40,10 +38,10 @@ namespace DTXMania
                                        }
                                        try
                                        {
-                                               Bitmap bitmap2 = new Bitmap((int)Math.Ceiling((double)ef.Width), (int)Math.Ceiling((double)this.ftArtist描画用フォント.Size));
+                                               Bitmap bitmap2 = new Bitmap((int)Math.Ceiling((double)ef.Width), (int)Math.Ceiling((double)this.ft描画用フォント.Size));
                                                graphics = Graphics.FromImage(bitmap2);
                                                graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
-                                               graphics.DrawString(this.strArtist, this.ftArtist描画用フォント, Brushes.White, (float)0f, (float)0f);
+                                               graphics.DrawString(this.strArtist, this.ft描画用フォント, Brushes.White, (float)0f, (float)0f);
                                                graphics.Dispose();
                                                this.txArtist = new CTexture(CDTXMania.Instance.Device, bitmap2, CDTXMania.Instance.TextureFormat);
                                                this.txArtist.vc拡大縮小倍率 = new Vector3(0.5f, 0.5f, 1f);
@@ -55,23 +53,21 @@ namespace DTXMania
                                                this.txArtist = null;
                                        }
                                }
-                               #endregion
-                               #region [ COMMENTテクスチャ生成 ]
                                TextureFactory.tテクスチャの解放(ref this.txComment);
                                this.strComment = cスコア.譜面情報.コメント;
                                if ((this.strComment != null) && (this.strComment.Length > 0))
                                {
                                        Graphics graphics2 = Graphics.FromImage(image);
                                        graphics2.PageUnit = GraphicsUnit.Pixel;
-                                       SizeF ef2 = graphics2.MeasureString(this.strComment, this.ftComment描画用フォント);
+                                       SizeF ef2 = graphics2.MeasureString(this.strComment, this.ft描画用フォント);
                                        Size size = new Size((int)Math.Ceiling((double)ef2.Width), (int)Math.Ceiling((double)ef2.Height));
                                        graphics2.Dispose();
                                        this.nテクスチャの最大幅 = CDTXMania.Instance.Device.Capabilities.MaxTextureWidth;
                                        int maxTextureHeight = CDTXMania.Instance.Device.Capabilities.MaxTextureHeight;
-                                       Bitmap bitmap3 = new Bitmap(size.Width, (int)Math.Ceiling((double)this.ftComment描画用フォント.Size));
+                                       Bitmap bitmap3 = new Bitmap(size.Width, (int)Math.Ceiling((double)this.ft描画用フォント.Size));
                                        graphics2 = Graphics.FromImage(bitmap3);
                                        graphics2.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
-                                       graphics2.DrawString(this.strComment, this.ftComment描画用フォント, Brushes.White, (float)0f, (float)0f);
+                                       graphics2.DrawString(this.strComment, this.ft描画用フォント, Brushes.White, (float)0f, (float)0f);
                                        graphics2.Dispose();
                                        this.nComment行数 = 1;
                                        this.nComment最終行の幅 = size.Width;
@@ -80,12 +76,12 @@ namespace DTXMania
                                                this.nComment行数++;
                                                this.nComment最終行の幅 -= this.nテクスチャの最大幅;
                                        }
-                                       while ((this.nComment行数 * ((int)Math.Ceiling((double)this.ftComment描画用フォント.Size))) > maxTextureHeight)
+                                       while ((this.nComment行数 * ((int)Math.Ceiling((double)this.ft描画用フォント.Size))) > maxTextureHeight)
                                        {
                                                this.nComment行数--;
                                                this.nComment最終行の幅 = this.nテクスチャの最大幅;
                                        }
-                                       Bitmap bitmap4 = new Bitmap((this.nComment行数 > 1) ? this.nテクスチャの最大幅 : this.nComment最終行の幅, this.nComment行数 * ((int)Math.Ceiling((double)this.ftComment描画用フォント.Size)));
+                                       Bitmap bitmap4 = new Bitmap((this.nComment行数 > 1) ? this.nテクスチャの最大幅 : this.nComment最終行の幅, this.nComment行数 * ((int)Math.Ceiling((double)this.ft描画用フォント.Size)));
                                        graphics2 = Graphics.FromImage(bitmap4);
                                        Rectangle srcRect = new Rectangle();
                                        Rectangle destRect = new Rectangle();
@@ -115,7 +111,6 @@ namespace DTXMania
                                        bitmap4.Dispose();
                                        bitmap3.Dispose();
                                }
-#endregion
                                image.Dispose();
                                if (this.txComment != null)
                                {
@@ -134,19 +129,7 @@ namespace DTXMania
 
                public override void On活性化()
                {
-                       string fontname = CDTXMania.Instance.Resources.Explanation("strCfgSelectMusicSongCommentFontFileName");
-                       string path = Path.Combine(@"Graphics\fonts", fontname);
-                       this.pfComment描画用フォント = new CPrivateFastFont( CSkin.Path(path), (float)(26f * Scale.Y * 72f / 96f) );
-                       // 72f/96f: 従来互換のために追加。DPI依存→非依存化に付随した変更。
-                       this.ftComment描画用フォント = this.pfComment描画用フォント.font;
-
-                       fontname = CDTXMania.Instance.Resources.Explanation("strCfgSelectMusicSongArtistFontFileName");
-                       path = Path.Combine(@"Graphics\fonts", fontname);
-                       this.pfArtist描画用フォント = new CPrivateFastFont( CSkin.Path(path), (float)(26f * Scale.Y * 72f / 96f) );
-                       // 72f/96f: 従来互換のために追加。DPI依存→非依存化に付随した変更。
-                       this.ftArtist描画用フォント = this.pfArtist描画用フォント.font;
-
-                       //this.ftComment描画用フォント = new Font("MS PGothic", 26f * Scale.Y, GraphicsUnit.Pixel);
+                       this.ft描画用フォント = new Font("MS PGothic", 26f * Scale.Y, GraphicsUnit.Pixel);
                        this.txArtist = null;
                        this.txComment = null;
                        this.strArtist = "";
@@ -161,25 +144,10 @@ namespace DTXMania
                {
                        TextureFactory.tテクスチャの解放(ref this.txArtist);
                        TextureFactory.tテクスチャの解放(ref this.txComment);
-                       //if (this.ftComment描画用フォント != null)
-                       //{
-                       //      this.ftComment描画用フォント.Dispose();
-                       //      this.ftComment描画用フォント = null;
-                       //}
-                       //if (this.ftArtist描画用フォント != null)
-                       //{
-                       //      this.ftArtist描画用フォント.Dispose();
-                       //      this.ftArtist描画用フォント = null;
-                       //}
-                       if (this.pfComment描画用フォント != null)
-                       {
-                               this.pfComment描画用フォント.Dispose();
-                               this.pfComment描画用フォント = null;
-                       }
-                       if (this.pfArtist描画用フォント != null)
+                       if (this.ft描画用フォント != null)
                        {
-                               this.pfArtist描画用フォント.Dispose();
-                               this.pfArtist描画用フォント = null;
+                               this.ft描画用フォント.Dispose();
+                               this.ft描画用フォント = null;
                        }
                        this.ctComment = null;
                        base.On非活性化();
@@ -219,7 +187,7 @@ namespace DTXMania
                                {
                                        int num3 = (int)(0xf8 * Scale.X);
                                        int num4 = (int)(0xf5 * Scale.Y);
-                                       Rectangle rectangle = new Rectangle(this.ctComment.n現在の値, 0, nComment表示幅, (int)this.ftComment描画用フォント.Size);
+                                       Rectangle rectangle = new Rectangle(this.ctComment.n現在の値, 0, nComment表示幅, (int)this.ft描画用フォント.Size);
                                        if (rectangle.X < 0)
                                        {
                                                num3 += -rectangle.X;
@@ -231,11 +199,11 @@ namespace DTXMania
                                        while (rectangle.Width > 0)
                                        {
                                                rectangle2.X = ((int)(((float)rectangle.X) / this.txComment.vc拡大縮小倍率.X)) % this.nテクスチャの最大幅;
-                                               rectangle2.Y = num5 * ((int)this.ftComment描画用フォント.Size);
+                                               rectangle2.Y = num5 * ((int)this.ft描画用フォント.Size);
                                                int num6 = ((num5 + 1) == this.nComment行数) ? this.nComment最終行の幅 : this.nテクスチャの最大幅;
                                                int num7 = num6 - rectangle2.X;
                                                rectangle2.Width = num7;
-                                               rectangle2.Height = (int)this.ftComment描画用フォント.Size;
+                                               rectangle2.Height = (int)this.ft描画用フォント.Size;
                                                this.txComment.t2D描画(CDTXMania.Instance.Device, num3, num4, rectangle2);
                                                if (++num5 == this.nComment行数)
                                                {
@@ -257,8 +225,7 @@ namespace DTXMania
                #region [ private ]
                //-----------------
                private CCounter ctComment;
-               private Font ftComment描画用フォント, ftArtist描画用フォント;
-               private CPrivateFastFont pfComment描画用フォント, pfArtist描画用フォント;
+               private Font ft描画用フォント;
                private int nComment行数;
                private int nComment最終行の幅;
                private const int nComment表示幅 = (int)(0x182 * Scale.X);
index 04ca98d..51f9012 100644 (file)
@@ -7,7 +7,6 @@ using System.Drawing;
 using System.Drawing.Imaging;
 using System.Diagnostics;
 using System.Drawing.Text;
-using System.IO;
 using SharpDX;
 using FDK;
 
@@ -330,8 +329,7 @@ namespace DTXMania
                        {
                                this.On非活性化();
                                CDTXMania.Instance.Songs管理 = cs;
-                if( CDTXMania.Instance.r現在のステージ.eステージID == CStage.Eステージ.選曲 ) // #38233 2018.4.28 kairera0467 選曲画面以外から呼び出された時に活性化とリソース生成が行われないよう変更
-                                   this.On活性化();
+                               this.On活性化();
 
                                if (this.r現在選択中の曲 != null)      // r現在選択中の曲==null とは、「最初songlist.dbが無かった or 検索したが1曲もない」
                                {
@@ -428,20 +426,12 @@ namespace DTXMania
                        FontStyle regular = FontStyle.Regular;
                        if (CDTXMania.Instance.ConfigIni.bItalicFontSongSelect) regular |= FontStyle.Italic;
                        if (CDTXMania.Instance.ConfigIni.bBoldFontSongSelect) regular |= FontStyle.Bold;
-
-                       string fontname = CDTXMania.Instance.Resources.Explanation("strCfgSelectMusicSongListFontFileName");
-                       string path = Path.Combine(@"Graphics\fonts", fontname);
-                       this.privateFont_SongList = new CPrivateFastFont(CSkin.Path(path), (float)(CDTXMania.Instance.ConfigIni.nFontSizeDotSongSelect * 2 * Scale.Y * 72f / 96f), regular);
-                                                                                                                                                                                               // 72f/96f: 従来互換のために追加。DPI依存→非依存化に付随した変更。
-                       this.ft曲リスト用フォント = this.privateFont_SongList.font;
-
-                       //this.ft曲リスト用フォント = new Font(
-                       //      CDTXMania.Instance.ConfigIni.strFontSongSelect,
-                       //      (float)(CDTXMania.Instance.ConfigIni.nFontSizeDotSongSelect * 2 * Scale.Y),   // 後でScale.Yを掛けないように直すこと(Config.ini初期値変更)
-                       //      regular,
-                       //      GraphicsUnit.Pixel
-                       //);
-
+                       this.ft曲リスト用フォント = new Font(
+                               CDTXMania.Instance.ConfigIni.strFontSongSelect,
+                               (float)(CDTXMania.Instance.ConfigIni.nFontSizeDotSongSelect * 2 * Scale.Y),   // 後でScale.Yを掛けないように直すこと(Config.ini初期値変更)
+                               regular,
+                               GraphicsUnit.Pixel
+                       );
 
 
                        // 現在選択中の曲がない(=はじめての活性化)なら、現在選択中の曲をルートの先頭ノードに設定する。
@@ -1157,7 +1147,6 @@ namespace DTXMania
                private CCounter[] ct登場アニメ用 = new CCounter[13];
                private EPart e楽器パート;
                private Font ft曲リスト用フォント;
-               private CPrivateFastFont privateFont_SongList;
                private long nスクロールタイマ;
                private int n現在のスクロールカウンタ;
                private int n現在の選択行;
index 1ffa0fc..6fa15a4 100644 (file)
@@ -70,11 +70,13 @@ namespace DTXMania
 
                public override void On活性化()
                {
-                       string fontname = CDTXMania.Instance.Resources.Explanation("strCfgSelectMusicSongCommentFontFileName");
-                       string path = Path.Combine(@"Graphics\fonts", fontname);
-                       this.pfSongPath描画用フォント = new CPrivateFastFont( CSkin.Path(path), (float)(12f * Scale.Y * 72f / 96f) );
-                       // 72f/96f: 従来互換のために追加。DPI依存→非依存化に付随した変更。
-                       this.ftSongPath描画用フォント = this.pfSongPath描画用フォント.font;
+                       //string fontname = CDTXMania.Instance.Resources.Explanation("strCfgSelectMusicSongCommentFontFileName");
+                       //string path = Path.Combine(@"Graphics\fonts", fontname);
+                       //this.pfSongPath描画用フォント = new CPrivateFastFont( CSkin.Path(path), (float)(12f * Scale.Y * 72f / 96f) );
+                       //// 72f/96f: 従来互換のために追加。DPI依存→非依存化に付随した変更。
+                       //this.ftSongPath描画用フォント = this.pfSongPath描画用フォント.font;
+
+                       this.ftSongPath描画用フォント = new Font("MS UI Gothic", (float)(12f * Scale.Y));
 
                        this.txSongPath = null;
                        this.strSongPath = "";
index b9921c4..e26e65f 100644 (file)
@@ -110,7 +110,6 @@ namespace DTXMania
                        list子Activities.Add(this.actShowCurrentPosition = new CActSelectShowCurrentPosition());
                        list子Activities.Add(this.actQuickConfig = new CActSelectQuickConfig());
                        list子Activities.Add(this.actAVI = new CAct演奏AVI());
-                       list子Activities.Add(this.actShowSongPath = new CActShowSongPath());
 
                        CommandHistory = new CCommandHistory();    // #24063 2011.1.16 yyagi
                        actPreimageパネル.actAVI = this.actAVI;
@@ -126,7 +125,6 @@ namespace DTXMania
                        this.act演奏履歴パネル.t選択曲が変更された();
                        this.actステータスパネル.t選択曲が変更された();
                        this.actArtistComment.t選択曲が変更された();
-                       this.actShowSongPath.t選択曲が変更された();
 
                        #region [ プラグインにも通知する(BOX, RANDOM, BACK なら通知しない)]
                        //---------------------
@@ -180,7 +178,7 @@ namespace DTXMania
                        {
                                this.eフェードアウト完了時の戻り値 = E戻り値.継続;
                                this.bBGM再生済み = false;
-
+                               this.ftフォント = new Font("MS PGothic", 26f * Scale.X, GraphicsUnit.Pixel);
                                for (int i = 0; i < 4; i++)
                                {
                                        this.ctキー反復用[i] = new CCounter(0, 0, 0, CDTXMania.Instance.Timer);
@@ -201,6 +199,11 @@ namespace DTXMania
                        Trace.Indent();
                        try
                        {
+                               if (this.ftフォント != null)
+                               {
+                                       this.ftフォント.Dispose();
+                                       this.ftフォント = null;
+                               }
                                for (int i = 0; i < 4; i++)
                                {
                                        this.ctキー反復用[i] = null;
@@ -328,7 +331,6 @@ namespace DTXMania
                                }
                                #endregion
                                this.actShowCurrentPosition.On進行描画();               // #27648 2011.3.28 yyagi
-                               this.actShowSongPath.On進行描画();                      // #38404 2018.7.30 yyagi
 
                                #region [ フェーズ処理 ]
                                switch (base.eフェーズID)
@@ -430,12 +432,6 @@ namespace DTXMania
                                                                                        }
                                                */
                                                #endregion
-                                               #region [ Delete: 曲データのフルパス表示ON/OFF ]
-                                               if (CDTXMania.Instance.Input管理.Keyboard.bキーが押された((int)SlimDXKey.Delete))
-                                               {
-                                                       CDTXMania.Instance.ConfigIni.bShowSongPath.Value = !CDTXMania.Instance.ConfigIni.bShowSongPath.Value;
-                                               }
-                                               #endregion
                                                if (this.act曲リスト.r現在選択中の曲 != null)
                                                {
                                                        #region [ Right ]
@@ -760,13 +756,12 @@ namespace DTXMania
                private CActSortSongs actSortSongs;
                private CActSelectQuickConfig actQuickConfig;
                private CAct演奏AVI actAVI;
-               private CActShowSongPath actShowSongPath;
 
                private bool bBGM再生済み;
                private STキー反復用カウンタ ctキー反復用;
                private CCounter ct登場時アニメ用共通;
                private E戻り値 eフェードアウト完了時の戻り値;
-
+               private Font ftフォント;
                private CTextureAf txコメントバー;
                private CTextureAf tx下部パネル;
                private CTextureAf tx上部パネル;
index e1904cd..1b421e8 100644 (file)
@@ -36,19 +36,19 @@ namespace DTXMania
 
 
                #region [ コンストラクタ ]
-               public CPrivateFastFont(FontFamily fontfamily, float pt, FontStyle style)
+               public CPrivateFastFont(FontFamily fontfamily, int pt, FontStyle style)
                {
                        Initialize(null, null, fontfamily, pt, style);
                }
-               public CPrivateFastFont(FontFamily fontfamily, float pt)
+               public CPrivateFastFont(FontFamily fontfamily, int pt)
                {
                        Initialize(null, null, fontfamily, pt, FontStyle.Regular);
                }
-               public CPrivateFastFont(string fontpath, float pt, FontStyle style)
+               public CPrivateFastFont(string fontpath, int pt, FontStyle style)
                {
                        Initialize(fontpath, null, null, pt, style);
                }
-               public CPrivateFastFont(string fontpath, float pt)
+               public CPrivateFastFont(string fontpath, int pt)
                {
                        Initialize(fontpath, null, null, pt, FontStyle.Regular);
                }
@@ -58,7 +58,7 @@ namespace DTXMania
                }
                #endregion
                #region [ コンストラクタから呼ばれる初期化処理 ]
-               protected new void Initialize(string fontpath, string baseFontPath, FontFamily fontfamily, float pt, FontStyle style)
+               protected new void Initialize(string fontpath, string baseFontPath, FontFamily fontfamily, int pt, FontStyle style)
                {
                        this.bDispose完了済み_CPrivateFastFont = false;
                        this.listFontCache = new List<FontCache>();
@@ -244,7 +244,7 @@ namespace DTXMania
                        this.Dispose(true);
                        GC.SuppressFinalize(this);
                }
-               protected new void Dispose(bool disposeManagedObjects)
+               protected void Dispose(bool disposeManagedObjects)
                {
                        if (this.bDispose完了済み_CPrivateFastFont)
                                return;
index 543c284..fa19d06 100644 (file)
@@ -18,36 +18,28 @@ namespace DTXMania
        /// <summary>
        /// プライベートフォントでの描画を扱うクラス。
        /// </summary>
-       /// <exception cref="FileNotFoundException">フォントファイルが見つからず、更にMS PGothicのフォント指定にも失敗したときに例外発生</exception>
+       /// <exception cref="FileNotFoundException">フォントファイルが見つからない時に例外発生</exception>
+       /// <exception cref="ArgumentException">スタイル指定不正時に例外発生</exception>
        /// <remarks>
        /// 簡単な使い方
        /// CPrivateFont prvFont = new CPrivateFont( CSkin.Path( @"Graphics\fonts\mplus-1p-bold.ttf" ), 36 );   // プライベートフォント
        /// とか
-       /// CPrivateFont prvFont = new CPrivateFont( "MS UI Gothic", 36, FontStyle.Bold );                                              // システムフォント
-       /// CPrivateFont prvFont = new CPrivateFont( CSkin.Path( @"Graphics\fonts\Arial" ), 36 );                               // システムフォント
-       /// (拡張子の有無でシステムフォントかプライベートフォントかを判断。拡張子なしの場合はパス名指定部分は無視される)
-       /// とか
-       /// CPrivateFont prvFont = new CPrivateFont( new FontFamily("MS UI Gothic"), 36, FontStyle.Bold );              // システムフォント指定方法その2
+       /// CPrivateFont prvFont = new CPrivateFont( new FontFamily("MS UI Gothic"), 36, FontStyle.Bold );              // システムフォント
        /// とかした上で、
        /// Bitmap bmp = prvFont.DrawPrivateFont( "ABCDE", Color.White, Color.Black );                                                  // フォント色=白、縁の色=黒の例。縁の色は省略可能
        /// とか
        /// Bitmap bmp = prvFont.DrawPrivateFont( "ABCDE", Color.White, Color.Black, Color.Yellow, Color.OrangeRed ); // 上下グラデーション(Yellow→OrangeRed)
-       /// とか
-       /// prvFont.font.DrawString(...)
        /// とかして、
        /// CTexture ctBmp = TextureFactory.tテクスチャの生成( bmp, false );
        /// ctBMP.t2D描画( ~~~ );
        /// で表示してください。
        /// 
-       /// フォントファイルが見つからない時には、代わりにMS PGothicを使用しようと試みます。(MS PGothicも使えなかったときは、FileNotFoundException発生)
-       /// スタイル指定不正時には、それなりのスタイルを設定します。
-       /// 
        /// 注意点
        /// 任意のフォントでのレンダリングは結構負荷が大きいので、なるべくなら描画フレーム毎にフォントを再レンダリングするようなことはせず、
        /// 一旦レンダリングしたものを描画に使い回すようにしてください。
        /// また、長い文字列を与えると、返されるBitmapも横長になります。この横長画像をそのままテクスチャとして使うと、
        /// 古いPCで問題を発生させやすいです。これを回避するには、一旦Bitmapとして取得したのち、256pixや512pixで分割して
-       /// テクスチャに定義するようにしてください。(CTextureAf()は、そのあたりを自動処理してくれます)
+       /// テクスチャに定義するようにしてください。
        /// </remarks>
        public class CPrivateFont : IDisposable
        {
@@ -66,24 +58,25 @@ namespace DTXMania
                /// </summary>
                private string strAlternativeFont = "MS PGothic";
 
+
                #region [ コンストラクタ ]
-               public CPrivateFont(FontFamily fontfamily, float pt, FontStyle style)
+               public CPrivateFont(FontFamily fontfamily, int pt, FontStyle style)
                {
                        Initialize(null, null, fontfamily, pt, style);
                }
-               public CPrivateFont(FontFamily fontfamily, float pt)
+               public CPrivateFont(FontFamily fontfamily, int pt)
                {
                        Initialize(null, null, fontfamily, pt, FontStyle.Regular);
                }
-               public CPrivateFont(string fontpath, FontFamily fontfamily, float pt, FontStyle style)
+               public CPrivateFont(string fontpath, FontFamily fontfamily, int pt, FontStyle style)
                {
                        Initialize(fontpath, null, fontfamily, pt, style);
                }
-               public CPrivateFont(string fontpath, float pt, FontStyle style)
+               public CPrivateFont(string fontpath, int pt, FontStyle style)
                {
                        Initialize(fontpath, null, null, pt, style);
                }
-               public CPrivateFont(string fontpath, float pt)
+               public CPrivateFont(string fontpath, int pt)
                {
                        Initialize(fontpath, null, null, pt, FontStyle.Regular);
                }
@@ -93,7 +86,7 @@ namespace DTXMania
                }
                #endregion
 
-               protected void Initialize(string fontpath, string baseFontPath, FontFamily fontfamily, float pt, FontStyle style)
+               protected void Initialize(string fontpath, string baseFontPath, FontFamily fontfamily, int pt, FontStyle style)
                {
                        this._pfc = null;
                        this._fontfamily = null;
@@ -103,16 +96,6 @@ namespace DTXMania
                        this._ptOrigin = new Point(0, 0);
                        this.bDispose完了済み = false;
                        this._baseFontname = baseFontPath;
-                       this.bIsSystemFont = false;
-
-                       float emSize = 0f;
-                       using (Bitmap b = new Bitmap(1, 1))
-                       {
-                               using (Graphics g = Graphics.FromImage(b))
-                               {
-                                       emSize = pt * 96.0f / 72.0f * g.DpiX / 96.0f;   // DPIを考慮したpxサイズ。GraphicsUnit.Pixelと併用のこと
-                               }
-                       }
 
                        if (fontfamily != null)
                        {
@@ -122,25 +105,14 @@ namespace DTXMania
                        {
                                try
                                {
-                                       //拡張子あり == 通常のPrivateFontパス指定
-                                       if (Path.GetExtension(fontpath) != string.Empty)
-                                       {
-                                               this._pfc = new System.Drawing.Text.PrivateFontCollection();    //PrivateFontCollectionオブジェクトを作成する
-                                               this._pfc.AddFontFile(fontpath);                                //PrivateFontCollectionにフォントを追加する
-                                               _fontfamily = _pfc.Families[0];
-                                               bIsSystemFont = false;
-                                       }
-                                       //拡張子なし == Arial, MS Gothicなど、システムフォントの指定
-                                       else
-                                       {
-                                               this._font = PublicFont(Path.GetFileName(fontpath), emSize, style, GraphicsUnit.Pixel); 
-                                               bIsSystemFont = true;
-                                       }
+                                       this._pfc = new System.Drawing.Text.PrivateFontCollection();    //PrivateFontCollectionオブジェクトを作成する
+                                       this._pfc.AddFontFile(fontpath);                                                                //PrivateFontCollectionにフォントを追加する
+                                       _fontfamily = _pfc.Families[0];
                                }
                                catch (Exception e) when (e is System.IO.FileNotFoundException || e is System.Runtime.InteropServices.ExternalException)
                                {
                                        Trace.TraceWarning(e.Message);
-                                       Trace.TraceWarning("プライベートフォントの追加に失敗しました({0})。代わりに{1}の使用を試みます。", fontpath, strAlternativeFont);
+                                       Trace.TraceWarning("プライベートフォントの追加に失敗しました({0})。代わりにMS PGothicの使用を試みます。", fontpath);
                                        //throw new FileNotFoundException( "プライベートフォントの追加に失敗しました。({0})", Path.GetFileName( fontpath ) );
                                        //return;
 
@@ -163,13 +135,9 @@ namespace DTXMania
                                //}
                        }
 
-                       // システムフォントの登録に成功した場合
-                       if (bIsSystemFont && _font != null)
-                       {
-                               // 追加処理なし。何もしない
-                       }
-                       // PrivateFontの登録に成功した場合は、指定されたフォントスタイルをできるだけ適用する
-                       else if (_fontfamily != null)
+                       // 指定されたフォントスタイルが適用できない場合は、フォント内で定義されているスタイルから候補を選んで使用する
+                       // 何もスタイルが使えないようなフォントなら、例外を出す。
+                       if (_fontfamily != null)
                        {
                                if (!_fontfamily.IsStyleAvailable(style))
                                {
@@ -189,46 +157,30 @@ namespace DTXMania
                                                Trace.TraceWarning("フォント{0}は適切なスタイル{1}を選択できませんでした。", Path.GetFileName(fontpath), style.ToString());
                                        }
                                }
+                               //this._font = new Font(this._fontfamily, pt, style);                   //PrivateFontCollectionの先頭のフォントのFontオブジェクトを作成する
+                               float emSize = pt * 96.0f / 72.0f;
                                this._font = new Font(this._fontfamily, emSize, style, GraphicsUnit.Pixel); //PrivateFontCollectionの先頭のフォントのFontオブジェクトを作成する
+                                                                                                                                                                                                                                                                                                                                               //HighDPI対応のため、pxサイズで指定
                        }
-                       // PrivateFontと通常フォント、どちらの登録もできていない場合は、MS PGothic改め代替フォントを代わりに設定しようと試みる
                        else
+                       // フォントファイルが見つからなかった場合 (MS PGothicを代わりに指定する)
                        {
-                               this._font = PublicFont(strAlternativeFont, emSize, style, GraphicsUnit.Pixel); 
-                               if (this._font != null )
-                               { 
-                                       Trace.TraceInformation("{0}の代わりに{1}を指定しました。", Path.GetFileName(fontpath), strAlternativeFont);
-                                       bIsSystemFont = true;
-                                       return;
-                               }
-                               throw new FileNotFoundException(string.Format("プライベートフォントの追加に失敗し、{1}での代替処理にも失敗しました。({0})", Path.GetFileName(fontpath), strAlternativeFont));
-                       }
-               }
-
-
-               /// <summary>
-               /// プライベートフォントではない、システムフォントの設定
-               /// </summary>
-               /// <param name="fontname">フォント名</param>
-               /// <param name="emSize">フォントサイズ</param>
-               /// <param name="style">フォントスタイル</param>
-               /// <param name="unit">GraphicsUnit</param>
-               /// <returns></returns>
-               private Font PublicFont(string fontname, float emSize, FontStyle style, GraphicsUnit unit)
-               {
-                       Font f = new Font(fontname, emSize, style, unit);
-                       FontFamily[] ffs = new System.Drawing.Text.InstalledFontCollection().Families;
-                       int lcid = System.Globalization.CultureInfo.GetCultureInfo("en-us").LCID;
-                       foreach (FontFamily ff in ffs)
-                       {
-                               // Trace.WriteLine( lcid ) );
-                               if (ff.GetName(lcid) == fontname)
+                               float emSize = pt * 96.0f / 72.0f;
+                               this._font = new Font("MS PGothic", emSize, style, GraphicsUnit.Pixel); //MS PGothicのFontオブジェクトを作成する
+                               FontFamily[] ffs = new System.Drawing.Text.InstalledFontCollection().Families;
+                               int lcid = System.Globalization.CultureInfo.GetCultureInfo("en-us").LCID;
+                               foreach (FontFamily ff in ffs)
                                {
-                                       this._fontfamily = ff;
-                                       return f;
+                                       // Trace.WriteLine( lcid ) );
+                                       if (ff.GetName(lcid) == "MS PGothic")
+                                       {
+                                               this._fontfamily = ff;
+                                               Trace.TraceInformation("MS PGothicを代わりに指定しました。");
+                                               return;
+                                       }
                                }
+                               throw new FileNotFoundException("プライベートフォントの追加に失敗し、MS PGothicでの代替処理にも失敗しました。({0})", Path.GetFileName(fontpath));
                        }
-                       return null;
                }
 
                [Flags]
@@ -348,7 +300,7 @@ namespace DTXMania
                #endregion
 
                /// <summary>
-               /// 文字列を描画したbitmapを返す(メイン処理)
+               /// 文字列を描画したテクスチャを返す(メイン処理)
                /// </summary>
                /// <param name="rectDrawn">描画された領域</param>
                /// <param name="ptOrigin">描画文字列</param>
@@ -358,7 +310,7 @@ namespace DTXMania
                /// <param name="edgeColor">縁取色</param>
                /// <param name="gradationTopColor">グラデーション 上側の色</param>
                /// <param name="gradationBottomColor">グラデーション 下側の色</param>
-               /// <returns>描画済Bitmap</returns>
+               /// <returns>描画済テクスチャ</returns>
                protected Bitmap DrawPrivateFont(string drawstr, DrawMode drawmode, Color fontColor, Color edgeColor, Color gradationTopColor, Color gradationBottomColor)
                {
                        if (this._fontfamily == null || drawstr == null || drawstr == "")
@@ -378,7 +330,7 @@ namespace DTXMania
                        bool bGradation = ((drawmode & DrawMode.Gradation) == DrawMode.Gradation);
 
                        // 縁取りの縁のサイズは、とりあえずフォントの大きさの1/4とする
-                       float nEdgePt = (bEdge) ? _pt / 4 : 0;
+                       int nEdgePt = (bEdge) ? _pt / 4 : 0;
 
                        // 描画サイズを測定する
                        Size stringSize = System.Windows.Forms.TextRenderer.MeasureText(drawstr, this._font, new Size(int.MaxValue, int.MaxValue),
@@ -387,7 +339,7 @@ namespace DTXMania
                        );
 
                        //取得した描画サイズを基に、描画先のbitmapを作成する
-                       Bitmap bmp = new Bitmap((int)(stringSize.Width + nEdgePt * 2), (int)(stringSize.Height + nEdgePt * 2));
+                       Bitmap bmp = new Bitmap(stringSize.Width + nEdgePt * 2, stringSize.Height + nEdgePt * 2);
                        bmp.MakeTransparent();
 
                        using (Graphics g = Graphics.FromImage(bmp))
@@ -403,7 +355,7 @@ namespace DTXMania
                                        sf.FormatFlags = StringFormatFlags.NoWrap;
 
                                        // レイアウト枠
-                                       Rectangle r = new Rectangle(0, 0, (int)(stringSize.Width + nEdgePt * 2), (int)(stringSize.Height + nEdgePt * 2));
+                                       Rectangle r = new Rectangle(0, 0, stringSize.Width + nEdgePt * 2, stringSize.Height + nEdgePt * 2);
 
                                        // 縁取り有りの描画
                                        if (bEdge)
@@ -446,7 +398,7 @@ namespace DTXMania
                        g.DrawRectangle( new Pen( Color.Green, 1 ), new Rectangle( 0, 0, bmp.Width - 1, bmp.Height - 1 ) );
 #endif
                                        _rectStrings = new Rectangle(0, 0, stringSize.Width, stringSize.Height);
-                                       _ptOrigin = new Point((int)(nEdgePt * 2), (int)(nEdgePt * 2));
+                                       _ptOrigin = new Point(nEdgePt * 2, nEdgePt * 2);
                                }
                        }
 
@@ -483,17 +435,8 @@ namespace DTXMania
                //-----------------
                public void Dispose()
                {
-                       this.Dispose(true);
-                       GC.SuppressFinalize(this);
-               }
-               protected void Dispose(bool disposeManagedObjects)
-               {
-                       if (this.bDispose完了済み)
-                               return;
-
-                       if (disposeManagedObjects)
+                       if (!this.bDispose完了済み)
                        {
-                               // (A) Managed リソースの解放
                                if (this._font != null)
                                {
                                        this._font.Dispose();
@@ -504,21 +447,14 @@ namespace DTXMania
                                        this._pfc.Dispose();
                                        this._pfc = null;
                                }
-                               if (this._fontfamily != null)
-                               {
-                                       this._fontfamily.Dispose();
-                                       this._fontfamily = null;
-                               }
-                       }
-
-                       // (B) Unamanaged リソースの解放
+                if (this._fontfamily != null)
+                {
+                    this._fontfamily.Dispose();
+                    this._fontfamily = null;
+                }
 
-                       this.bDispose完了済み = true;
-               }
-               //-----------------
-               ~CPrivateFont()
-               {
-                       this.Dispose(false);
+                this.bDispose完了済み = true;
+                       }
                }
                //-----------------
                #endregion
@@ -530,11 +466,10 @@ namespace DTXMania
 
                private System.Drawing.Text.PrivateFontCollection _pfc;
                private FontFamily _fontfamily;
-               private float _pt;
+               private int _pt;
                private Rectangle _rectStrings;
                private Point _ptOrigin;
                private string _baseFontname = null;
-               private bool bIsSystemFont;
                //-----------------
                #endregion
        }