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

Adjust y_offset calculation to reference baseline #16

Open
wants to merge 1 commit into
base: shell_opengl
Choose a base branch
from

Conversation

MatthewScholefield
Copy link

From my understanding, the extra pixels above the top of the letters should be baseline - cap_height not ascent - cap_height since baseline typically refers to the render position of the bottoms of the letters.

Also, it looks like we fall back to ascent if the cap_height doesn't exist, but I think it still makes sense to subtract the extra top pixels in this case.

Feel free to let me know if I'm misunderstanding anything here since this is based mostly on my interpretation of the code and general font rendering terminology.

For reference, here are the values for Consolas:

LineMetrics { ascent: 14.0, descent: 4.0, cap_height: 9.0, leading: 0.0, baseline: 14.0, offset: 0.0, advance: 0.0, trailing_whitespace: 0.0 }

From my understanding, the extra pixels above the top of the letters should be `baseline - cap_height` not `ascent - cap_height` since `baseline` typically refers to the render position of the bottoms of the letters.

Also, it looks like we fall back to ascent if the cap_height doesn't exist, but I think it still makes sense to subtract the extra top pixels in this case.

Feel free to let me know if I'm misunderstanding anything here since this is based mostly on my interpretation of the code and general font rendering terminology.

For reference, here are the values for `Consolas`:
```
LineMetrics { ascent: 14.0, descent: 4.0, cap_height: 9.0, leading: 0.0, baseline: 14.0, offset: 0.0, advance: 0.0, trailing_whitespace: 0.0 }
```
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.

1 participant