mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Add hardcoded baseline offset for Apple Color Emoji.
This commit is contained in:
parent
45fc515ae3
commit
0aae67b6bb
2 changed files with 24 additions and 0 deletions
|
@ -1830,6 +1830,18 @@ bool TextServerAdvanced::_ensure_cache_for_size(FontAdvanced *p_font_data, const
|
|||
p_font_data->face_init = true;
|
||||
}
|
||||
|
||||
#if defined(MACOS_ENABLED) || defined(IOS_ENABLED)
|
||||
if (p_font_data->font_name == ".Apple Color Emoji UI" || p_font_data->font_name == "Apple Color Emoji") {
|
||||
// The baseline offset is missing from the Apple Color Emoji UI font data, so add it manually.
|
||||
// This issue doesn't occur with other system emoji fonts.
|
||||
if (!FT_Load_Glyph(fd->face, FT_Get_Char_Index(fd->face, 0x1F92E), FT_LOAD_DEFAULT | FT_LOAD_COLOR)) {
|
||||
if (fd->face->glyph->metrics.horiBearingY == fd->face->glyph->metrics.height) {
|
||||
p_font_data->baseline_offset = 0.15;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Write variations.
|
||||
if (fd->face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS) {
|
||||
FT_MM_Var *amaster;
|
||||
|
|
|
@ -968,6 +968,18 @@ bool TextServerFallback::_ensure_cache_for_size(FontFallback *p_font_data, const
|
|||
p_font_data->face_init = true;
|
||||
}
|
||||
|
||||
#if defined(MACOS_ENABLED) || defined(IOS_ENABLED)
|
||||
if (p_font_data->font_name == ".Apple Color Emoji UI" || p_font_data->font_name == "Apple Color Emoji") {
|
||||
// The baseline offset is missing from the Apple Color Emoji UI font data, so add it manually.
|
||||
// This issue doesn't occur with other system emoji fonts.
|
||||
if (!FT_Load_Glyph(fd->face, FT_Get_Char_Index(fd->face, 0x1F92E), FT_LOAD_DEFAULT | FT_LOAD_COLOR)) {
|
||||
if (fd->face->glyph->metrics.horiBearingY == fd->face->glyph->metrics.height) {
|
||||
p_font_data->baseline_offset = 0.15;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Write variations.
|
||||
if (fd->face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS) {
|
||||
FT_MM_Var *amaster;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue