HumbleUI/Skija

Bottom of emoji and text misaligned on linux

Opened this issue · 4 comments

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.

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

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?

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)

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. 😄