diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/DelegateFontHandle.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/DelegateFontHandle.cs index 5442755db..f2c91d264 100644 --- a/Dalamud/Interface/ManagedFontAtlas/Internals/DelegateFontHandle.cs +++ b/Dalamud/Interface/ManagedFontAtlas/Internals/DelegateFontHandle.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Dalamud.Bindings.ImGui; @@ -158,7 +158,7 @@ internal sealed class DelegateFontHandle : FontHandle { toolkitPreBuild.Font = default; k.CallOnBuildStepChange(toolkitPreBuild); - if (toolkitPreBuild.Font.IsNull()) + if (toolkitPreBuild.Font.IsNull) { if (fontCountPrevious == fontsVector.Length) { diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.BuildToolkit.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.BuildToolkit.cs index c300eb494..2a93cf093 100644 --- a/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.BuildToolkit.cs +++ b/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.BuildToolkit.cs @@ -116,7 +116,7 @@ internal sealed partial class FontAtlasFactory foreach (var s in this.data.Substances) { var f = s.GetFontPtr(fontHandle); - if (!f.IsNull()) + if (!f.IsNull) return f; } @@ -215,7 +215,7 @@ internal sealed partial class FontAtlasFactory } catch { - if (!font.IsNull()) + if (!font.IsNull) { // Note that for both RemoveAt calls, corresponding destructors will be called. @@ -331,14 +331,14 @@ internal sealed partial class FontAtlasFactory } } - if (font.IsNull()) + if (font.IsNull) { // fall back to AXIS fonts font = this.AddGameGlyphs(new(GameFontFamily.Axis, sizePx), glyphRanges, default); } this.AttachExtraGlyphsForDalamudLanguage(new() { SizePx = sizePx, MergeFont = font }); - if (this.Font.IsNull()) + if (this.Font.IsNull) this.Font = font; return font; } @@ -413,9 +413,9 @@ internal sealed partial class FontAtlasFactory int style = (int)DWRITE_FONT_STYLE.DWRITE_FONT_STYLE_NORMAL) { var targetFont = fontConfig.MergeFont; - if (targetFont.IsNull()) + if (targetFont.IsNull) targetFont = this.Font; - if (targetFont.IsNull()) + if (targetFont.IsNull) return; // https://learn.microsoft.com/en-us/windows/apps/design/globalizing/loc-international-fonts @@ -556,9 +556,9 @@ internal sealed partial class FontAtlasFactory public void AttachExtraGlyphsForDalamudLanguage(in SafeFontConfig fontConfig) { var targetFont = fontConfig.MergeFont; - if (targetFont.IsNull()) + if (targetFont.IsNull) targetFont = this.Font; - if (targetFont.IsNull()) + if (targetFont.IsNull) return; var dalamudConfiguration = Service.Get(); diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/FontHandle.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/FontHandle.cs index 88c124b49..1fdaf4596 100644 --- a/Dalamud/Interface/ManagedFontAtlas/Internals/FontHandle.cs +++ b/Dalamud/Interface/ManagedFontAtlas/Internals/FontHandle.cs @@ -182,7 +182,7 @@ internal abstract class FontHandle : IFontHandle } var fontPtr = substance.GetFontPtr(this); - if (fontPtr.IsNull()) + if (fontPtr.IsNull) { // The font for the requested handle is unavailable. Release the reference and try again. substance.DataRoot.Release(); diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/GamePrebakedFontHandle.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/GamePrebakedFontHandle.cs index 9a91e7327..f6904db7c 100644 --- a/Dalamud/Interface/ManagedFontAtlas/Internals/GamePrebakedFontHandle.cs +++ b/Dalamud/Interface/ManagedFontAtlas/Internals/GamePrebakedFontHandle.cs @@ -1,4 +1,4 @@ -using System.Buffers; +using System.Buffers; using System.Collections; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; @@ -250,7 +250,7 @@ internal class GamePrebakedFontHandle : FontHandle GameFontStyle style, ushort[]? glyphRanges = null) { - if (font.IsNull()) + if (font.IsNull) font = this.CreateTemplateFont(toolkitPreBuild, style.SizePx); this.attachments.Add((font, style, glyphRanges)); return font; diff --git a/Dalamud/Interface/Utility/ImGuiHelpers.cs b/Dalamud/Interface/Utility/ImGuiHelpers.cs index 3285c8daf..9b21bf02d 100644 --- a/Dalamud/Interface/Utility/ImGuiHelpers.cs +++ b/Dalamud/Interface/Utility/ImGuiHelpers.cs @@ -556,25 +556,11 @@ public static partial class ImGuiHelpers .ToArray(); /// - /// Determines whether is empty. + /// Determines whether is not empty and loaded. /// /// The pointer. - /// Whether it is empty. - public static unsafe bool IsNull(this ImFontPtr ptr) => ptr.Handle == null; - - /// - /// Determines whether is empty. - /// - /// The pointer. - /// Whether it is empty. - public static unsafe bool IsNotNullAndLoaded(this ImFontPtr ptr) => ptr.Handle != null && ptr.IsLoaded(); - - /// - /// Determines whether is empty. - /// - /// The pointer. - /// Whether it is empty. - public static unsafe bool IsNull(this ImFontAtlasPtr ptr) => ptr.Handle == null; + /// Whether it is not null and loaded. + public static unsafe bool IsNotNullAndLoaded(this ImFontPtr ptr) => !ptr.IsNull && ptr.IsLoaded(); /// /// If is default, then returns . @@ -583,7 +569,7 @@ public static partial class ImGuiHelpers /// The other. /// if it is not default; otherwise, . public static unsafe ImFontPtr OrElse(this ImFontPtr self, ImFontPtr other) => - self.Handle is null ? other : self; + self.IsNull ? other : self; /// /// Mark 4K page as used, after adding a codepoint to a font.