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

fb: cfb: Fix print of ASCII chars from 128 to 255 #84567

Merged
merged 1 commit into from
Jan 29, 2025

Conversation

Oleh-Kravchenko
Copy link
Contributor

@Oleh-Kravchenko Oleh-Kravchenko commented Jan 26, 2025

Change the "c" variable type from char to uint8_t in get_glyph_ptr() and draw_char_vtmono() to fix issues with the range check of the "c" value.

The easiest way to print localized text with Zephyr is to ask GCC for compile-time conversion:

INCLUDE(${ZEPHYR_BASE}/cmake/cfb.cmake NO_POLICY_SCOPE)
GENERATE_CFB_FONT_FOR_TARGET(app
"${CMAKE_CURRENT_SOURCE_DIR}/fonts/koi8-u.png"
"${ZEPHYR_BINARY_DIR}/include/generated/cfb_font_dice.h"
8 16 --first 0 --last 255)

TARGET_COMPILE_OPTIONS(app PRIVATE
-finput-charset=UTF-8
-fexec-charset=KOI8-U)

Copy link

Hello @Oleh-Kravchenko, and thank you very much for your first pull request to the Zephyr project!
Our Continuous Integration pipeline will execute a series of checks on your Pull Request commit messages and code, and you are expected to address any failures by updating the PR. Please take a look at our commit message guidelines to find out how to format your commit messages, and at our contribution workflow to understand how to update your Pull Request. If you haven't already, please make sure to review the project's Contributor Expectations and update (by amending and force-pushing the commits) your pull request if necessary.
If you are stuck or need help please join us on Discord and ask your question there. Additionally, you can escalate the review when applicable. 😊

@Oleh-Kravchenko
Copy link
Contributor Author

Oleh-Kravchenko commented Jan 26, 2025

This change fix the issue #84566

Change the "c" variable type from char to uint8_t in get_glyph_ptr() and
draw_char_vtmono() to fix issues with the range check of the "c" value.

The easiest way to print localized text with Zephyr is
to ask GCC for compile-time conversion:

  INCLUDE(${ZEPHYR_BASE}/cmake/cfb.cmake NO_POLICY_SCOPE)
    GENERATE_CFB_FONT_FOR_TARGET(app
    "${CMAKE_CURRENT_SOURCE_DIR}/fonts/koi8-u.png"
    "${ZEPHYR_BINARY_DIR}/include/generated/cfb_font_dice.h"
    8 16 --first 0 --last 255)

  TARGET_COMPILE_OPTIONS(app PRIVATE
    -finput-charset=UTF-8
    -fexec-charset=KOI8-U)

Signed-off-by: Oleh Kravchenko <[email protected]>
@jfischer-no jfischer-no requested a review from soburi January 27, 2025 10:56
@kartben kartben merged commit ed15ff1 into zephyrproject-rtos:main Jan 29, 2025
25 checks passed
Copy link

Hi @Oleh-Kravchenko!
Congratulations on getting your very first Zephyr pull request merged 🎉🥳. This is a fantastic achievement, and we're thrilled to have you as part of our community!

To celebrate this milestone and showcase your contribution, we'd love to award you the Zephyr Technical Contributor badge. If you're interested, please claim your badge by filling out this form: Claim Your Zephyr Badge.

Thank you for your valuable input, and we look forward to seeing more of your contributions in the future! 🪁

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

Successfully merging this pull request may close these issues.

fb: cfb: cfb_print() prints empty symbols for ASCII above 127
5 participants