-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Check if fonts have Unicode charmap when loading for ImGui #329
Conversation
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.
clang-tidy made some suggestions
{ | ||
family = textSettings.font_family(fontCategory).GetDefault(); | ||
styles = textSettings.font_style(fontCategory).GetDefault(); | ||
units::font_size::points<double> size { |
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.
warning: variable 'size' of type 'units::font_size::points' (aka 'unit<units::points_, double, units::linear_scale>') can be declared 'const' [misc-const-correctness]
units::font_size::points<double> size { | |
units::font_size::points<double> const size { |
@@ -49,6 +56,43 @@ ImGuiFont::ImGuiFont(const std::string& fontName, | |||
} | |||
ImGuiFont::~ImGuiFont() = default; | |||
|
|||
bool ImGuiFont::Impl::HasUnicode(const std::vector<char>& fontData) | |||
{ | |||
FT_Library ft_library; |
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.
warning: variable 'ft_library' is not initialized [cppcoreguidelines-init-variables]
FT_Library ft_library; | |
FT_Library ft_library = nullptr; |
return false; | ||
} | ||
|
||
FT_Face Face; |
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.
warning: variable 'Face' is not initialized [cppcoreguidelines-init-variables]
FT_Face Face; | |
FT_Face Face = nullptr; |
FT_Face Face; | ||
error = FT_New_Memory_Face( | ||
ft_library, | ||
const_cast<uint8_t*>(reinterpret_cast<const uint8_t*>(fontData.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.
warning: do not use const_cast [cppcoreguidelines-pro-type-const-cast]
const_cast<uint8_t*>(reinterpret_cast<const uint8_t*>(fontData.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.
clang-tidy made some suggestions
{ | ||
auto defaultFamily = textSettings.font_family(fontCategory).GetDefault(); | ||
auto defaultStyles = textSettings.font_style(fontCategory).GetDefault(); | ||
units::font_size::points<double> defaultSize { |
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.
warning: variable 'defaultSize' of type 'units::font_size::points' (aka 'unit<units::points_, double, units::linear_scale>') can be declared 'const' [misc-const-correctness]
units::font_size::points<double> defaultSize { | |
units::font_size::points<double> const defaultSize { |
Closing this pull request in favor of the Fontconfig implementation. Let me know if this is incorrect. |
No description provided.