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

Font pixel snap #2143

Merged
merged 3 commits into from
Aug 30, 2023
Merged

Font pixel snap #2143

merged 3 commits into from
Aug 30, 2023

Conversation

v-ein
Copy link
Contributor

@v-ein v-ein commented Jul 31, 2023


name: Pull Request
about: Create a pull request to help us improve
title: Ability to enable pixel snap on fonts
assignees: @hoffstadt


Description:
ImGui provides a way for font characters to be snapped to whole-pixel boundaries - this is useful when you compute text sizes with monospace fonts by just multiplying character width by the text length. Text width returned by get_text_size is automatically rounded so you often can't rely on it with non-snapped fonts; with pixel_snapH=true, though, get_text_size doesn't lose any fractional values (because they are always integer).

With this fix, the pixel snap parameter gets exposed in DPG API so one can turn it on.

Concerning Areas:
None.

@v-ein
Copy link
Contributor Author

v-ein commented Jul 31, 2023

I'm okay with squashing this PR into a single commit (I thought I'd be able to do it on PR creation, but apparently I can't). The squash option probably resides in the "Merge PR" submenu.

@hoffstadt hoffstadt merged commit 1fe2f6c into hoffstadt:master Aug 30, 2023
4 checks passed
@v-ein v-ein deleted the feature/font-pixel-snap branch August 30, 2023 06:12
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