[pango/pango2: 6/7] Use Emoji script when itemizing text emoji




commit 06b5b427552599ef45484b6ecac9820333b4bf03
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jul 9 11:34:05 2022 -0400

    Use Emoji script when itemizing text emoji
    
    This is an attempt at improving font selection
    for text-presentation Emoji.

 pango2/itemize.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/pango2/itemize.c b/pango2/itemize.c
index 537600d3c..cfc5946f5 100644
--- a/pango2/itemize.c
+++ b/pango2/itemize.c
@@ -884,18 +884,31 @@ itemize_state_update_for_new_run (ItemizeState *state)
 
   if (!state->current_fonts)
     {
-      gboolean is_emoji = pango2_emoji_iter_get (&state->emoji_iter, state->preferred) == 
EMOJI_PRESENTATION_EMOJI;
+      Pango2FontDescription *font_desc = state->font_desc;
+      Pango2Language *lang = state->derived_lang;
+      EmojiPresentation presentation = pango2_emoji_iter_get (&state->emoji_iter, state->preferred);
 
-      if (is_emoji && !state->emoji_font_desc)
+      if (presentation == EMOJI_PRESENTATION_EMOJI)
         {
-          state->emoji_font_desc = pango2_font_description_copy_static (state->font_desc);
-          pango2_font_description_set_family_static (state->emoji_font_desc, "emoji");
+          if (!state->emoji_font_desc)
+            {
+              state->emoji_font_desc = pango2_font_description_copy_static (state->font_desc);
+              pango2_font_description_set_family_static (state->emoji_font_desc, "emoji");
+            }
+
+          font_desc = state->emoji_font_desc;
+          lang = pango2_language_from_string ("und-zsye");
+        }
+      else if (presentation  == EMOJI_PRESENTATION_TEXT)
+        {
+          font_desc = state->font_desc;
+          lang = pango2_language_from_string ("und-zsye");
         }
 
       state->current_fonts = pango2_font_map_load_fontset (state->context->font_map,
                                                            state->context,
-                                                           is_emoji ? state->emoji_font_desc : 
state->font_desc,
-                                                           state->derived_lang);
+                                                           font_desc,
+                                                           lang);
       state->cache = get_font_cache (state->current_fonts);
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]