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

Bottom of emoji and text misaligned on linux #18

Open
luojinrong opened this issue May 10, 2022 · 4 comments
Open

Bottom of emoji and text misaligned on linux #18

luojinrong opened this issue May 10, 2022 · 4 comments

Comments

@luojinrong
Copy link

When I draw text with emoji together on Paragraph,I find bottom alignment of emoji and text is fine on mac,but not on linux.

on mac:
image

on linux:
image

I would like to know what is causing this and how to make it behave the same on linux as it does on mac.

ps. I use the same font(AppleColorEmoji.ttc on mac) on both two system.

@tonsky
Copy link
Contributor

tonsky commented May 11, 2022

Might it be that hieroglyph is using different font and different offset from baseline?

@luojinrong
Copy link
Author

Might it be that hieroglyph is using different font and different offset from baseline?

But I use the same font file, how can this happen?

@tonsky
Copy link
Contributor

tonsky commented May 12, 2022

Good question! Technically, fonts can provide different metrics (baseline, ascend, descend) for diffrent OSes.

From https://www.maxkohler.com/posts/2022-02-19-fixing-vertical-metrics/

For his­tor­i­cal rea­sons, ver­ti­cal met­rics are stored in three dif­fer­ent places (called hhea, OS/2 typo and OS/2 win), and dif­fer­ent ren­der­ing en­gines get their in­for­ma­tion from dif­fer­ent ones. Apple de­vices gen­er­ally use hhea, Windows uses ei­ther OS/2 typo or OS/2 win, and old ver­sions of MS Office use OS/2 win ex­clu­sively. If the num­bers in these ta­bles aren’t the same, you can end up in a sit­u­a­tion where type ren­ders dif­fer­ently in dif­fer­ent browsers, de­sign tools, or op­er­at­ing sys­tems.

I wonder if that’s the case here. You can try using something like this https://github.com/source-foundry/font-line to print the metrics (but be sure to figure out which exact font is used for rendering first)

@luojinrong
Copy link
Author

Thank you for helping me find this article. Although I modified ascent and percent in OS/2 according to the method in the article, it still doesn't work.

However, I found the each emoji has a offsetY argument in the TTX file, and realized the alignment by modifying this. 😄

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

No branches or pull requests

2 participants