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); public IFontHandle NewGameFontHandle(GameFontStyle style);
/// <inheritdoc cref="DelegateFontHandle.HandleManager.NewFontHandle"/> /// <inheritdoc cref="DelegateFontHandle.HandleManager.NewFontHandle"/>
public IFontHandle NewDelegateFontHandle(FontAtlasBuildStepDelegate @delegate); public IFontHandle NewDelegateFontHandle(FontAtlasBuildStepDelegate buildStepDelegate);
/// <inheritdoc cref="IFontHandleManager.FreeFontHandle"/> /// <inheritdoc cref="IFontHandleManager.FreeFontHandle"/>
public void FreeFontHandle(IFontHandle handle); public void FreeFontHandle(IFontHandle handle);

View file

@ -91,11 +91,11 @@ internal class DelegateFontHandle : IFontHandle.IInternal
/// <summary> /// <summary>
/// Creates a new IFontHandle using your own callbacks. /// Creates a new IFontHandle using your own callbacks.
/// </summary> /// </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> /// <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) lock (this.syncRoot)
this.handles.Add(key); this.handles.Add(key);
this.RebuildRecommend?.Invoke(); this.RebuildRecommend?.Invoke();

View file

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

View file

@ -428,18 +428,22 @@ public sealed class UiBuilder : IDisposable
/// <inheritdoc cref="IFontAtlas.NewDelegateFontHandle"/> /// <inheritdoc cref="IFontAtlas.NewDelegateFontHandle"/>
/// <example> /// <example>
/// On initialization: /// <b>On initialization</b>:
/// <code> /// <code>
/// this.fontHandle = uiBuilder.NewDelegateFontHandle(e => e.OnPreBuild(tk => { /// this.fontHandle = uiBuilder.NewDelegateFontHandle(e => e.OnPreBuild(tk => {
/// var config = new SafeFontConfig { SizePx = 16 }; /// var config = new SafeFontConfig { SizePx = 16 };
/// config.MergeFont = tk.AddFontFromFile(@"C:\Windows\Fonts\comic.ttf", config); /// config.MergeFont = tk.AddFontFromFile(@"C:\Windows\Fonts\comic.ttf", config);
/// tk.AddGameSymbol(config); /// tk.AddGameSymbol(config);
/// tk.AddExtraGlyphsForDalamudLanguage(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> /// </code>
/// /// <br />
/// On use: /// <b>On use</b>:
/// <code> /// <code>
/// using (this.fontHandle.Push()) /// using (this.fontHandle.Push())
/// ImGui.TextUnformatted("Example"); /// ImGui.TextUnformatted("Example");