Make italic font chooseable

This commit is contained in:
Infi
2024-07-25 15:19:08 +02:00
parent 9c86ee788f
commit 41c59f6aa0
6 changed files with 90 additions and 22 deletions
+7 -1
View File
@@ -268,11 +268,17 @@ internal static class ImGuiUtil
return r;
}
public static SingleFontChooserDialog? FontChooser(string label, SingleFontSpec font, Predicate<IFontFamilyId>? exclusion = null, string? preview = null)
public static SingleFontChooserDialog? FontChooser(string label, SingleFontSpec font, bool checkbox, ref bool checkboxValue, Predicate<IFontFamilyId>? exclusion = null, string? preview = null)
{
using var id = ImRaii.PushId(label);
ImGui.TextUnformatted(label);
if (checkbox)
{
ImGui.Checkbox("##enabled", ref checkboxValue);
ImGui.SameLine();
}
var fontFamily = font.FontId.Family.EnglishName;
var fontStyle = font.FontId.EnglishName;
fontStyle = fontStyle.Equals(fontFamily) ? "" : $" - {fontStyle}";