From 7eb4bf8ab46a7d2e4b9528b5528d2621a7595e50 Mon Sep 17 00:00:00 2001 From: Soreepeong Date: Thu, 30 Nov 2023 22:16:12 +0900 Subject: [PATCH] Add some more examples to doc comments --- Dalamud/Interface/ManagedFontAtlas/IFontAtlas.cs | 2 +- .../ManagedFontAtlas/Internals/DelegateFontHandle.cs | 6 +++--- .../Internals/FontAtlasFactory.Implementation.cs | 4 ++-- Dalamud/Interface/UiBuilder.cs | 12 ++++++++---- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Dalamud/Interface/ManagedFontAtlas/IFontAtlas.cs b/Dalamud/Interface/ManagedFontAtlas/IFontAtlas.cs index 6d971dc02..0a50d6070 100644 --- a/Dalamud/Interface/ManagedFontAtlas/IFontAtlas.cs +++ b/Dalamud/Interface/ManagedFontAtlas/IFontAtlas.cs @@ -58,7 +58,7 @@ public interface IFontAtlas : IDisposable public IFontHandle NewGameFontHandle(GameFontStyle style); /// - public IFontHandle NewDelegateFontHandle(FontAtlasBuildStepDelegate @delegate); + public IFontHandle NewDelegateFontHandle(FontAtlasBuildStepDelegate buildStepDelegate); /// public void FreeFontHandle(IFontHandle handle); diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/DelegateFontHandle.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/DelegateFontHandle.cs index 142bd73da..f9f2c0ef1 100644 --- a/Dalamud/Interface/ManagedFontAtlas/Internals/DelegateFontHandle.cs +++ b/Dalamud/Interface/ManagedFontAtlas/Internals/DelegateFontHandle.cs @@ -91,11 +91,11 @@ internal class DelegateFontHandle : IFontHandle.IInternal /// /// Creates a new IFontHandle using your own callbacks. /// - /// Callback for . + /// Callback for . /// Handle to a font that may or may not be ready yet. - public IFontHandle NewFontHandle(FontAtlasBuildStepDelegate callOnBuildStepChange) + public IFontHandle NewFontHandle(FontAtlasBuildStepDelegate buildStepDelegate) { - var key = new DelegateFontHandle(this, callOnBuildStepChange); + var key = new DelegateFontHandle(this, buildStepDelegate); lock (this.syncRoot) this.handles.Add(key); this.RebuildRecommend?.Invoke(); diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.Implementation.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.Implementation.cs index 3f0b5b22e..52d77b963 100644 --- a/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.Implementation.cs +++ b/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.Implementation.cs @@ -360,8 +360,8 @@ internal sealed partial class FontAtlasFactory public IFontHandle NewGameFontHandle(GameFontStyle style) => this.gameFontHandleManager.NewFontHandle(style); /// - public IFontHandle NewDelegateFontHandle(FontAtlasBuildStepDelegate @delegate) => - this.delegateFontHandleManager.NewFontHandle(@delegate); + public IFontHandle NewDelegateFontHandle(FontAtlasBuildStepDelegate buildStepDelegate) => + this.delegateFontHandleManager.NewFontHandle(buildStepDelegate); /// public void FreeFontHandle(IFontHandle handle) diff --git a/Dalamud/Interface/UiBuilder.cs b/Dalamud/Interface/UiBuilder.cs index f7beb22fa..5d0810009 100644 --- a/Dalamud/Interface/UiBuilder.cs +++ b/Dalamud/Interface/UiBuilder.cs @@ -428,18 +428,22 @@ public sealed class UiBuilder : IDisposable /// /// - /// On initialization: + /// On initialization: /// /// this.fontHandle = uiBuilder.NewDelegateFontHandle(e => e.OnPreBuild(tk => { /// var config = new SafeFontConfig { SizePx = 16 }; /// config.MergeFont = tk.AddFontFromFile(@"C:\Windows\Fonts\comic.ttf", config); /// tk.AddGameSymbol(config); /// tk.AddExtraGlyphsForDalamudLanguage(config); - /// // optional: tk.Font = config.MergeFont; + /// // optionally do the following if you have to add more than one font here, + /// // to specify which font added during this delegate is the final font to use. + /// tk.Font = config.MergeFont; /// })); + /// // or + /// this.fontHandle = uiBuilder.NewDelegateFontHandle(e => e.OnPreBuild(tk => tk.AddDalamudDefaultFont(36))); /// - /// - /// On use: + ///
+ /// On use: /// /// using (this.fontHandle.Push()) /// ImGui.TextUnformatted("Example");