Change font in source code

  • sdgsdgsdg
  • Topic Author
More
2 months 2 weeks ago #1 by sdgsdgsdg Change font in source code was created by sdgsdgsdg
Hello, I'm making my add-on for reshade, I'm trying to redesign the program menu, but no matter how I try to add and use a custom font I can't do it, and I don't have a box to change the font that is in the default reshade, can you tell me how to change the default font that reshade uses when compiling, or how to use my custom font correctly
Here's how I'm trying to add my font right now:

     auto config = ImFontConfig();
    config.FontDataOwnedByAtlas = false;
    ImFont* ffont = io.Fonts->AddFontFromFileTTF(std::filesystem::path(std::filesystem::current_path() / "GUI" / "resources" / "fontb.ttf").string().c_str(), 25.f);
    ImGui::PushFont(ffont);

Please Log in or Create an account to join the conversation.

  • crosire
More
2 months 2 weeks ago - 2 months 2 weeks ago #2 by crosire Replied by crosire on topic Change font in source code
It is unfortunately not currently possible to add fonts from an add-on since ReShade clears and rebuilds the font atlas from scratch whenever there is a change to it (since it has to update it when e.g. the language is changed). And also "ImFontAtlas::AddFontFromFileTTF" is not exported, so that shouldn't even build if imgui was overriden with the ReShade add-on variant (should fail with a linker error).

You can however override the font that all of ReShade's overlay is using by updating the config accordingly, though this will require a reload to apply:
reshade::set_config_value(runtime, "STYLE", "Font", (std::filesysttem::current_path() / "GUI" / "resources" / "fontb.ttf").u8string().c_str());
Last edit: 2 months 2 weeks ago by crosire.
The following user(s) said Thank You: sdgsdgsdg

Please Log in or Create an account to join the conversation.

  • sdgsdgsdg
  • Topic Author
More
2 months 2 weeks ago - 2 months 2 weeks ago #3 by sdgsdgsdg Replied by sdgsdgsdg on topic Change font in source code
Thanks, nvm, i forgot to include
Last edit: 2 months 2 weeks ago by sdgsdgsdg.

Please Log in or Create an account to join the conversation.

We use cookies
We use cookies on our website. Some of them are essential for the operation of the forum. You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.