From 49be86d49f77d384c1d339add673774a327c3e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?DragonRatTiger=20/=20=E3=83=AA=E3=83=A5=E3=82=A6=E3=82=B3?= Date: Sun, 15 Oct 2023 00:50:22 -0400 Subject: [PATCH] Allow Skins to load their own fonts (#507) Can be loaded via. name of the font (must be installed first) or can use file directory --- .../04.Graphics/TextRenderer/CFontRenderer.cs | 5 ++++ OpenTaiko/src/Common/CSkin.cs | 18 ++++++++++++ OpenTaiko/src/Common/Modal.cs | 18 +++--------- OpenTaiko/src/Helpers/HPrivateFastFont.cs | 11 ++++++-- .../src/Stages/02.Title/CStageタイトル.cs | 11 ++------ .../src/Stages/04.Config/CActConfigList.cs | 5 +--- .../src/Stages/04.Config/CStageコンフィグ.cs | 6 ++-- .../05.DaniSelect/CActSelect段位リスト.cs | 15 +++------- .../Stages/05.SongSelect/CActPlayOption.cs | 2 +- .../Stages/05.SongSelect/CActSelectDanInfo.cs | 12 ++------ .../05.SongSelect/CActSelectPopupMenu.cs | 5 +--- .../05.SongSelect/CActSelect曲リスト.cs | 3 +- .../05.SongSelect/CActSelect難易度選択画面.cs | 12 ++------ .../Stages/06.SongLoading/CStage曲読み込み.cs | 25 +++-------------- .../Stages/07.Game/CAct演奏パネル文字列.cs | 7 ++--- .../src/Stages/07.Game/Taiko/Dan_Cert.cs | 5 +--- .../08.Result/CActResultParameterPanel.cs | 4 +-- .../src/Stages/08.Result/CActResultSongBar.cs | 9 +----- OpenTaiko/src/Stages/08.Result/CStage結果.cs | 26 ++++------------- OpenTaiko/src/Stages/11.Heya/CStageHeya.cs | 6 +--- .../12.OnlineLounge/CStageOnlineLounge.cs | 13 ++------- .../13.TowerSelect/CStageTowerSelect.cs | 11 ++------ .../CEncyclopediaControler.cs | 9 +----- OpenTaiko/src/Stages/CActNewHeya.cs | 6 +--- OpenTaiko/src/Stages/CNamePlate.cs | 28 ++++--------------- 25 files changed, 79 insertions(+), 193 deletions(-) diff --git a/FDK/src/04.Graphics/TextRenderer/CFontRenderer.cs b/FDK/src/04.Graphics/TextRenderer/CFontRenderer.cs index b9c212f6..153faa22 100644 --- a/FDK/src/04.Graphics/TextRenderer/CFontRenderer.cs +++ b/FDK/src/04.Graphics/TextRenderer/CFontRenderer.cs @@ -79,6 +79,11 @@ namespace FDK } } + public static bool FontExists(string fontpath) + { + return SKFontManager.Default.FontFamilies.Contains(fontpath) || File.Exists(fontpath); + } + #region [ コンストラクタ ] public CFontRenderer(string fontpath, int pt, FontStyle style) { diff --git a/OpenTaiko/src/Common/CSkin.cs b/OpenTaiko/src/Common/CSkin.cs index 9528d14b..e4a43271 100644 --- a/OpenTaiko/src/Common/CSkin.cs +++ b/OpenTaiko/src/Common/CSkin.cs @@ -1105,6 +1105,22 @@ namespace TJAPlayer3 Resolution[i] = int.Parse(strSplit[i]); } } + else if (strCommand == "FontName") + { + strParam = strParam.Replace('/', System.IO.Path.DirectorySeparatorChar); + strParam = strParam.Replace('\\', System.IO.Path.DirectorySeparatorChar); + if (HPrivateFastFont.FontExists(strParam)) FontName = strParam; + strParam = Path(strParam); + if (HPrivateFastFont.FontExists(strParam)) FontName = strParam; + } + else if (strCommand == "BoxFontName") + { + strParam = strParam.Replace('/', System.IO.Path.DirectorySeparatorChar); + strParam = strParam.Replace('\\', System.IO.Path.DirectorySeparatorChar); + if (HPrivateFastFont.FontExists(strParam)) BoxFontName = strParam; + strParam = Path(strParam); + if (HPrivateFastFont.FontExists(Path(strParam))) BoxFontName = strParam; + } #endregion #region [Background Scroll] @@ -8343,6 +8359,8 @@ namespace TJAPlayer3 public string Skin_Version = "Unknown"; public string Skin_Creator = "Unknown"; public int[] Resolution = new int[] { 1280, 720 }; + public string FontName = TJAPlayer3.ConfigIni.FontName; + public string BoxFontName = TJAPlayer3.ConfigIni.BoxFontName; #endregion #region Config diff --git a/OpenTaiko/src/Common/Modal.cs b/OpenTaiko/src/Common/Modal.cs index e602a06a..5bff3f63 100644 --- a/OpenTaiko/src/Common/Modal.cs +++ b/OpenTaiko/src/Common/Modal.cs @@ -164,20 +164,10 @@ namespace TJAPlayer3 && _pfModalTitleFull != null) return; - if (!string.IsNullOrEmpty(TJAPlayer3.ConfigIni.FontName)) - { - _pfModalContentHalf = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.Modal_Font_ModalContentHalf_Size); - _pfModalTitleHalf = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.Modal_Font_ModalTitleHalf_Size); - _pfModalContentFull = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.Modal_Font_ModalContentFull_Size); - _pfModalTitleFull = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.Modal_Font_ModalTitleFull_Size); - } - else - { - _pfModalContentHalf = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.Modal_Font_ModalContentHalf_Size); - _pfModalTitleHalf = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.Modal_Font_ModalTitleHalf_Size); - _pfModalContentFull = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.Modal_Font_ModalContentFull_Size); - _pfModalTitleFull = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.Modal_Font_ModalTitleFull_Size); - } + _pfModalContentHalf = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.Modal_Font_ModalContentHalf_Size); + _pfModalTitleHalf = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.Modal_Font_ModalTitleHalf_Size); + _pfModalContentFull = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.Modal_Font_ModalContentFull_Size); + _pfModalTitleFull = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.Modal_Font_ModalTitleFull_Size); } #region [Enum definitions] diff --git a/OpenTaiko/src/Helpers/HPrivateFastFont.cs b/OpenTaiko/src/Helpers/HPrivateFastFont.cs index 3a81d884..c1483caa 100644 --- a/OpenTaiko/src/Helpers/HPrivateFastFont.cs +++ b/OpenTaiko/src/Helpers/HPrivateFastFont.cs @@ -12,21 +12,26 @@ namespace TJAPlayer3 { static string DefaultFont = CFontRenderer.DefaultFontName; + public static bool FontExists(string fontpath) + { + return CFontRenderer.FontExists(fontpath); + } + public static CCachedFontRenderer tInstantiateFont(string fontName, int scale) { - if (!string.IsNullOrEmpty(fontName)) + if (FontExists(fontName)) return (new CCachedFontRenderer(fontName, scale)); return (new CCachedFontRenderer(DefaultFont, scale)); } public static CCachedFontRenderer tInstantiateMainFont(int scale) { - return tInstantiateFont(TJAPlayer3.ConfigIni.FontName, scale); + return tInstantiateFont(TJAPlayer3.Skin.FontName, scale); } public static CCachedFontRenderer tInstantiateBoxFont(int scale) { - return tInstantiateFont(TJAPlayer3.ConfigIni.BoxFontName, scale); + return tInstantiateFont(TJAPlayer3.Skin.BoxFontName, scale); } } } diff --git a/OpenTaiko/src/Stages/02.Title/CStageタイトル.cs b/OpenTaiko/src/Stages/02.Title/CStageタイトル.cs index 86487293..1044a1f2 100644 --- a/OpenTaiko/src/Stages/02.Title/CStageタイトル.cs +++ b/OpenTaiko/src/Stages/02.Title/CStageタイトル.cs @@ -113,15 +113,8 @@ namespace TJAPlayer3 public override void CreateManagedResource() { - if (!string.IsNullOrEmpty(TJAPlayer3.ConfigIni.FontName)) - this.pfMenuTitle = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.Title_ModeSelect_Title_Scale[0]); - else - this.pfMenuTitle = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.Title_ModeSelect_Title_Scale[0]); - - if (!string.IsNullOrEmpty(TJAPlayer3.ConfigIni.BoxFontName)) - this.pfBoxText = new CCachedFontRenderer(TJAPlayer3.ConfigIni.BoxFontName, TJAPlayer3.Skin.Title_ModeSelect_Title_Scale[1]); - else - this.pfBoxText = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.Title_ModeSelect_Title_Scale[1]); + this.pfMenuTitle = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.Title_ModeSelect_Title_Scale[0]); + this.pfBoxText = HPrivateFastFont.tInstantiateBoxFont(TJAPlayer3.Skin.Title_ModeSelect_Title_Scale[1]); base.CreateManagedResource(); } diff --git a/OpenTaiko/src/Stages/04.Config/CActConfigList.cs b/OpenTaiko/src/Stages/04.Config/CActConfigList.cs index 6f8489f9..609649b9 100644 --- a/OpenTaiko/src/Stages/04.Config/CActConfigList.cs +++ b/OpenTaiko/src/Stages/04.Config/CActConfigList.cs @@ -1002,10 +1002,7 @@ namespace TJAPlayer3 } public override void CreateManagedResource() { - if ( !string.IsNullOrEmpty(TJAPlayer3.ConfigIni.FontName)) - this.prvFont = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.Config_Font_Scale); // t項目リストの設定 の前に必要 - else - this.prvFont = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.Config_Font_Scale); + this.prvFont = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.Config_Font_Scale); // t項目リストの設定 の前に必要 //this.tx通常項目行パネル = CDTXMania.tテクスチャの生成( CSkin.Path( @"Graphics\4_itembox.png" ), false ); //this.txその他項目行パネル = CDTXMania.tテクスチャの生成( CSkin.Path( @"Graphics\4_itembox other.png" ), false ); diff --git a/OpenTaiko/src/Stages/04.Config/CStageコンフィグ.cs b/OpenTaiko/src/Stages/04.Config/CStageコンフィグ.cs index 706ab765..ce520bb0 100644 --- a/OpenTaiko/src/Stages/04.Config/CStageコンフィグ.cs +++ b/OpenTaiko/src/Stages/04.Config/CStageコンフィグ.cs @@ -146,7 +146,7 @@ namespace TJAPlayer3 txMenuItemLeft = new CTexture[strMenuItem.Length, 2]; - using (var prvFont = new CCachedFontRenderer(string.IsNullOrEmpty(TJAPlayer3.ConfigIni.FontName) ? CFontRenderer.DefaultFontName : TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.Config_Font_Scale)) + using (var prvFont = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.Config_Font_Scale)) { for (int i = 0; i < strMenuItem.Length; i++) { @@ -172,9 +172,9 @@ namespace TJAPlayer3 public override void CreateManagedResource() // OPTIONと画像以外共通 { - if (!string.IsNullOrEmpty(TJAPlayer3.ConfigIni.FontName)) + if (HPrivateFastFont.FontExists(TJAPlayer3.Skin.FontName)) { - this.ftフォント = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, (int)TJAPlayer3.Skin.Config_Font_Scale_Description, CFontRenderer.FontStyle.Bold); + this.ftフォント = new CCachedFontRenderer(TJAPlayer3.Skin.FontName, (int)TJAPlayer3.Skin.Config_Font_Scale_Description, CFontRenderer.FontStyle.Bold); } else { diff --git a/OpenTaiko/src/Stages/05.DaniSelect/CActSelect段位リスト.cs b/OpenTaiko/src/Stages/05.DaniSelect/CActSelect段位リスト.cs index a5beae4d..545733c6 100644 --- a/OpenTaiko/src/Stages/05.DaniSelect/CActSelect段位リスト.cs +++ b/OpenTaiko/src/Stages/05.DaniSelect/CActSelect段位リスト.cs @@ -73,15 +73,8 @@ namespace TJAPlayer3 public override void CreateManagedResource() { - if (!string.IsNullOrEmpty(TJAPlayer3.ConfigIni.FontName)) - pfDanSong = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.DaniSelect_Font_DanSong_Size); - else - pfDanSong = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.DaniSelect_Font_DanSong_Size); - - if (!string.IsNullOrEmpty(TJAPlayer3.ConfigIni.FontName)) - this.pfExamFont = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.DaniSelect_Font_Exam_Size); - else - this.pfExamFont = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.DaniSelect_Font_Exam_Size); + this.pfDanSong = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.DaniSelect_Font_DanSong_Size); + this.pfExamFont = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.DaniSelect_Font_Exam_Size); base.CreateManagedResource(); } @@ -337,7 +330,7 @@ namespace TJAPlayer3 )); if (pfDanPlateTitle == null) - pfDanPlateTitle = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.DaniSelect_DanPlateTitle_Size); + pfDanPlateTitle = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.DaniSelect_DanPlateTitle_Size); string titleTmp = ""; @@ -358,7 +351,7 @@ namespace TJAPlayer3 public static void tDisplayDanIcon(int count, float x, float y, int opacity, float scale, bool showFade = false) { if (pfDanIconTitle == null) - pfDanIconTitle = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.DaniSelect_DanIconTitle_Size); + pfDanIconTitle = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.DaniSelect_DanIconTitle_Size); string ex = "th"; switch (count) diff --git a/OpenTaiko/src/Stages/05.SongSelect/CActPlayOption.cs b/OpenTaiko/src/Stages/05.SongSelect/CActPlayOption.cs index f6374a6a..53d3ea33 100644 --- a/OpenTaiko/src/Stages/05.SongSelect/CActPlayOption.cs +++ b/OpenTaiko/src/Stages/05.SongSelect/CActPlayOption.cs @@ -140,7 +140,7 @@ namespace TJAPlayer3 } public override void CreateManagedResource() { - OptionFont = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.SongSelect_Option_Font_Scale); + OptionFont = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.SongSelect_Option_Font_Scale); base.CreateManagedResource(); } diff --git a/OpenTaiko/src/Stages/05.SongSelect/CActSelectDanInfo.cs b/OpenTaiko/src/Stages/05.SongSelect/CActSelectDanInfo.cs index 39bc5c4f..1c9f1e30 100644 --- a/OpenTaiko/src/Stages/05.SongSelect/CActSelectDanInfo.cs +++ b/OpenTaiko/src/Stages/05.SongSelect/CActSelectDanInfo.cs @@ -45,16 +45,8 @@ namespace TJAPlayer3 public override void CreateManagedResource() { // Ressource allocation - - if (!string.IsNullOrEmpty(TJAPlayer3.ConfigIni.FontName)) - pfTitleFont = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.SongSelect_DanInfo_Title_Size); - else - pfTitleFont = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.SongSelect_DanInfo_Title_Size); - - if (!string.IsNullOrEmpty(TJAPlayer3.ConfigIni.FontName)) - pfExamFont = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.SongSelect_DanInfo_Exam_Size); - else - pfExamFont = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.SongSelect_DanInfo_Exam_Size); + pfTitleFont = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.SongSelect_DanInfo_Title_Size); + pfExamFont = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.SongSelect_DanInfo_Exam_Size); base.CreateManagedResource(); } diff --git a/OpenTaiko/src/Stages/05.SongSelect/CActSelectPopupMenu.cs b/OpenTaiko/src/Stages/05.SongSelect/CActSelectPopupMenu.cs index b5eab757..b32c7d37 100644 --- a/OpenTaiko/src/Stages/05.SongSelect/CActSelectPopupMenu.cs +++ b/OpenTaiko/src/Stages/05.SongSelect/CActSelectPopupMenu.cs @@ -96,10 +96,7 @@ namespace TJAPlayer3 { if (prvFont == null) { - if (!string.IsNullOrEmpty(TJAPlayer3.ConfigIni.FontName)) - prvFont = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.PopupMenu_Font_Size); - else - prvFont = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.PopupMenu_Font_Size); + prvFont = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.PopupMenu_Font_Size); } } diff --git a/OpenTaiko/src/Stages/05.SongSelect/CActSelect曲リスト.cs b/OpenTaiko/src/Stages/05.SongSelect/CActSelect曲リスト.cs index 96bc5077..d43cba34 100644 --- a/OpenTaiko/src/Stages/05.SongSelect/CActSelect曲リスト.cs +++ b/OpenTaiko/src/Stages/05.SongSelect/CActSelect曲リスト.cs @@ -1008,8 +1008,7 @@ namespace TJAPlayer3 } public override void CreateManagedResource() { - CFontRenderer.FontStyle regular = CFontRenderer.FontStyle.Regular; - this.ft曲リスト用フォント = new CCachedFontRenderer( TJAPlayer3.ConfigIni.FontName, 40, regular ); + this.ft曲リスト用フォント = HPrivateFastFont.tInstantiateMainFont(40); int c = ( CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "ja" ) ? 0 : 1; diff --git a/OpenTaiko/src/Stages/05.SongSelect/CActSelect難易度選択画面.cs b/OpenTaiko/src/Stages/05.SongSelect/CActSelect難易度選択画面.cs index c92c5bf8..4b003ff2 100644 --- a/OpenTaiko/src/Stages/05.SongSelect/CActSelect難易度選択画面.cs +++ b/OpenTaiko/src/Stages/05.SongSelect/CActSelect難易度選択画面.cs @@ -151,16 +151,8 @@ namespace TJAPlayer3 } public override void CreateManagedResource() { - if (!string.IsNullOrEmpty(TJAPlayer3.ConfigIni.FontName)) - { - this.pfTitle = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.SongSelect_MusicName_Scale); - this.pfSubTitle = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.SongSelect_Subtitle_Scale); - } - else - { - this.pfTitle = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.SongSelect_MusicName_Scale); - this.pfSubTitle = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.SongSelect_Subtitle_Scale); - } + this.pfTitle = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.SongSelect_MusicName_Scale); + this.pfSubTitle = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.SongSelect_Subtitle_Scale); // this.soundSelectAnnounce = TJAPlayer3.Sound管理.tサウンドを生成する( CSkin.Path( @"Sounds{Path.DirectorySeparatorChar}DiffSelect.ogg" ), ESoundGroup.SoundEffect ); diff --git a/OpenTaiko/src/Stages/06.SongLoading/CStage曲読み込み.cs b/OpenTaiko/src/Stages/06.SongLoading/CStage曲読み込み.cs index 5aa4a836..7fcf8afc 100644 --- a/OpenTaiko/src/Stages/06.SongLoading/CStage曲読み込み.cs +++ b/OpenTaiko/src/Stages/06.SongLoading/CStage曲読み込み.cs @@ -181,27 +181,10 @@ namespace TJAPlayer3 } public override void CreateManagedResource() { - if( !string.IsNullOrEmpty( TJAPlayer3.ConfigIni.FontName ) ) - { - this.pfTITLE = new CCachedFontRenderer( TJAPlayer3.ConfigIni.FontName , TJAPlayer3.Skin.SongLoading_Title_FontSize ); - this.pfSUBTITLE = new CCachedFontRenderer( TJAPlayer3.ConfigIni.FontName , TJAPlayer3.Skin.SongLoading_SubTitle_FontSize); - } - else - { - this.pfTITLE = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.SongLoading_Title_FontSize); - this.pfSUBTITLE = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.SongLoading_SubTitle_FontSize); - } - - if (!string.IsNullOrEmpty(TJAPlayer3.ConfigIni.FontName)) - { - pfDanTitle = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.Game_DanC_Title_Size); - pfDanSubTitle = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.Game_DanC_SubTitle_Size); - } - else - { - pfDanTitle = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.Game_DanC_Title_Size); - pfDanSubTitle = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.Game_DanC_SubTitle_Size); - } + this.pfTITLE = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.SongLoading_Title_FontSize ); + this.pfSUBTITLE = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.SongLoading_SubTitle_FontSize); + pfDanTitle = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.Game_DanC_Title_Size); + pfDanSubTitle = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.Game_DanC_SubTitle_Size); this.tx背景 = TJAPlayer3.tテクスチャの生成( this.strSTAGEFILE, false ); //this.txSongnamePlate = CDTXMania.tテクスチャの生成( CSkin.Path( @$"Graphics{Path.DirectorySeparatorChar}6_SongnamePlate.png" ) ); diff --git a/OpenTaiko/src/Stages/07.Game/CAct演奏パネル文字列.cs b/OpenTaiko/src/Stages/07.Game/CAct演奏パネル文字列.cs index ec48bb8e..be65410b 100644 --- a/OpenTaiko/src/Stages/07.Game/CAct演奏パネル文字列.cs +++ b/OpenTaiko/src/Stages/07.Game/CAct演奏パネル文字列.cs @@ -146,11 +146,8 @@ namespace TJAPlayer3 { this.txGENRE.color4 = CConversion.ColorToColor4(stageColor); } - - if (!string.IsNullOrEmpty(TJAPlayer3.ConfigIni.FontName)) - pfGENRE = new CCachedFontRenderer(TJAPlayer3.ConfigIni.BoxFontName, TJAPlayer3.Skin.Game_GenreText_FontSize); - else - pfGENRE = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.Game_GenreText_FontSize); + + pfGENRE = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.Game_GenreText_FontSize); this.ttkGENRE = new TitleTextureKey(genreName, this.pfGENRE, Color.White, Color.Black, 1000); diff --git a/OpenTaiko/src/Stages/07.Game/Taiko/Dan_Cert.cs b/OpenTaiko/src/Stages/07.Game/Taiko/Dan_Cert.cs index 88e0fc8c..1b8572b7 100644 --- a/OpenTaiko/src/Stages/07.Game/Taiko/Dan_Cert.cs +++ b/OpenTaiko/src/Stages/07.Game/Taiko/Dan_Cert.cs @@ -124,10 +124,7 @@ namespace TJAPlayer3 this.ct虹アニメ = new CCounter(0, TJAPlayer3.Skin.Game_Gauge_Dan_Rainbow_Ptn - 1, 30, TJAPlayer3.Timer); this.ct虹透明度 = new CCounter(0, TJAPlayer3.Skin.Game_Gauge_Rainbow_Timer - 1, 1, TJAPlayer3.Timer); - if (!string.IsNullOrEmpty(TJAPlayer3.ConfigIni.FontName)) - this.pfExamFont = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.Game_DanC_ExamFont_Size); - else - this.pfExamFont = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.Game_DanC_ExamFont_Size); + this.pfExamFont = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.Game_DanC_ExamFont_Size); this.ttkExams = new TitleTextureKey[(int)Exam.Type.Total]; for (int i = 0; i < this.ttkExams.Length; i++) diff --git a/OpenTaiko/src/Stages/08.Result/CActResultParameterPanel.cs b/OpenTaiko/src/Stages/08.Result/CActResultParameterPanel.cs index e31cd2cf..b6cd761f 100644 --- a/OpenTaiko/src/Stages/08.Result/CActResultParameterPanel.cs +++ b/OpenTaiko/src/Stages/08.Result/CActResultParameterPanel.cs @@ -284,8 +284,8 @@ namespace TJAPlayer3 } public override void CreateManagedResource() { - pfSpeechText = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.Result_Speech_Text_Size); - pfAISectionText = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.Result_AIBattle_SectionText_Scale); + pfSpeechText = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.Result_Speech_Text_Size); + pfAISectionText = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.Result_AIBattle_SectionText_Scale); base.CreateManagedResource(); } diff --git a/OpenTaiko/src/Stages/08.Result/CActResultSongBar.cs b/OpenTaiko/src/Stages/08.Result/CActResultSongBar.cs index 1d7d5699..e3d060d6 100644 --- a/OpenTaiko/src/Stages/08.Result/CActResultSongBar.cs +++ b/OpenTaiko/src/Stages/08.Result/CActResultSongBar.cs @@ -60,14 +60,7 @@ namespace TJAPlayer3 } public override void CreateManagedResource() { - if( !string.IsNullOrEmpty( TJAPlayer3.ConfigIni.FontName) ) - { - this.pfMusicName = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.Result_MusicName_FontSize); - } - else - { - this.pfMusicName = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.Result_MusicName_FontSize); - } + this.pfMusicName = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.Result_MusicName_FontSize); base.CreateManagedResource(); } public override void ReleaseManagedResource() diff --git a/OpenTaiko/src/Stages/08.Result/CStage結果.cs b/OpenTaiko/src/Stages/08.Result/CStage結果.cs index 656b6f5f..f6a93a7d 100644 --- a/OpenTaiko/src/Stages/08.Result/CStage結果.cs +++ b/OpenTaiko/src/Stages/08.Result/CStage結果.cs @@ -869,27 +869,11 @@ namespace TJAPlayer3 } public override void CreateManagedResource() { - if (!string.IsNullOrEmpty(TJAPlayer3.ConfigIni.FontName)) - { - this.pfTowerText = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.TowerResult_Font_TowerText); - this.pfTowerText48 = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.TowerResult_Font_TowerText48); - this.pfTowerText72 = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.TowerResult_Font_TowerText72); - } - else - { - this.pfTowerText = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.TowerResult_Font_TowerText); - this.pfTowerText48 = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.TowerResult_Font_TowerText48); - this.pfTowerText72 = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.TowerResult_Font_TowerText72); - } - - if (!string.IsNullOrEmpty(TJAPlayer3.ConfigIni.FontName)) - { - this.pfDanTitles = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.DanResult_Font_DanTitles_Size); - } - else - { - this.pfDanTitles = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.DanResult_Font_DanTitles_Size); - } + this.pfTowerText = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.TowerResult_Font_TowerText); + this.pfTowerText48 = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.TowerResult_Font_TowerText48); + this.pfTowerText72 = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.TowerResult_Font_TowerText72); + + this.pfDanTitles = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.DanResult_Font_DanTitles_Size); base.CreateManagedResource(); } diff --git a/OpenTaiko/src/Stages/11.Heya/CStageHeya.cs b/OpenTaiko/src/Stages/11.Heya/CStageHeya.cs index d3607110..cf84d2c3 100644 --- a/OpenTaiko/src/Stages/11.Heya/CStageHeya.cs +++ b/OpenTaiko/src/Stages/11.Heya/CStageHeya.cs @@ -41,11 +41,7 @@ namespace TJAPlayer3 bInSongPlayed = false; - - if (!string.IsNullOrEmpty(TJAPlayer3.ConfigIni.FontName)) - this.pfHeyaFont = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.Heya_Font_Scale); - else - this.pfHeyaFont = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.Heya_Font_Scale); + this.pfHeyaFont = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.Heya_Font_Scale); ScrollCounter = new CCounter(0, 1000, 0.15f, TJAPlayer3.Timer); diff --git a/OpenTaiko/src/Stages/12.OnlineLounge/CStageOnlineLounge.cs b/OpenTaiko/src/Stages/12.OnlineLounge/CStageOnlineLounge.cs index 56e41f7d..20fc69cc 100644 --- a/OpenTaiko/src/Stages/12.OnlineLounge/CStageOnlineLounge.cs +++ b/OpenTaiko/src/Stages/12.OnlineLounge/CStageOnlineLounge.cs @@ -119,17 +119,8 @@ namespace TJAPlayer3 { // Ressource allocation - - if (!string.IsNullOrEmpty(TJAPlayer3.ConfigIni.FontName)) - { - this.pfOLFont = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.OnlineLounge_Font_OLFont); - this.pfOLFontLarge = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.OnlineLounge_Font_OLFontLarge); - } - else - { - this.pfOLFont = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.OnlineLounge_Font_OLFont); - this.pfOLFontLarge = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.OnlineLounge_Font_OLFontLarge); - } + this.pfOLFont = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.OnlineLounge_Font_OLFont); + this.pfOLFontLarge = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.OnlineLounge_Font_OLFontLarge); base.CreateManagedResource(); } diff --git a/OpenTaiko/src/Stages/13.TowerSelect/CStageTowerSelect.cs b/OpenTaiko/src/Stages/13.TowerSelect/CStageTowerSelect.cs index ac33298a..e1f745b9 100644 --- a/OpenTaiko/src/Stages/13.TowerSelect/CStageTowerSelect.cs +++ b/OpenTaiko/src/Stages/13.TowerSelect/CStageTowerSelect.cs @@ -59,15 +59,8 @@ namespace TJAPlayer3 { // Ressource allocation - if (!string.IsNullOrEmpty(TJAPlayer3.ConfigIni.FontName)) - pfTitleFont = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.TowerSelect_Title_Size); - else - pfTitleFont = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.TowerSelect_Title_Size); - - if (!string.IsNullOrEmpty(TJAPlayer3.ConfigIni.FontName)) - pfSubTitleFont = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.TowerSelect_SubTitle_Size); - else - pfSubTitleFont = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.TowerSelect_SubTitle_Size); + pfTitleFont = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.TowerSelect_Title_Size); + pfSubTitleFont = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.TowerSelect_SubTitle_Size); base.CreateManagedResource(); } diff --git a/OpenTaiko/src/Stages/15.OpenEncyclopedia/CEncyclopediaControler.cs b/OpenTaiko/src/Stages/15.OpenEncyclopedia/CEncyclopediaControler.cs index 8ab58f9d..5c1d6ee7 100644 --- a/OpenTaiko/src/Stages/15.OpenEncyclopedia/CEncyclopediaControler.cs +++ b/OpenTaiko/src/Stages/15.OpenEncyclopedia/CEncyclopediaControler.cs @@ -32,14 +32,7 @@ namespace TJAPlayer3 private void tReloadFonts() { _pfEncyclopediaMenu?.Dispose(); - if (!string.IsNullOrEmpty(TJAPlayer3.ConfigIni.FontName)) - { - _pfEncyclopediaMenu = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.OpenEncyclopedia_Font_EncyclopediaMenu_Size); - } - else - { - _pfEncyclopediaMenu = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.OpenEncyclopedia_Font_EncyclopediaMenu_Size); - } + _pfEncyclopediaMenu = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.OpenEncyclopedia_Font_EncyclopediaMenu_Size); } #endregion diff --git a/OpenTaiko/src/Stages/CActNewHeya.cs b/OpenTaiko/src/Stages/CActNewHeya.cs index ab181f61..403f40a1 100644 --- a/OpenTaiko/src/Stages/CActNewHeya.cs +++ b/OpenTaiko/src/Stages/CActNewHeya.cs @@ -218,11 +218,7 @@ namespace TJAPlayer3 public override void CreateManagedResource() { - if (!string.IsNullOrEmpty(TJAPlayer3.ConfigIni.FontName)) - this.MenuFont = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.Heya_Font_Scale); - else - this.MenuFont = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.Heya_Font_Scale); - + this.MenuFont = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.Heya_Font_Scale); base.CreateManagedResource(); } diff --git a/OpenTaiko/src/Stages/CNamePlate.cs b/OpenTaiko/src/Stages/CNamePlate.cs index 86cbb37e..4a37e5bf 100644 --- a/OpenTaiko/src/Stages/CNamePlate.cs +++ b/OpenTaiko/src/Stages/CNamePlate.cs @@ -17,35 +17,17 @@ namespace TJAPlayer3 { this.pfName[player]?.Dispose(); - if (!string.IsNullOrEmpty(TJAPlayer3.ConfigIni.FontName)) - { - if (TJAPlayer3.SaveFileInstances[player].data.Title == "" || TJAPlayer3.SaveFileInstances[player].data.Title == null) - this.pfName[player] = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.NamePlate_Font_Name_Size_Normal); - else - this.pfName[player] = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.NamePlate_Font_Name_Size_WithTitle); - } + if (TJAPlayer3.SaveFileInstances[player].data.Title == "" || TJAPlayer3.SaveFileInstances[player].data.Title == null) + this.pfName[player] = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.NamePlate_Font_Name_Size_Normal); else - { - if (TJAPlayer3.SaveFileInstances[player].data.Title == "" || TJAPlayer3.SaveFileInstances[player].data.Title == null) - this.pfName[player] = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.NamePlate_Font_Name_Size_Normal); - else - this.pfName[player] = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.NamePlate_Font_Name_Size_WithTitle); - } + this.pfName[player] = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.NamePlate_Font_Name_Size_WithTitle); } this.pfTitle?.Dispose(); this.pfdan?.Dispose(); - if (!string.IsNullOrEmpty(TJAPlayer3.ConfigIni.FontName)) - { - this.pfTitle = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.NamePlate_Font_Title_Size); - this.pfdan = new CCachedFontRenderer(TJAPlayer3.ConfigIni.FontName, TJAPlayer3.Skin.NamePlate_Font_Dan_Size); - } - else - { - this.pfTitle = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.NamePlate_Font_Title_Size); - this.pfdan = new CCachedFontRenderer(CFontRenderer.DefaultFontName, TJAPlayer3.Skin.NamePlate_Font_Dan_Size); - } + this.pfTitle = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.NamePlate_Font_Title_Size); + this.pfdan = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.NamePlate_Font_Dan_Size); } public CNamePlate()