-
Notifications
You must be signed in to change notification settings - Fork 59
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
Refactor fonts manager #3401
Refactor fonts manager #3401
Conversation
# Conflicts: # source/MRViewer/MRRibbonFontManager.cpp
{ | ||
assert( false && "Failed to load font!" ); | ||
spdlog::error( "Failed to load font from `{}`.", filename ); | ||
|
||
ImGui::GetIO().Fonts->AddFontFromMemoryCompressedTTF( droid_sans_compressed_data, | ||
font =ImGui::GetIO().Fonts->AddFontFromMemoryCompressedTTF( droid_sans_compressed_data, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will it be loaded multiple times if multiple fonts fail to load?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes in different sizes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it will be loaded for each failed font
FontData{.uniqueFontType = UniqueFont::Regular}, | ||
FontData{.uniqueFontType = UniqueFont::Regular}, | ||
FontData{.uniqueFontType = UniqueFont::SemiBold}, | ||
FontData{.uniqueFontType = UniqueFont::Icons}, | ||
FontData{.uniqueFontType = UniqueFont::Regular}, | ||
FontData{.uniqueFontType = UniqueFont::SemiBold}, | ||
FontData{.uniqueFontType = UniqueFont::SemiBold}, | ||
FontData{.uniqueFontType = UniqueFont::Monospace} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The values are unclear from here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed
} | ||
else if ( type == FontType::SemiBold ) | ||
ImGuiIO& io = ImGui::GetIO(); | ||
const ImWchar wRange[] = { 0x0057, 0x0057, 0 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The source/meaning of the constant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment added
@@ -25,6 +25,20 @@ class MRVIEWER_CLASS RibbonFontManager | |||
Count | |||
}; | |||
|
|||
// Unique fonts that are used for different FontTypes | |||
enum class UniqueFont |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ambiguous enum name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed
This PR simplifies font loading, no hardcoded offsets needed:
(separates loading in two steps: load single glyph and calculate desired offset, load all requested glyphs with calculated offset)
Also allows users to set custom font paths