Commit graph

14 commits

Author SHA1 Message Date
srkizer
ea43d65636
Fix memory ownership on AddFontFromImGuiHeapAllocatedMemory (#1651) 2024-02-14 23:52:40 +01:00
srkizer
34daa73612
Implement FontChooserDialog (#1637)
* Implement FontChooserDialog

* Minor fixes

* Fixes 2

* Add Reset default font button

* Add failsafe

* reduce uninteresting exception message

* Add remarks to use AttachExtraGlyphsForDalamudLanguage

* Support advanced font configuration options

* fixes

* Shift ui elements

* more fixes

* Add To(Localized)String for IFontSpec

* Untie GlobalFontScale from default font size

* Layout fixes

* Make UiBuilder.DefaultFontSize point to user configured value

* Update example for NewDelegateFontHandle

* Font interfaces: write notes on not intended for plugins to implement

* Update default gamma to 1.7 to match closer to prev behavior (1.4**2)

* Fix console window layout
2024-02-13 20:09:46 +00:00
Soreepeong
5161053cb3 Move IFontHandle.ImFontLocked to ILockedImFont+impl 2024-01-24 00:19:27 +09:00
Soreepeong
68dc16803c Turn ImFontLocked into a class
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.
2024-01-23 23:50:17 +09:00
Soreepeong
df89472d4c Consistent BuildTask resolution timing
`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.
2024-01-23 23:50:04 +09:00
Soreepeong
871deca6e9 Remove PostPromotion event
`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.
2024-01-23 23:49:57 +09:00
Soreepeong
fb8beb9370 Move PostPromotion modification functions to PostBuild
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.
2024-01-23 23:49:47 +09:00
Soreepeong
d70b430e0d Add IFontHandle.Lock and WaitAsync 2024-01-21 03:10:41 +09:00
Soreepeong
0c2a722f83 Fallback behavior for bad use of DstFont values 2024-01-19 08:11:33 +09:00
Soreepeong
63b16bcc7c Reapply "IFontAtlas: font atlas per plugin"
This reverts commit b5696afe94.
2024-01-19 07:26:56 +09:00
goat
b5696afe94 Revert "IFontAtlas: font atlas per plugin" 2024-01-18 12:51:58 -08:00
Soreepeong
e7c7cdaa29 Update docs and exposed API 2024-01-03 23:37:00 +09:00
Soreepeong
7eb4bf8ab4 Add some more examples to doc comments 2024-01-03 23:37:00 +09:00
Soreepeong
8bdab4d2c8 Implement DalamudFontAtlas 2024-01-03 23:36:08 +09:00