As `ImFontLocked` utilizes a reference counter, changed it to a class so that at worst case we still got the destructor to decrease the reference count.
`BuildFontsImmediately` and `BuildFontsAsync` set `BuildTask` to completion at different point of build process, and changed the code to make it consistent that `BuildTask` is set to completion after `PromoteBuiltData` returns.
`PostPromotion` is removed, as `IFontHandle.ImFontChanged` now does the job. It also removes the possibility that resources may get disposed while post promotion callback is in progress.
* `IFontHandle.ImFontChanged` is now called with a locked instance of the font.
* `IFontHandle.ImFontLocked`: Added `NewRef` to increase reference count.
These changes are done to ensure that `IFontHandle.Lock` will be guaranteed to obtain a fully built font that will not be modified any further (unless `PostPromotion` is being used for modifying fonts, which should not be done by clients.)
* Moved `CopyGlyphsAcrossFonts` and `BuildLookupTable` from `PostPromotion` to `PostBuild` build toolkit.
* `IFontAtlasBuildToolkit`: Added `GetFont` to enable retrieving font corresponding to a handle being built.
* `InterfaceManager`: Use `OnPostBuild` for copying glyphs from Mono to Default.
* `FontAtlasBuildStep`:
* Removed `Invalid` to prevent an unnecessary switch-case warnings.
* Added contracts on when `IFontAtlas.BuildStepChanged` will be called.
These changes ensure that using a font under some other thread's ownership from the UI thread for rendering into ImGui purposes always work.
* `FontHandle`:
* Moved common code from `DelegateFontHandle` and `GamePrebakedFontHandle`.
* Added `LockUntilPostFrame` so that the obtained `ImFontPtr` and its accompanying resources are kept valid until everything is rendered.
* Added more code comments to `Try/Lock`.
* Moved font access thread checking logic from `InterfaceManager` to `LockUntilPostFrame`.
* `Push`ing a font will now also perform `LockUntilPostFrame`.
* `GameFontHandle`: Make the property `ImFont` a forwarder to `FontHandle.LockUntilPostFrame`.
* `InterfaceManager`:
* Added companion logic to `FontHandle.LockUntilPostFrame`.
* Accessing default/icon/mono fonts will forward to `FontHandle.LockUntilPostFrame`.
* Changed `List<T>` to `ConcurrentBag<T>` as texture disposal can be done outside the main thread, and a race condition is possible.
* fix: Make auto-update work again, the lazy way.
- Move auto-update to run on the first `Notice` message for parity with the welcome message.
- Add some logging in a few critical places to make things nicer.
* fix overzealous IDE complaints
* code-review comments
- Remove stray imports that the IDE included
- Remove fixme to move auto-updates (for now)
* Lazy retry auto-update