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

feat(src/renderer): unify fontgroup baseline #1560

Merged
merged 2 commits into from Aug 3, 2023

Conversation

takase1121
Copy link
Member

@takase1121 takase1121 commented Jul 10, 2023

This PR unifies font group baseline by choosing the max baseline value. This would be useful for the emoji PR.

Before:
image

After:
image

This can break stuff if your font has weird baselines, but it works in my case. I'd like to know if its bad or it should be a configurable value.

@takase1121
Copy link
Member Author

VSCodium:

image

Foot:
image

@takase1121
Copy link
Member Author

takase1121 commented Jul 10, 2023

By averaging the baseline I got something like this:

image

@takase1121
Copy link
Member Author

takase1121 commented Jul 22, 2023

Now we align with the first font's baseline instead of calculating the min/max baseline. If you want the baseline of a certain script to be the dominant one, put the font for it as the first in a group. My hands are tied without parsing some OpenType tables and its ultimately up to personal preference as in how text should be vertically aligned.

This is the result:
image

It's relatively correct because CJK fonts don't have a baseline and should use centered alignment. JetBrains Mono aligns in the center, so it looks good.

This is the result with FiraSans, also looking good:
image

jgmdev pushed a commit to pragtical/pragtical that referenced this pull request Jul 31, 2023
@Guldoman Guldoman merged commit a867bef into lite-xl:master Aug 3, 2023
10 checks passed
takase1121 added a commit to takase1121/lite-xl that referenced this pull request Aug 19, 2023
* feat(src/renderer): unify fontgroup baseline

* fix(src/renderer): use the first font's baseline for the text run
takase1121 added a commit to takase1121/lite-xl that referenced this pull request Aug 19, 2023
* feat(src/renderer): unify fontgroup baseline

* fix(src/renderer): use the first font's baseline for the text run
takase1121 added a commit to takase1121/lite-xl that referenced this pull request Aug 19, 2023
* feat(src/renderer): unify fontgroup baseline

* fix(src/renderer): use the first font's baseline for the text run
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.

None yet

2 participants