-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Align icons glyphs or Align text #1869
Comments
At the user level, you may split your text rendering in two steps:
Or:
I agree, been meaning to add an option like that for merging icon fonts as it is a common problem. Will probably add this feature soon. To not add additional absolute size into |
I pushed a branch
|
… to make a font appears monospaced, particularly useful for icon fonts. (#1869)
I saw it, the diff looks awesome, added a calender reminder, will try it when I get back from work in about 5-6 hours. Not sure about the SameLine() solution though, as that will create 2 seperate widgets, and hence decrease the active region of the selectable, right? |
I couldn't get SameLine() solution lines to sync up, but the min_max_advance branch works perfectly. |
To be clear, that's what I'm using in my screenshots as well, the minimum advance glyph branch. |
Will this be merged soon? Seems like a small enough feature to merge? |
I've just tried this branch and it works extremely well for us. We no longer need to add tabs or manually position content. Many thanks! |
Merged. Thanks @madeso @codecat @dougbinks for the confirmation! |
Font File from I am using latest push of IconFontCppHeaders
How can i align icon? |
Hi @vikram-lodhi, We have found that font awesome fonts need to have their sizes reduced by The default font (which it looks like you are using) has a fontsize of 13.0f. So something like this might work well for you: baseFontSize = 13.0f;
icons_config.GlyphMinAdvanceX = baseFontSize * 2.0f/3.0f;
io.Fonts->AddFontFromFileTTF(FONT_ICON_FILE_NAME_FAS, baseFontSize * 2.0f/3.0f, &icons_config, icons_ranges); I should update the readme at https://github.com/juliettef/IconFontCppHeaders to mention this. |
FYI updated the IconFontCppHeaders readme example code. |
You are loading your icons font with size 24 (18 * 4 / 3) whereas You don't need to use |
Load the icon font with a size of 13 or the default font with a size of 24...
You can pass a
|
Version/Branch of Dear ImGui:
About 1 week old master (948009a)
Back-end file/Renderer/OS:
Slightly modified imgui_impl_sdl_gl3.h (changed imgui and opengl include paths)
My Issue/Question:
I want to align the texts/center the icons in this popup:
The current workaround is to add spaces before and after the icon, to align the text, so one possible, but hacky solution would be to add a min_glyph_width to the ImFontConfig struct when loading the font.
The text was updated successfully, but these errors were encountered: