Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Problem loading fonts #17

Closed
trapazza opened this issue Aug 15, 2020 · 2 comments
Closed

Problem loading fonts #17

trapazza opened this issue Aug 15, 2020 · 2 comments

Comments

@trapazza
Copy link

Hi there :)

Has anyone managed to load and use a font other than the default one? It's not working for me and have no idea what I'm doing wrong.

This is what I do:

var io = ImGui.GetIO();
io.Fonts.AddFontDefault();
var font = io.Fonts.AddFontFromFileTTF( font_path, font_pixels ); // font stored in a dictionary
io.Fonts.Build();>

I checked that the font is properly loaded (.IsLoaded()), but the result is that all fonts get corrupted (even the default one). In this case I'm not even using the PushFont/PopFont pair.

image

I've seen that there's a FontAtlasConfigAsset struct referenced from the DearImGui script source code, but I don't have access to it from the IDE and there seems to be literally zero information about how it's used.

Thanks everyone in advance.

@GoomiiV2
Copy link

Hey, I got this working for font icons so this is what I did.

In the project explorer the right click context menu should have a "Dear Imgui" option and in there you can create a "Font Atlas Configuration".

In this file you can set up the multiple fonts to use, this is how I have mine for a normal font and then FontAwesome for the icons.
image

If you just want to replace the default font then the top entry should just be enough.

Then on the GameObject with the Dear Imgui Script you can set the "Font Atlas Configuration" to the asset created above.

Hopefully that helped abit :>

@trapazza
Copy link
Author

Hey, I got this working for font icons so this is what I did.

In the project explorer the right click context menu should have a "Dear Imgui" option and in there you can create a "Font Atlas Configuration".

In this file you can set up the multiple fonts to use, this is how I have mine for a normal font and then FontAwesome for the icons.
image

If you just want to replace the default font then the top entry should just be enough.

Then on the GameObject with the Dear Imgui Script you can set the "Font Atlas Configuration" to the asset created above.

Hopefully that helped abit :>

Yes, yes, yes! thanks a lot :))))

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants