@@ -35,7 +35,6 @@ import imgui.gl3.ImGuiImplGl3
3535import imgui.glfw.ImGuiImplGlfw
3636import net.minecraft.client.gl.GlBackend
3737import net.minecraft.client.texture.GlTexture
38- import org.lwjgl.opengl.GL11.glViewport
3938import org.lwjgl.opengl.GL30.GL_FRAMEBUFFER
4039import kotlin.math.abs
4140
@@ -45,6 +44,7 @@ object DearImGui : Loadable {
4544
4645 const val EXTERNAL_LINK = ' ↗'
4746 const val BREADCRUMB_SEPARATOR = ' »'
47+ const val BASE_FONT_SCALE = 13f
4848
4949 val io: ImGuiIO get() = ImGui .getIO()
5050 const val DEFAULT_FLAGS = ImGuiConfigFlags .NavEnableKeyboard or // Enable Keyboard Controls
@@ -57,16 +57,20 @@ object DearImGui : Loadable {
5757 private var targetScale = 0f
5858
5959 private fun updateScale (scale : Float ) {
60- io.fonts.clear()
61- val baseFontSize = 13f
6260 val glyphRanges = ImFontGlyphRangesBuilder ().apply {
6361 addRanges(io.fonts.glyphRangesDefault)
6462 addRanges(io.fonts.glyphRangesGreek)
6563 addChar(EXTERNAL_LINK )
6664 addChar(BREADCRUMB_SEPARATOR )
6765 }.buildRanges()
68- io.fonts.addFontFromFileTTF(" fonts/FiraSans-Regular.ttf" .path, baseFontSize * scale, ImFontConfig (), glyphRanges)
69- io.fonts.build()
66+ val fontConfig = ImFontConfig ()
67+ val size = BASE_FONT_SCALE * scale
68+ with (io.fonts) {
69+ clear()
70+ addFontFromFileTTF(" fonts/FiraSans-Regular.ttf" .path, size, fontConfig, glyphRanges)
71+ addFontFromFileTTF(" fonts/MinecraftDefault-Regular.ttf" .path, size, fontConfig, glyphRanges)
72+ build()
73+ }
7074 implGl3.createFontsTexture()
7175 }
7276
0 commit comments