[M108 Migration][VD] Fix Fonts Issue 04/289304/2
authorliuxd <xd123.liu@samsung.com>
Mon, 6 Mar 2023 06:00:19 +0000 (14:00 +0800)
committerBot Blink <blinkbot@samsung.com>
Thu, 23 Mar 2023 16:49:16 +0000 (16:49 +0000)
1.[VD] Fix special character and vowel signs of khmer(Thai,Myanmar) show boxes issue.

Currently,the HarfBuzz buffer of native app use
HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS cluster level,
Chromium use default cluster level:
HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES.

The difference between the two cluster level is like below:
when input special character and vowel signs of khmer(Thai,Myanmar)
(the special character which not included in the khmer(Thai,Myanmar)font):
MONOTONE_CHARACTERS level: two unicode will split two clusters
MONOTONE_GRAPHEMES level: two unicode will bind one cluster,
cause can't get valid glyph, and show boxes.

To keep same behaviour to native app,set the HarfBuzz buffer cluster
level to HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS.

Migrated from aura:
https://review.tizen.org/gerrit/#/c/282743

2.[VD] Perform fallback font for private use unicode

Private-use characters are most commonly used in East Asia, particularly
in Japan, China, and Korea, to extend the available characters in various
standards and vendor character sets.
Refer:
https://www.unicode.org/faq/private_use.html

On VD, Private-use characters are been used, need perform fallback font for it,
or else will cause can not show the correct glyph, but showed as a box.

refer:
https://review.tizen.org/gerrit/#/c/286928

Change-Id: Idc62e49117f676b90bd1ea9867afb8197f003c39
Signed-off-by: liuxd <xd123.liu@samsung.com>
third_party/blink/renderer/platform/fonts/font_cache.cc
third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper.cc

index e66ee96..338aac0 100644 (file)
@@ -287,7 +287,10 @@ scoped_refptr<SimpleFontData> FontCache::FallbackFontForCharacter(
   // http://www.unicode.org/faq/private_use.html#nonchar1 - See also
   // crbug.com/862352 where performing fallback for U+FFFE causes a memory
   // regression.
-  if (Character::IsPrivateUse(lookup_char) ||
+  if (
+#if !BUILDFLAG(IS_TIZEN_TV)
+      Character::IsPrivateUse(lookup_char) ||
+#endif
       Character::IsNonCharacter(lookup_char))
     return nullptr;
   base::ElapsedTimer timer;
index c55d58e..c2ae867 100644 (file)
@@ -301,6 +301,15 @@ inline bool ShapeRange(hb_buffer_t* buffer,
   hb_buffer_set_script(buffer, ICUScriptToHBScript(current_run_script));
   hb_buffer_set_direction(buffer, direction);
 
+#if BUILDFLAG(IS_TIZEN_TV)
+  if (current_run_script == USCRIPT_KHMER ||
+      current_run_script == USCRIPT_THAI ||
+      current_run_script == USCRIPT_MYANMAR) {
+    hb_buffer_set_cluster_level(buffer,
+                                HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS);
+  }
+#endif
+
   hb_font_t* hb_font =
       face->GetScaledFont(std::move(current_font_range_set),
                           HB_DIRECTION_IS_VERTICAL(direction)