[Title] Brackets are showing reversed, while google searching language is Persian
authorRachit Puri <rachit.puri@samsung.com>
Wed, 16 Oct 2013 05:50:53 +0000 (11:35 +0545)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Thu, 17 Oct 2013 09:12:08 +0000 (09:12 +0000)
[Issue#] N_SE_53772
[Problem] Parenthesis are displaying reversed in RTL languages
[Cause] Parenthesis mirroring was not handled for complex text (RTL languages)
[Solution] Proper check added and verified

Change-Id: If958638885d0fab5b271bdfa352ced8dc12b3d8e

Source/WTF/wtf/Platform.h
Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp [changed mode: 0644->0755]

index 03451fb..77ff4ee 100755 (executable)
 #define ENABLE_TIZEN_FT_EMBOLDEN_FOR_SYNTHETIC_BOLD 1 /*Younghwan Cho(yhwan.cho@samsung.com) : Use freetype's 'embolden' instead of drawing twice for synthetic bold*/
 #endif
 #define ENABLE_TIZEN_CHECK_SPACE_FOR_AVG_CHAR_WIDTH 0 /* Himanshu Joshi (h.joshi@samsung.com : Added check to consider Space as possible way to calculate Average Char Width if '0' and 'x' are not present*/
+#define ENABLE_TIZEN_MIRROR_CHECK_FOR_RTL 1 /* Rachit Puri(rachit.puri@samsung.com) : Added mirror check for RTL */
 
 #define ENABLE_TIZEN_ADD_AA_CONDITIONS_FOR_NINE_PATCH 1 /*Younghwan Cho(yhwan.cho@samsung.com) : Add conditions of antialias for fixing 9patch-problem */
 #define ENABLE_TIZEN_WEBKIT_OWN_FONT_FILES 0 /*Younghwan Cho(yhwan.cho@samsung.com) : webkit's font-config is seperated from the system font's*/
old mode 100644 (file)
new mode 100755 (executable)
index 03611eb..7afea02
@@ -147,7 +147,11 @@ float HarfBuzzShaper::HarfBuzzRun::xPositionForOffset(unsigned offset)
     return position;
 }
 
+#if ENABLE(TIZEN_MIRROR_CHECK_FOR_RTL)
+static void normalizeCharacters(const UChar* source, UChar* destination, int length, bool isRTL = false)
+#else
 static void normalizeCharacters(const UChar* source, UChar* destination, int length)
+#endif
 {
     int position = 0;
     bool error = false;
@@ -159,6 +163,10 @@ static void normalizeCharacters(const UChar* source, UChar* destination, int len
             character = ' ';
         else if (Font::treatAsZeroWidthSpaceInComplexScript(character))
             character = zeroWidthSpace;
+#if ENABLE(TIZEN_MIRROR_CHECK_FOR_RTL)
+        else if (isRTL)
+            character = u_charMirror(character);
+#endif
         U16_APPEND(destination, position, length, character, error);
         ASSERT_UNUSED(error, !error);
         position = nextPosition;
@@ -172,7 +180,11 @@ HarfBuzzShaper::HarfBuzzShaper(const Font* font, const TextRun& run)
 {
     m_normalizedBuffer = adoptArrayPtr(new UChar[m_run.length() + 1]);
     m_normalizedBufferLength = m_run.length();
+#if ENABLE(TIZEN_MIRROR_CHECK_FOR_RTL)
+    normalizeCharacters(m_run.characters(), m_normalizedBuffer.get(), m_normalizedBufferLength, m_run.rtl());
+#else
     normalizeCharacters(m_run.characters(), m_normalizedBuffer.get(), m_normalizedBufferLength);
+#endif
     setPadding(m_run.expansion());
     setFontFeatures();
 }