Scale icons with font size
This commit is contained in:
@@ -17,6 +17,8 @@ public class FontManager
|
|||||||
internal IFontHandle RegularFont { get; private set; }
|
internal IFontHandle RegularFont { get; private set; }
|
||||||
internal IFontHandle? ItalicFont { get; private set; }
|
internal IFontHandle? ItalicFont { get; private set; }
|
||||||
|
|
||||||
|
internal IFontHandle FontAwesome { get; private set; }
|
||||||
|
|
||||||
private FaceData _regularFont;
|
private FaceData _regularFont;
|
||||||
private FaceData? _italicFont;
|
private FaceData? _italicFont;
|
||||||
private FaceData _jpFont;
|
private FaceData _jpFont;
|
||||||
@@ -159,6 +161,10 @@ public class FontManager
|
|||||||
SkewStrength = Plugin.Config.FontSize / 6
|
SkewStrength = Plugin.Config.FontSize / 6
|
||||||
});
|
});
|
||||||
|
|
||||||
|
FontAwesome = Plugin.Interface.UiBuilder.FontAtlas.NewDelegateFontHandle(e =>
|
||||||
|
e.OnPreBuild(tk => tk.AddFontAwesomeIconFont(new SafeFontConfig { SizePx = Plugin.Config.FontSize })
|
||||||
|
));
|
||||||
|
|
||||||
RegularFont = Plugin.Interface.UiBuilder.FontAtlas.NewDelegateFontHandle(
|
RegularFont = Plugin.Interface.UiBuilder.FontAtlas.NewDelegateFontHandle(
|
||||||
e => e.OnPreBuild(
|
e => e.OnPreBuild(
|
||||||
tk =>
|
tk =>
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ internal class MessageManager : IDisposable
|
|||||||
Store.UpsertMessage(entry.Item2);
|
Store.UpsertMessage(entry.Item2);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void AddMessage(Message message, Tab? currentTab)
|
private void AddMessage(Message message, Tab? currentTab)
|
||||||
{
|
{
|
||||||
if (Plugin.Config.DatabaseBattleMessages || !message.Code.IsBattle())
|
if (Plugin.Config.DatabaseBattleMessages || !message.Code.IsBattle())
|
||||||
Store.UpsertMessage(message);
|
Store.UpsertMessage(message);
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ public sealed class Plugin : IDalamudPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
LanguageChanged(Interface.UiLanguage);
|
LanguageChanged(Interface.UiLanguage);
|
||||||
|
ImGuiUtil.Initialize(this);
|
||||||
|
|
||||||
Commands = new Commands(this);
|
Commands = new Commands(this);
|
||||||
Common = new XivCommonBase(Interface);
|
Common = new XivCommonBase(Interface);
|
||||||
|
|||||||
@@ -12,6 +12,13 @@ namespace ChatTwo.Util;
|
|||||||
|
|
||||||
internal static class ImGuiUtil
|
internal static class ImGuiUtil
|
||||||
{
|
{
|
||||||
|
private static Plugin Plugin;
|
||||||
|
|
||||||
|
public static void Initialize(Plugin plugin)
|
||||||
|
{
|
||||||
|
Plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
private static readonly ImGuiMouseButton[] Buttons =
|
private static readonly ImGuiMouseButton[] Buttons =
|
||||||
[
|
[
|
||||||
ImGuiMouseButton.Left,
|
ImGuiMouseButton.Left,
|
||||||
@@ -166,22 +173,16 @@ internal static class ImGuiUtil
|
|||||||
|
|
||||||
internal static bool IconButton(FontAwesomeIcon icon, string? id = null, string? tooltip = null)
|
internal static bool IconButton(FontAwesomeIcon icon, string? id = null, string? tooltip = null)
|
||||||
{
|
{
|
||||||
ImGui.PushFont(UiBuilder.IconFont);
|
|
||||||
|
|
||||||
var label = icon.ToIconString();
|
var label = icon.ToIconString();
|
||||||
if (id != null)
|
if (id != null)
|
||||||
label += $"##{id}";
|
label += $"##{id}";
|
||||||
|
|
||||||
|
Plugin.FontManager.FontAwesome.Push();
|
||||||
var ret = ImGui.Button(label);
|
var ret = ImGui.Button(label);
|
||||||
|
Plugin.FontManager.FontAwesome.Pop();
|
||||||
ImGui.PopFont();
|
|
||||||
|
|
||||||
if (tooltip != null && ImGui.IsItemHovered())
|
if (tooltip != null && ImGui.IsItemHovered())
|
||||||
{
|
ImGui.SetTooltip(tooltip);
|
||||||
ImGui.BeginTooltip();
|
|
||||||
ImGui.TextUnformatted(tooltip);
|
|
||||||
ImGui.EndTooltip();
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user