Skip to content

Commit

Permalink
remove new font exports in ImGuiNode, pending a better implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
pkdawson committed Sep 23, 2022
1 parent 8ebb284 commit 22ec3fb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 26 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
imgui.ini
export_presets.cfg
.godot/
*.user
26 changes: 1 addition & 25 deletions addons/imgui-godot/ImGuiNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@ public partial class ImGuiNode : Node2D
[Export]
public float FontSize = 16.0f;

[Export]
public FontFile ExtraFont = null;

[Export]
public float ExtraFontSize = 16.0f;

[Export(PropertyHint.Enum, "Korean,Japanese,ChineseFull,ChineseSimplifiedCommon,Cyrillic,Thai,Vietnamese")]
public string ExtraFontGlyphRange = "Japanese";

[Export]
public bool IncludeDefaultFont = true;

Expand All @@ -30,21 +21,6 @@ public virtual void Init(ImGuiIOPtr io)
if (Font is not null)
{
ImGuiGD.AddFont(Font, FontSize);
if (ExtraFont is not null)
{
IntPtr gr = ExtraFontGlyphRange switch
{
"Korean" => io.Fonts.GetGlyphRangesKorean(),
"Japanese" => io.Fonts.GetGlyphRangesJapanese(),
"ChineseFull" => io.Fonts.GetGlyphRangesChineseFull(),
"ChineseSimplifiedCommon" => io.Fonts.GetGlyphRangesChineseSimplifiedCommon(),
"Cyrillic" => io.Fonts.GetGlyphRangesCyrillic(),
"Thai" => io.Fonts.GetGlyphRangesThai(),
"Vietnamese" => io.Fonts.GetGlyphRangesVietnamese(),
_ => throw new Exception("invalid glyph range")
};
ImGuiGD.AddFontMerge(ExtraFont, ExtraFontSize, gr);
}
}

if (IncludeDefaultFont)
Expand All @@ -66,7 +42,7 @@ public override void _Process(double delta)
if (Visible)
{
ImGuiGD.Update(delta, GetViewport());
EmitSignal("imgui_layout");
EmitSignal(nameof(imgui_layout));
ImGuiGD.Render(GetCanvasItem());
}
}
Expand Down
2 changes: 1 addition & 1 deletion addons/imgui-godot/plugin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
name="Dear ImGui for Godot"
description="Dear ImGui for Godot"
author="Patrick Dawson"
version="2.0.0"
version="2.0.1"
script="ImGuiPlugin.gd"

0 comments on commit 22ec3fb

Please sign in to comment.