evas_font_query: fixed the wrong arrangement when white-char is on wrapping point 89/232389/1
authorWooHyun Jung <wh0705.jung@samsung.com>
Mon, 4 May 2020 01:59:33 +0000 (10:59 +0900)
committerWooHyun Jung <wh0705.jung@samsung.com>
Mon, 4 May 2020 04:55:12 +0000 (13:55 +0900)
Current textblock does not have proper logic for processing line wrapping when -
1. white-char is on wrapping point
2. white-char is drawn with different font from the characters which are before and after it

So, this change would follow the old logic which assumes the font for white-character is
always cached by the current processing font.

After making proper changes in textblock, then this patch can be reverted.

@tizen_fix

Change-Id: I18f782402dafe64358c9094566ce41f96b8cbb84

src/lib/evas/common/evas_font_query.c

index a25c19c..df15503 100644 (file)
@@ -2,6 +2,54 @@
 
 #define VAR_SEQ_SAFE(x) (((x)<run_end) ? VAR_SEQ(*(x)) : 0)
 
+// TIZEN_ONLY(20050) : Textblock does not have proper logic for line wrapping with below conditions
+//                    1. one of white characters is on the wrapping point
+//                    2. the white character is drawn with different font from the characters which are before and after that.
+//
+//                     This causes the issue that the advance of white is added to the line-width, and results the wrong arrangement of the line.
+//                     And, this is also bad in the ellipsis case.
+//
+//                     So, we need to follow the old logic which has assumed that -
+//                     the fonts for white characters can always be cached by the current processing font. (tag: wrapping_with_white_char)
+static Eina_Bool
+_is_white(Eina_Unicode c)
+{
+   /*
+    * unicode list of whitespace chars
+    *
+    * 0009..000D <control-0009>..<control-000D>
+    * 0020 SPACE
+    * 0085 <control-0085>
+    * 00A0 NO-BREAK SPACE
+    * 1680 OGHAM SPACE MARK
+    * 180E MONGOLIAN VOWEL SEPARATOR
+    * 2000..200A EN QUAD..HAIR SPACE
+    * 2028 LINE SEPARATOR
+    * 2029 PARAGRAPH SEPARATOR
+    * 202F NARROW NO-BREAK SPACE
+    * 205F MEDIUM MATHEMATICAL SPACE
+    * 3000 IDEOGRAPHIC SPACE
+    */
+   if (
+         (c == 0x20) ||
+         ((c >= 0x9) && (c <= 0xd)) ||
+         (c == 0x85) ||
+         (c == 0xa0) ||
+         (c == 0x1680) ||
+         (c == 0x180e) ||
+         ((c >= 0x2000) && (c <= 0x200a)) ||
+         (c == 0x2028) ||
+         (c == 0x2029) ||
+         (c == 0x202f) ||
+         (c == 0x205f) ||
+         (c == 0x3000)
+      )
+     return EINA_TRUE;
+   return EINA_FALSE;
+}
+// END //
+
+
 /* FIXME: Check coverage according to the font and not by actually loading */
 /**
  * @internal
@@ -61,6 +109,9 @@ evas_common_font_query_run_font_end_get(RGBA_Font *fn, RGBA_Font_Int **script_fi
               * script's font. */
              if (!evas_common_get_char_index(fi, *itr, variation_sequence))
                break;
+             // TIZEN_ONLY(20050) : please refer to "wrapping_with_white_char" tag to get details of this code
+             else if (_is_white(*itr)) continue;
+             // END
 
              if (fi != *script_fi)
                {