mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-14 20:54:16 +01:00
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
This commit is contained in:
parent
3b3823d4e6
commit
34daa73612
31 changed files with 2478 additions and 81 deletions
|
|
@ -4,6 +4,7 @@ using System.Linq;
|
|||
using System.Numerics;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Text.Unicode;
|
||||
|
||||
using Dalamud.Configuration.Internal;
|
||||
|
|
@ -543,6 +544,24 @@ public static class ImGuiHelpers
|
|||
var pageIndex = unchecked((ushort)(codepoint / 4096));
|
||||
font.NativePtr->Used4kPagesMap[pageIndex >> 3] |= unchecked((byte)(1 << (pageIndex & 7)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the text for a text input, during the callback.
|
||||
/// </summary>
|
||||
/// <param name="data">The callback data.</param>
|
||||
/// <param name="s">The new text.</param>
|
||||
internal static unsafe void SetTextFromCallback(ImGuiInputTextCallbackData* data, string s)
|
||||
{
|
||||
if (data->BufTextLen != 0)
|
||||
ImGuiNative.ImGuiInputTextCallbackData_DeleteChars(data, 0, data->BufTextLen);
|
||||
|
||||
var len = Encoding.UTF8.GetByteCount(s);
|
||||
var buf = len < 1024 ? stackalloc byte[len] : new byte[len];
|
||||
Encoding.UTF8.GetBytes(s, buf);
|
||||
fixed (byte* pBuf = buf)
|
||||
ImGuiNative.ImGuiInputTextCallbackData_InsertChars(data, 0, pBuf, pBuf + len);
|
||||
ImGuiNative.ImGuiInputTextCallbackData_SelectAll(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds the corresponding ImGui viewport ID for the given window handle.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue