IMGUI Settings

Files

The IMGUI library is using an ini file to load its previous state and other settings file to hold various things:

  • settings/default_imgui.ini - this is the official default imgui ini that comes with the game and holds imgui window/docking state
  • <userfolder>/settings/imgui.ini - this is the file created on the local user machine that keeps the current imgui state (if it doesnt exist, the file is created by copying default_imgui.ini)
  • settings/defaultImguiSettings.json - this holds version of the imgui.ini and the default fonts that need to be loaded in imgui
  • <userfolder>/settings/imguiSettings.json - like the above, but user can modify them

If the iniVersion value from defaultImguiSettings.json is higher that the <userfolder>/settings/imguiSettings.json, then the imgui.ini from the user folder will be rewritten with the default_imgui.ini.

Fonts

defaultImguiSettings.json contains the fonts to be loaded in the imgui font atlas. Each font information contains the scale of the font glyphs (which is multiplied by the standard base size) and the Unicode glyph ranges to be rasterized in the atlas. Example:

{
  "fontsVersion": 1,
  "iniVersion": 3,
  "fonts": {
    "icons": {
      "fileName": "fa-solid-900.ttf",
      "glyphRanges": [
        "F000",
        "F010"
      ],
      "sizeScale": 3
    },
    "cairo_bold": {
      "fileName": "Cairo-Bold.ttf",
      "glyphRanges": [
        "arabic"
      ],
      "sizeScale": 1.3
    },
    "segoeui_regular": {
      "fileName": "segoeui.ttf",
      "glyphRanges": [
        "default"
      ],
      "isWindowsFont": true,
      "sizeScale": 1
    }
  }
}

The key is the unique name of the font to be used in various imgui calls.

fileName - this is the filename of the font, relative to the game fonts folder (/ui/common/)

isWindowsFont - if this is true, then the fileName will be appended to the Windows Fonts path, so it loads a Windows font

sizeScale - normally 1, scale of the font glyphs to be rasterized, the final pixel size is scale * defaultFontSize (this is defined in C++ code)

glyphRanges - this is an array of strings (hex numbers pairs) of begin-end of unicode codepoints for the glyphs to be selected for rasterizing into the atlas. There are also predefined named ranges (that will expand into 2 hex codepoints for the range), which can be specified:

  • "default" - default ASCII ranges, Cyrillic and other things
  • "arabic" - same but with Arabic glyphs
  • "japanese" - Japanese glyphs
  • "chineseFull" - full Chinese glyphs
  • "chineseSimplifiedCommon" - simplified Chinese glyphs
  • "korean" - same but with Korean glyphs
  • "thai" - Thai glyphs
  • "vietnamese" - Vietnamese glyphs
  • "cyrillic" - Cyrillic glyphs

IMPORTANT NOTE

If you modify the defaultImguiSettings.json fonts list, you need to also increment the fontsVersion in the file (its a double number, so you can use 1.2, 1.3 etc), so the new font set is updated into user folder’s settings/imguiSettings.json. Also, if renaming or deleting fonts, make sure that named font (the json key of the font info object), is not used anywhere in the game, in any file, be it data or code.

Last modified: 19/7/2023 23:13
On this page:

Any further questions?

Join our discord