Add some more examples to doc comments

This commit is contained in:
Soreepeong 2023-11-30 22:16:12 +09:00
parent 47902f9770
commit 7eb4bf8ab4
4 changed files with 14 additions and 10 deletions

View file

@ -58,7 +58,7 @@ public interface IFontAtlas : IDisposable
public IFontHandle NewGameFontHandle(GameFontStyle style);
/// <inheritdoc cref="DelegateFontHandle.HandleManager.NewFontHandle"/>
public IFontHandle NewDelegateFontHandle(FontAtlasBuildStepDelegate @delegate);
public IFontHandle NewDelegateFontHandle(FontAtlasBuildStepDelegate buildStepDelegate);
/// <inheritdoc cref="IFontHandleManager.FreeFontHandle"/>
public void FreeFontHandle(IFontHandle handle);

View file

@ -91,11 +91,11 @@ internal class DelegateFontHandle : IFontHandle.IInternal
/// <summary>
/// Creates a new IFontHandle using your own callbacks.
/// </summary>
/// <param name="callOnBuildStepChange">Callback for <see cref="IFontAtlas.BuildStepChange"/>.</param>
/// <param name="buildStepDelegate">Callback for <see cref="IFontAtlas.BuildStepChange"/>.</param>
/// <returns>Handle to a font that may or may not be ready yet.</returns>
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();

View file

@ -360,8 +360,8 @@ internal sealed partial class FontAtlasFactory
public IFontHandle NewGameFontHandle(GameFontStyle style) => this.gameFontHandleManager.NewFontHandle(style);
/// <inheritdoc/>
public IFontHandle NewDelegateFontHandle(FontAtlasBuildStepDelegate @delegate) =>
this.delegateFontHandleManager.NewFontHandle(@delegate);
public IFontHandle NewDelegateFontHandle(FontAtlasBuildStepDelegate buildStepDelegate) =>
this.delegateFontHandleManager.NewFontHandle(buildStepDelegate);
/// <inheritdoc/>
public void FreeFontHandle(IFontHandle handle)

View file

@ -428,18 +428,22 @@ public sealed class UiBuilder : IDisposable
/// <inheritdoc cref="IFontAtlas.NewDelegateFontHandle"/>
/// <example>
/// On initialization:
/// <b>On initialization</b>:
/// <code>
/// 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 =&gt; e.OnPreBuild(tk =&gt; tk.AddDalamudDefaultFont(36)));
/// </code>
///
/// On use:
/// <br />
/// <b>On use</b>:
/// <code>
/// using (this.fontHandle.Push())
/// ImGui.TextUnformatted("Example");