Skip to content
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

Closed

Conversation

AdenKoperczak
Copy link
Contributor

No description provided.

Copy link

@github-actions github-actions bot left a 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 {

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]

Suggested change
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;

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]

Suggested change
FT_Library ft_library;
FT_Library ft_library = nullptr;

return false;
}

FT_Face Face;

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]

Suggested change
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())),

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())),
      ^

Copy link

@github-actions github-actions bot left a 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 {

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]

Suggested change
units::font_size::points<double> defaultSize {
units::font_size::points<double> const defaultSize {

@dpaulat
Copy link
Owner

dpaulat commented Jan 10, 2025

Closing this pull request in favor of the Fontconfig implementation. Let me know if this is incorrect.

@dpaulat dpaulat closed this Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants